Skip to main content

ChainReadChannelOperations

Trait ChainReadChannelOperations 

pub trait ChainReadChannelOperations {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn me(&self) -> &Address;
    fn channel_by_id(
        &self,
        channel_id: &HashBase<CoreWrapper<Keccak256Core>>,
    ) -> Result<Option<ChannelEntry>, Self::Error>;
    fn stream_channels<'a>(
        &'a self,
        selector: ChannelSelector,
    ) -> Result<Pin<Box<dyn Stream<Item = ChannelEntry> + Send + 'a>>, Self::Error>;

    // Provided method
    fn channel_by_parties(
        &self,
        src: &Address,
        dst: &Address,
    ) -> Result<Option<ChannelEntry>, Self::Error> { ... }
}
Expand description

On-chain read operations regarding channels.

Required Associated Types§

type Error: Error + Send + Sync + 'static

Required Methods§

fn me(&self) -> &Address

Returns on-chain Address of the current node.

fn channel_by_id( &self, channel_id: &HashBase<CoreWrapper<Keccak256Core>>, ) -> Result<Option<ChannelEntry>, Self::Error>

Returns a single channel given channel_id.

fn stream_channels<'a>( &'a self, selector: ChannelSelector, ) -> Result<Pin<Box<dyn Stream<Item = ChannelEntry> + Send + 'a>>, Self::Error>

Returns a stream of channels given the ChannelSelector.

Provided Methods§

fn channel_by_parties( &self, src: &Address, dst: &Address, ) -> Result<Option<ChannelEntry>, Self::Error>

Returns a single channel given src and dst.

Implementations on Foreign Types§

§

impl<'b, T> ChainReadChannelOperations for &'b T

§

impl<T> ChainReadChannelOperations for Box<T>

§

type Error = <T as ChainReadChannelOperations>::Error

§

fn me(&self) -> &Address

§

fn channel_by_parties( &self, src: &Address, dst: &Address, ) -> Result<Option<ChannelEntry>, <Box<T> as ChainReadChannelOperations>::Error>

§

fn channel_by_id( &self, channel_id: &HashBase<CoreWrapper<Keccak256Core>>, ) -> Result<Option<ChannelEntry>, <Box<T> as ChainReadChannelOperations>::Error>

§

fn stream_channels<'a>( &'a self, selector: ChannelSelector, ) -> Result<Pin<Box<dyn Stream<Item = ChannelEntry> + Send + 'a>>, <Box<T> as ChainReadChannelOperations>::Error>

§

impl<T> ChainReadChannelOperations for Arc<T>

§

type Error = <T as ChainReadChannelOperations>::Error

§

fn me(&self) -> &Address

§

fn channel_by_parties( &self, src: &Address, dst: &Address, ) -> Result<Option<ChannelEntry>, <Arc<T> as ChainReadChannelOperations>::Error>

§

fn channel_by_id( &self, channel_id: &HashBase<CoreWrapper<Keccak256Core>>, ) -> Result<Option<ChannelEntry>, <Arc<T> as ChainReadChannelOperations>::Error>

§

fn stream_channels<'a>( &'a self, selector: ChannelSelector, ) -> Result<Pin<Box<dyn Stream<Item = ChannelEntry> + Send + 'a>>, <Arc<T> as ChainReadChannelOperations>::Error>

Implementors§