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§
sourcefn initialize_finished(&self)
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.
sourcefn trigger_upload(&self) -> Result<(), CallbackError>
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.
sourcefn start_metrics_ping_scheduler(&self) -> bool
fn start_metrics_ping_scheduler(&self) -> bool
Start the Metrics Ping Scheduler.
sourcefn cancel_uploads(&self) -> Result<(), CallbackError>
fn cancel_uploads(&self) -> Result<(), CallbackError>
Called when upload is disabled and uploads should be stopped
Provided Methods§
sourcefn shutdown(&self) -> Result<(), CallbackError>
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.
Trait Implementations§
source§impl<UT> LiftRef<UT> for Box<dyn OnGleanEvents>
impl<UT> LiftRef<UT> for Box<dyn OnGleanEvents>
type LiftType = Box<dyn OnGleanEvents>
source§impl<UT> LiftReturn<UT> for Box<dyn OnGleanEvents>
impl<UT> LiftReturn<UT> for Box<dyn OnGleanEvents>
§type ReturnType = <Box<dyn OnGleanEvents> as Lift<UT>>::FfiType
type ReturnType = <Box<dyn OnGleanEvents> as Lift<UT>>::FfiType
FFI return type for trait interfaces
source§fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
Lift a successfully returned value from a trait interface
§fn lift_foreign_return(
ffi_return: Self::ReturnType,
call_status: RustCallStatus
) -> Self
fn lift_foreign_return( ffi_return: Self::ReturnType, call_status: RustCallStatus ) -> Self
Lift a foreign returned value from a trait interface Read more
§fn lift_error(_buf: RustBuffer) -> Self
fn lift_error(_buf: RustBuffer) -> Self
Lift a Rust value for a callback interface method error result Read more
§fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
Lift a Rust value for an unexpected callback interface error Read more