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§
source§impl 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.
source§impl DelayTimer
impl DelayTimer
sourcepub fn take_status_reporter(&mut self) -> Option<StatusReporter>
Available 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>
Available 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§
source§impl Clone for DelayTimer
impl Clone for DelayTimer
source§fn clone(&self) -> DelayTimer
fn clone(&self) -> DelayTimer
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more