Trait bee_tangle::Hooks [−][src]
pub trait Hooks<T> {
type Error: Debug;
#[must_use]
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
message_id: &'life1 MessageId
) -> Pin<Box<dyn Future<Output = Result<Option<(Message, T)>, Self::Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
#[must_use]
fn insert<'life0, 'async_trait>(
&'life0 self,
message_id: MessageId,
msg: Message,
metadata: T
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
#[must_use]
fn fetch_approvers<'life0, 'life1, 'async_trait>(
&'life0 self,
message_id: &'life1 MessageId
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<MessageId>>, Self::Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
#[must_use]
fn insert_approver<'life0, 'async_trait>(
&'life0 self,
message_id: MessageId,
approver: MessageId
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
#[must_use]
fn update_approvers<'life0, 'life1, 'async_trait>(
&'life0 self,
message_id: MessageId,
approvers: &'life1 [MessageId]
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}Expand description
A trait used to provide hooks for a tangle. The tangle acts as an in-memory cache and will use hooks to extend its effective volume. When an entry doesn’t exist in the tangle cache and needs fetching, or when an entry gets inserted, the tangle will call out to the hooks in order to fulfil these actions.
Associated Types
Loading content...Required methods
#[must_use]fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
message_id: &'life1 MessageId
) -> Pin<Box<dyn Future<Output = Result<Option<(Message, T)>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait, [src]
#[must_use]
fn get<'life0, 'life1, 'async_trait>(&'life0 self,
message_id: &'life1 MessageId
) -> Pin<Box<dyn Future<Output = Result<Option<(Message, T)>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Expand description
Fetch a message from some external storage medium.
#[must_use]fn insert<'life0, 'async_trait>(
&'life0 self,
message_id: MessageId,
msg: Message,
metadata: T
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
#[must_use]
fn insert<'life0, 'async_trait>(&'life0 self,
message_id: MessageId,
msg: Message,
metadata: T
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Expand description
Insert a message into some external storage medium.
#[must_use]fn fetch_approvers<'life0, 'life1, 'async_trait>(
&'life0 self,
message_id: &'life1 MessageId
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<MessageId>>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait, [src]
#[must_use]
fn fetch_approvers<'life0, 'life1, 'async_trait>(&'life0 self,
message_id: &'life1 MessageId
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<MessageId>>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Expand description
Fetch the approvers list for a given message.
#[must_use]fn insert_approver<'life0, 'async_trait>(
&'life0 self,
message_id: MessageId,
approver: MessageId
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
#[must_use]
fn insert_approver<'life0, 'async_trait>(&'life0 self,
message_id: MessageId,
approver: MessageId
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Expand description
Insert a new approver for a given message.
#[must_use]fn update_approvers<'life0, 'life1, 'async_trait>(
&'life0 self,
message_id: MessageId,
approvers: &'life1 [MessageId]
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait, [src]
#[must_use]
fn update_approvers<'life0, 'life1, 'async_trait>(&'life0 self,
message_id: MessageId,
approvers: &'life1 [MessageId]
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Expand description
Update the approvers list for a given message.
Implementors
impl<B: StorageBackend> Hooks<MessageMetadata> for StorageHooks<B>[src]
impl<B: StorageBackend> Hooks<MessageMetadata> for StorageHooks<B>[src]type Error = B::Error
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 MessageId
) -> Pin<Box<dyn Future<Output = Result<Option<(Message, MessageMetadata)>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
id: &'life1 MessageId
) -> Pin<Box<dyn Future<Output = Result<Option<(Message, MessageMetadata)>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn insert<'life0, 'async_trait>(
&'life0 self,
id: MessageId,
tx: Message,
metadata: MessageMetadata
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
id: MessageId,
tx: Message,
metadata: MessageMetadata
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn fetch_approvers<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 MessageId
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<MessageId>>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
id: &'life1 MessageId
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<MessageId>>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn insert_approver<'life0, 'async_trait>(
&'life0 self,
id: MessageId,
approver: MessageId
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
id: MessageId,
approver: MessageId
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn update_approvers<'life0, 'life1, 'async_trait>(
&'life0 self,
id: MessageId,
approvers: &'life1 [MessageId]
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
id: MessageId,
approvers: &'life1 [MessageId]
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,