ChannelStore

Trait ChannelStore 

pub trait ChannelStore {
    type Error;

    // Required methods
    async fn store_channel(
        &self,
        name: &[u8],
        key: &[u8; 32],
    ) -> Result<(), Self::Error>;
    async fn delete_channel(&self, name: &[u8]) -> Result<(), Self::Error>;
    async fn for_each_channel(
        &self,
        f: &mut dyn FnMut(&[u8], &[u8; 32]),
    ) -> Result<(), Self::Error>;
}
Expand description

Persistent channel directory for the node layer.

Stores and retrieves shared channel keys keyed by channel name (UTF-8, up to 16 bytes). Implementors MUST treat store_channel as an upsert.

Required Associated Types§

type Error

Required Methods§

async fn store_channel( &self, name: &[u8], key: &[u8; 32], ) -> Result<(), Self::Error>

Upsert the channel record for name.

async fn delete_channel(&self, name: &[u8]) -> Result<(), Self::Error>

Remove the channel record for name. A no-op if not present.

async fn for_each_channel( &self, f: &mut dyn FnMut(&[u8], &[u8; 32]), ) -> Result<(), Self::Error>

Invoke f for every persisted channel record.

name is UTF-8 channel name bytes; key is the 32-byte channel key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§