Skip to main content

WrappingObjectStore

Trait WrappingObjectStore 

Source
pub trait WrappingObjectStore:
    Debug
    + Send
    + Sync {
    // Required methods
    fn wrap(
        &self,
        store_prefix: &str,
        original: Arc<dyn OSObjectStore>,
    ) -> Arc<dyn OSObjectStore> ;
    fn wrap_paginated(
        &self,
        store_prefix: &str,
        original: Arc<dyn PaginatedListStore>,
    ) -> Option<Arc<dyn PaginatedListStore>>;
}

Required Methods§

Source

fn wrap( &self, store_prefix: &str, original: Arc<dyn OSObjectStore>, ) -> Arc<dyn OSObjectStore>

Wrap an object store with additional functionality

The store_prefix is a string which uniquely identifies the object store being wrapped.

Source

fn wrap_paginated( &self, store_prefix: &str, original: Arc<dyn PaginatedListStore>, ) -> Option<Arc<dyn PaginatedListStore>>

Wrap the paginated listing API that goes with the store, if it has one.

ObjectStore::read_dir_page pushes the page size and the resume position into PaginatedListStore, which is a separate trait from OSObjectStore and so cannot be reached through the store Self::wrap returns. A listing that is pushed down therefore does not pass through Self::wrap, and this is where a wrapper says what should happen instead:

  • Some(lister) keeps the pushdown, wrapping the lister or handing back the one given. Right for a wrapper that observes rather than intercepts — metering, caching, mirroring writes.
  • None gives up the pushdown, so listings go through Self::wrap as a full directory read. Right for a wrapper that hides, rewrites or fails paths, which a pushed-down listing would otherwise walk straight past.

A wrapper that keeps the pushdown must leave the listing itself alone: setting offset or changing the delimiter breaks paging, since read_dir_page reads one directory level and resumes by the token it got back.

There is deliberately no default: getting this wrong is either a silent loss of speed or a silent loss of the wrapper, and neither announces itself.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§