Struct delay_timer::entity::DelayTimer
source · [−]pub struct DelayTimer { /* private fields */ }Expand description
DelayTimer is an abstraction layer that helps users solve execution cycle synchronous/asynchronous tasks.
Implementations
sourceimpl DelayTimer
impl DelayTimer
sourcepub fn new() -> DelayTimer
pub fn new() -> DelayTimer
New a DelayTimer.
sourcepub fn add_task(&self, task: Task) -> Result<(), TaskError>
pub fn add_task(&self, task: Task) -> Result<(), TaskError>
Add a task in timer_core by event-channel.
sourcepub fn insert_task(&self, task: Task) -> Result<TaskInstancesChain, TaskError>
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.
sourcepub fn update_task(&self, task: Task) -> Result<(), TaskError>
pub fn update_task(&self, task: Task) -> Result<(), TaskError>
Update a task in timer_core by event-channel.
sourcepub fn remove_task(&self, task_id: u64) -> Result<(), TaskError>
pub fn remove_task(&self, task_id: u64) -> Result<(), TaskError>
Remove a task in timer_core by event-channel.
sourcepub fn advance_task(&self, task_id: u64) -> Result<(), TaskError>
pub fn advance_task(&self, task_id: u64) -> Result<(), TaskError>
Advance a task in timer_core by event-channel.
sourcepub fn cancel_task(&self, task_id: u64, record_id: i64) -> Result<(), TaskError>
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.
sourcepub fn stop_delay_timer(&self) -> Result<(), TaskError>
pub fn stop_delay_timer(&self) -> Result<(), TaskError>
Stop DelayTimer, running tasks are not affected.
sourcepub fn update_id_generator_conf(&self, machine_id: i32, node_id: i32)
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.
sourceimpl DelayTimer
impl DelayTimer
sourcepub fn take_status_reporter(&mut self) -> Option<StatusReporter>
This is supported on crate feature status-report only.
pub fn take_status_reporter(&mut self) -> Option<StatusReporter>
status-report only.Take StatusReporter from DelayTimer, through which you can get public events.
sourcepub fn get_public_event(&self) -> Result<PublicEvent, TaskError>
This is supported on crate feature status-report only.
pub fn get_public_event(&self) -> Result<PublicEvent, TaskError>
status-report only.Access to public events through DelayTimer.
Trait Implementations
sourceimpl Clone for DelayTimer
impl Clone for DelayTimer
sourcefn clone(&self) -> DelayTimer
fn clone(&self) -> DelayTimer
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for DelayTimer
impl Debug for DelayTimer
Auto Trait Implementations
impl !RefUnwindSafe for DelayTimer
impl Send for DelayTimer
impl Sync for DelayTimer
impl Unpin for DelayTimer
impl !UnwindSafe for DelayTimer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output; where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output; where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more