pub struct BlobRouter { /* private fields */ }Expand description
One adaptive read router. Routes remain opaque and own any peer sets behind them; the router only orders route identities and bounds route attempts.
Implementations§
Source§impl BlobRouter
impl BlobRouter
pub fn new( routes: Vec<BlobRouteEntry>, cache: Option<Arc<dyn Store>>, config: BlobRouterConfig, ) -> Result<Self, StoreError>
Sourcepub async fn set_routes(
&self,
routes: Vec<BlobRouteEntry>,
) -> Result<(), StoreError>
pub async fn set_routes( &self, routes: Vec<BlobRouteEntry>, ) -> Result<(), StoreError>
Replace the route set. Outcome state survives only when both identity and the exact route allocation are unchanged; provider replacement is therefore immediately eligible for recovery.
pub async fn route_count(&self) -> usize
pub async fn outcomes( &self, ) -> HashMap<BlobRouteIdentity, BlobRouteOutcomeSnapshot>
pub async fn get( &self, hash: &Hash, preferred: Option<&[BlobRouteIdentity]>, ) -> Result<Option<Vec<u8>>, StoreError>
pub async fn get_request( &self, request: BlobRequest, preferred: Option<&[BlobRouteIdentity]>, outer_context: Option<BlobRouteContext>, ) -> Result<Option<Vec<u8>>, StoreError>
Trait Implementations§
Source§impl BlobRoute for BlobRouter
impl BlobRoute for BlobRouter
fn route<'life0, 'async_trait>(
&'life0 self,
request: BlobRequest,
) -> Pin<Box<dyn Future<Output = Result<BlobReply, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn route_with_context<'life0, 'async_trait>(
&'life0 self,
request: BlobRequest,
context: BlobRouteContext,
) -> Pin<Box<dyn Future<Output = Result<BlobReply, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl !Freeze for BlobRouter
impl !RefUnwindSafe for BlobRouter
impl !UnwindSafe for BlobRouter
impl Send for BlobRouter
impl Sync for BlobRouter
impl Unpin for BlobRouter
impl UnsafeUnpin for BlobRouter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more