Skip to main content

SegmentSource

Struct SegmentSource 

Source
pub struct SegmentSource<S> { /* private fields */ }
Expand description

Read-through segment source over a blob/root store.

Implementations§

Source§

impl<S: BlobStore + RootStore> SegmentSource<S>

Source

pub fn new(store: Arc<S>) -> Self

Wraps a store with an empty cache.

Source

pub async fn index_root(&self, db: &str) -> Result<Option<DbRoot>, StoreError>

Reads the current published index root for db.

§Errors

Returns an error when the root store cannot be read.

Source

pub async fn lease_holder_endpoint( &self, db: &str, ) -> Result<Option<String>, StoreError>

Rediscovers the current lease holder’s advertised client endpoint from the root record — peers with storage credentials can rebuild their endpoint preference after an HA takeover without any static configuration.

§Errors

Returns an error when the root store cannot be read.

Source

pub async fn segment( &self, root: &DbRoot, order: IndexOrder, ) -> Result<Option<Arc<[u8]>>, StoreError>

Loads the full key stream for one index order of a published root, through the cache: a format-3 manifest’s chunks concatenated in order, or a pre-format-3 flat segment as stored.

§Errors

Returns an error when a blob cannot be loaded or is missing.

Source

pub fn segment_keys(bytes: &[u8]) -> Result<Vec<Vec<u8>>, StoreError>

Decodes a segment’s length-prefixed key entries.

§Errors

Returns StoreError::CorruptBlob-free decode failures as None entries never occur; malformed framing yields an error.

Auto Trait Implementations§

§

impl<S> !Freeze for SegmentSource<S>

§

impl<S> RefUnwindSafe for SegmentSource<S>
where S: RefUnwindSafe,

§

impl<S> Send for SegmentSource<S>
where S: Sync + Send,

§

impl<S> Sync for SegmentSource<S>
where S: Sync + Send,

§

impl<S> Unpin for SegmentSource<S>

§

impl<S> UnsafeUnpin for SegmentSource<S>

§

impl<S> UnwindSafe for SegmentSource<S>
where S: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more