pub struct ViewStore<'a, S> {
pub store: &'a S,
pub repo: &'a RepoId,
pub writer: bool,
pub policy: Option<&'a dyn PublicationPolicy>,
}Expand description
A read-only store facade selected after repository authorization.
Fields§
§store: &'a SUnderlying store; mutations through the facade are refused.
repo: &'a RepoIdAuthorized repository identity.
writer: boolWriter view, without conferring read permission.
policy: Option<&'a dyn PublicationPolicy>Coherent serving-stop seam, shared by writer and reader views.
Trait Implementations§
Source§impl<S: NamespaceStore> NamespaceStore for ViewStore<'_, S>
impl<S: NamespaceStore> NamespaceStore for ViewStore<'_, S>
Source§fn capabilities(&self) -> StoreCapabilities
fn capabilities(&self) -> StoreCapabilities
What this store supports.
Source§async fn get(
&self,
p: &Partition,
key: &Key,
) -> Result<Option<Value>, StoreError>
async fn get( &self, p: &Partition, key: &Key, ) -> Result<Option<Value>, StoreError>
The value at
key, if any.Source§async fn get_many(
&self,
p: &Partition,
keys: &[Key],
) -> Result<Vec<Option<Value>>, StoreError>
async fn get_many( &self, p: &Partition, keys: &[Key], ) -> Result<Vec<Option<Value>>, StoreError>
Several keys in one round trip; results in input order. The default
issues sequential
Self::get calls.Source§async fn scan(
&self,
p: &Partition,
start: &Key,
end: &Key,
after: Option<&Cursor>,
limit: u32,
) -> Result<ScanPage, StoreError>
async fn scan( &self, p: &Partition, start: &Key, end: &Key, after: Option<&Cursor>, limit: u32, ) -> Result<ScanPage, StoreError>
Up to
limit (at least 1) entries in [start, end), ascending by
key bytes. after resumes strictly after the cursor’s position; a
cursor outside [start, end) (forged, or from another range) is
StoreError::Invalid. A page may hold fewer than limit entries
and still return next: callers page until next is None.Source§async fn scan_many(
&self,
p: &Partition,
ranges: &[RangeScan],
) -> Result<Vec<ScanPage>, StoreError>
async fn scan_many( &self, p: &Partition, ranges: &[RangeScan], ) -> Result<Vec<ScanPage>, StoreError>
Scan a served prefix of
ranges in order. A nonempty request returns
at least its first page and at most one page per range; callers
re-request any unserved suffix. Every returned page obeys Self::scan.
The default serves every range sequentially.Source§async fn apply(
&self,
_: &Partition,
_: Batch,
) -> Result<BatchOutcome, StoreError>
async fn apply( &self, _: &Partition, _: Batch, ) -> Result<BatchOutcome, StoreError>
One atomic, all-or-nothing batch: validate it, read the backend
clock once, check every precondition in order against committed
state (
NotAfter against that reading); on the first failure return
BatchOutcome::PreconditionFailed or
BatchOutcome::DeadlinePassed and write nothing, otherwise apply
every write and return BatchOutcome::Committed.Source§async fn stats(&self, p: &Partition) -> Result<PartitionStats, StoreError>
async fn stats(&self, p: &Partition) -> Result<PartitionStats, StoreError>
Storage used by one partition; may be approximate or up to 60 s
stale.
Auto Trait Implementations§
impl<'a, S> !RefUnwindSafe for ViewStore<'a, S>
impl<'a, S> !UnwindSafe for ViewStore<'a, S>
impl<'a, S> Freeze for ViewStore<'a, S>
impl<'a, S> Send for ViewStore<'a, S>
impl<'a, S> Sync for ViewStore<'a, S>
impl<'a, S> Unpin for ViewStore<'a, S>
impl<'a, S> UnsafeUnpin for ViewStore<'a, S>where
&'a S: UnsafeUnpin,
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