Trait glean_core::OnGleanEvents

source ·
pub trait OnGleanEvents: Send {
    // Required methods
    fn initialize_finished(&self);
    fn trigger_upload(&self) -> Result<(), CallbackError>;
    fn start_metrics_ping_scheduler(&self) -> bool;
    fn cancel_uploads(&self) -> Result<(), CallbackError>;

    // Provided method
    fn shutdown(&self) -> Result<(), CallbackError> { ... }
}
Expand description

A callback object used to trigger actions on the foreign-language side.

A callback object is stored in glean-core for the entire lifetime of the application.

Required Methods§

source

fn initialize_finished(&self)

Initialization finished.

The language SDK can do additional things from within the same initializer thread, e.g. starting to observe application events for foreground/background behavior. The observer then needs to call the respective client activity API.

source

fn trigger_upload(&self) -> Result<(), CallbackError>

Trigger the uploader whenever a ping was submitted.

This should not block. The uploader needs to asynchronously poll Glean for new pings to upload.

source

fn start_metrics_ping_scheduler(&self) -> bool

Start the Metrics Ping Scheduler.

source

fn cancel_uploads(&self) -> Result<(), CallbackError>

Called when upload is disabled and uploads should be stopped

Provided Methods§

source

fn shutdown(&self) -> Result<(), CallbackError>

Called on shutdown, before glean-core is fully shutdown.

  • This MUST NOT put any new tasks on the dispatcher.
    • New tasks will be ignored.
  • This SHOULD NOT block arbitrarily long.
    • Shutdown waits for a maximum of 30 seconds.

Implementors§