#![doc(
html_logo_url = "https://commonware.xyz/imgs/rustdoc_logo.svg",
html_favicon_url = "https://commonware.xyz/favicon.ico"
)]
commonware_macros::stability_scope!(BETA {
use commonware_cryptography::PublicKey;
use commonware_utils::{vec::NonEmptyVec, Span};
use std::future::Future;
pub mod p2p;
pub trait Consumer: Clone + Send + 'static {
type Key: Span;
type Value;
type Failure;
fn deliver(
&mut self,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = bool> + Send;
fn failed(
&mut self,
key: Self::Key,
failure: Self::Failure,
) -> impl Future<Output = ()> + Send;
}
pub trait Resolver: Clone + Send + 'static {
type Key: Span;
type PublicKey: PublicKey;
fn fetch(&mut self, key: Self::Key) -> impl Future<Output = ()> + Send;
fn fetch_all(&mut self, keys: Vec<Self::Key>) -> impl Future<Output = ()> + Send;
fn fetch_targeted(
&mut self,
key: Self::Key,
targets: NonEmptyVec<Self::PublicKey>,
) -> impl Future<Output = ()> + Send;
fn fetch_all_targeted(
&mut self,
requests: Vec<(Self::Key, NonEmptyVec<Self::PublicKey>)>,
) -> impl Future<Output = ()> + Send;
fn cancel(&mut self, key: Self::Key) -> impl Future<Output = ()> + Send;
fn clear(&mut self) -> impl Future<Output = ()> + Send;
fn retain(
&mut self,
predicate: impl Fn(&Self::Key) -> bool + Send + 'static,
) -> impl Future<Output = ()> + Send;
}
});