Skip to main content

Object

Trait Object 

Source
pub trait Object: Sized {
    // Required methods
    fn create(
        &self,
        context: ObjectContext<'_>,
        job: Json<JobSpec>,
    ) -> impl Future<Output = Result<(), HandlerError>> + Send;
    fn replace(
        &self,
        context: ObjectContext<'_>,
        job: Json<JobSpec>,
    ) -> impl Future<Output = Result<(), HandlerError>> + Send;
    fn cancel(
        &self,
        context: ObjectContext<'_>,
    ) -> impl Future<Output = Result<(), HandlerError>> + Send;
    fn run(
        &self,
        context: ObjectContext<'_>,
    ) -> impl Future<Output = Result<(), HandlerError>> + Send;
    fn get(
        &self,
        context: SharedObjectContext<'_>,
    ) -> impl Future<Output = Result<Json<JobSpec>, HandlerError>> + Send;
    fn get_next_run(
        &self,
        context: SharedObjectContext<'_>,
    ) -> impl Future<Output = Result<Json<NextRun>, HandlerError>> + Send;

    // Provided method
    fn serve(self) -> ServeObject<Self> { ... }
}

Required Methods§

Source

fn create( &self, context: ObjectContext<'_>, job: Json<JobSpec>, ) -> impl Future<Output = Result<(), HandlerError>> + Send

Create a new cron job.

Source

fn replace( &self, context: ObjectContext<'_>, job: Json<JobSpec>, ) -> impl Future<Output = Result<(), HandlerError>> + Send

Create a new or replace an existing cron job.

Source

fn cancel( &self, context: ObjectContext<'_>, ) -> impl Future<Output = Result<(), HandlerError>> + Send

Cancel an existing cron job.

Source

fn run( &self, context: ObjectContext<'_>, ) -> impl Future<Output = Result<(), HandlerError>> + Send

Internal handler for running the cron job.

Source

fn get( &self, context: SharedObjectContext<'_>, ) -> impl Future<Output = Result<Json<JobSpec>, HandlerError>> + Send

Get the details of an existing cron job.

Source

fn get_next_run( &self, context: SharedObjectContext<'_>, ) -> impl Future<Output = Result<Json<NextRun>, HandlerError>> + Send

Get the next run time of an existing cron job.

Provided Methods§

Source

fn serve(self) -> ServeObject<Self>

Returns a serving function to use with [::restate_sdk::endpoint::Builder::with_service].

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§