Trait chronicle::StoreFileListener
pub trait StoreFileListener {
fn on_acquired(&self, cycle: i32);
fn on_released(&self, cycle: i32);
}
Expand description
The StoreFileListener
trait supports two callbacks on_acquired
and on_released
which are called
each time a new memory-mapped queue cycle is acquired or released respectively.
A bespoke derivation from StoreFileListener
should be provided where required, and is then
attached to the queue during the initial builder
stage.
Example
use chronicle:*;
#[derive(Default)]
struct ExampleListener {}
impl chronicle::StoreFileListener for ExampleListener {
fn on_acquired(&self, cycle: i32) {
println!("on_acquired callback, cycle = {}", cycle);
}
fn on_released(&self, cycle: i32) {
println!("on_released callback, cycle = {}", cycle);
}
}
let queue = queue::SingleChronicleQueueBuilder::new("Example")
.store_file_listener(ExampleListener{})
.build()
.unwrap();
Required Methods§
fn on_acquired(&self, cycle: i32)
fn on_acquired(&self, cycle: i32)
Called when a new cycle (memory-mapped file) is acquired by the Queue
Arguments
cycle
: The integer number of the acquired cycle
fn on_released(&self, cycle: i32)
fn on_released(&self, cycle: i32)
Called when a cycle (memory-mapped file) is released by the Queue
Arguments
cycle
: The integer number of the released cycle