pub struct DelayTimer { /* private fields */ }
Expand description

DelayTimer is an abstraction layer that helps users solve execution cycle synchronous/asynchronous tasks.

Implementations§

source§

impl DelayTimer

source

pub fn new() -> DelayTimer

New a DelayTimer.

source

pub fn add_task(&self, task: Task) -> Result<(), TaskError>

Add a task in timer_core by event-channel.

source

pub fn insert_task(&self, task: Task) -> Result<TaskInstancesChain, TaskError>

Add a task in timer_core by event-channel. But it will return a handle that can constantly take out new instances of the task.

source

pub fn update_task(&self, task: Task) -> Result<(), TaskError>

Update a task in timer_core by event-channel.

source

pub fn remove_task(&self, task_id: u64) -> Result<(), TaskError>

Remove a task in timer_core by event-channel.

source

pub fn advance_task(&self, task_id: u64) -> Result<(), TaskError>

Advance a task in timer_core by event-channel.

source

pub fn cancel_task(&self, task_id: u64, record_id: i64) -> Result<(), TaskError>

Cancel a task in timer_core by event-channel. Cancel is for instances derived from the task running up.

source

pub fn stop_delay_timer(&self) -> Result<(), TaskError>

Stop DelayTimer, running tasks are not affected.

source

pub fn update_id_generator_conf(&self, machine_id: i32, node_id: i32)

Set internal id-generator for machine_id and node_id. Add a new api in the future to support passing a custom id generator. The id-generator is mainly used for binding unique record ids to internal events, for user collection, and for tracking task dynamics.

source§

impl DelayTimer

source

pub fn take_status_reporter(&mut self) -> Option<StatusReporter>

Available on crate feature status-report only.

Take StatusReporter from DelayTimer, through which you can get public events.

source

pub fn get_public_event(&self) -> Result<PublicEvent, TaskError>

Available on crate feature status-report only.

Access to public events through DelayTimer.

Trait Implementations§

source§

impl Clone for DelayTimer

source§

fn clone(&self) -> DelayTimer

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DelayTimer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for DelayTimer

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more