Skip to main content

Signals

Trait Signals 

Source
pub trait Signals: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn current(&self, namespace: &str) -> Option<u64>;
    fn ensure<'life0, 'life1, 'async_trait>(
        &'life0 self,
        namespace: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = CoreResult<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn bump<'life0, 'life1, 'async_trait>(
        &'life0 self,
        namespace: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = CoreResult<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn refresh<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = CoreResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn known<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = CoreResult<Vec<(String, u64)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn lock<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        owner: &'life2 str,
        ttl: Duration,
    ) -> Pin<Box<dyn Future<Output = CoreResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn unlock<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        owner: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = CoreResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Where generations and locks live, shared by every process.

A process keeps a replica of the generations: current answers from it without waiting, a bump through this process updates it at once, and refresh brings in the other processes’ bumps.

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn current(&self, namespace: &str) -> Option<u64>

The generation this process last saw, or None before the namespace was ever read here.

Source

fn ensure<'life0, 'life1, 'async_trait>( &'life0 self, namespace: &'life1 str, ) -> Pin<Box<dyn Future<Output = CoreResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The generation, seeding the namespace when it is new.

Source

fn bump<'life0, 'life1, 'async_trait>( &'life0 self, namespace: &'life1 str, ) -> Pin<Box<dyn Future<Output = CoreResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Moves the namespace to a new generation and returns it.

Source

fn refresh<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = CoreResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reloads every generation from the shared store.

Source

fn known<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = CoreResult<Vec<(String, u64)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Every namespace the shared store knows, with its generation.

Source

fn lock<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, name: &'life1 str, owner: &'life2 str, ttl: Duration, ) -> Pin<Box<dyn Future<Output = CoreResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Takes the named lock for owner until ttl passes or it is released; false while another owner holds it.

Source

fn unlock<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, name: &'life1 str, owner: &'life2 str, ) -> Pin<Box<dyn Future<Output = CoreResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Releases the lock when owner holds it; true when it did.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§