pub trait Backend:
Send
+ Sync
+ 'static {
type Config: Clone + Send + Sync + 'static;
// Required methods
fn store(
&self,
config: &Self::Config,
meta: SegmentMeta,
segment_data: impl FileExt,
segment_index: Vec<u8>,
) -> impl Future<Output = Result<()>> + Send;
fn find_segment(
&self,
config: &Self::Config,
namespace: &NamespaceName,
req: FindSegmentReq,
) -> impl Future<Output = Result<SegmentKey>> + Send;
fn fetch_segment_index(
&self,
config: &Self::Config,
namespace: &NamespaceName,
key: &SegmentKey,
) -> impl Future<Output = Result<Map<Arc<[u8]>>>> + Send;
async fn fetch_segment_data_to_file(
&self,
config: &Self::Config,
namespace: &NamespaceName,
key: &SegmentKey,
file: &impl FileExt,
) -> Result<CompactedSegmentDataHeader>;
fn fetch_segment_data(
self: Arc<Self>,
config: Self::Config,
namespace: NamespaceName,
key: SegmentKey,
) -> impl Future<Output = Result<impl FileExt>> + Send;
fn meta(
&self,
config: &Self::Config,
namespace: &NamespaceName,
) -> impl Future<Output = Result<DbMeta>> + Send;
async fn restore(
&self,
config: &Self::Config,
namespace: &NamespaceName,
restore_options: RestoreOptions,
dest: impl FileExt,
) -> Result<()>;
fn list_segments<'a>(
&'a self,
config: Self::Config,
namespace: &'a NamespaceName,
until: u64,
) -> impl Stream<Item = Result<SegmentInfo>> + 'a;
fn default_config(&self) -> Self::Config;
}Required Associated Types§
Required Methods§
Sourcefn store(
&self,
config: &Self::Config,
meta: SegmentMeta,
segment_data: impl FileExt,
segment_index: Vec<u8>,
) -> impl Future<Output = Result<()>> + Send
fn store( &self, config: &Self::Config, meta: SegmentMeta, segment_data: impl FileExt, segment_index: Vec<u8>, ) -> impl Future<Output = Result<()>> + Send
Store segment_data with its associated meta
fn find_segment( &self, config: &Self::Config, namespace: &NamespaceName, req: FindSegmentReq, ) -> impl Future<Output = Result<SegmentKey>> + Send
fn fetch_segment_index( &self, config: &Self::Config, namespace: &NamespaceName, key: &SegmentKey, ) -> impl Future<Output = Result<Map<Arc<[u8]>>>> + Send
Sourceasync fn fetch_segment_data_to_file(
&self,
config: &Self::Config,
namespace: &NamespaceName,
key: &SegmentKey,
file: &impl FileExt,
) -> Result<CompactedSegmentDataHeader>
async fn fetch_segment_data_to_file( &self, config: &Self::Config, namespace: &NamespaceName, key: &SegmentKey, file: &impl FileExt, ) -> Result<CompactedSegmentDataHeader>
Fetch a segment for namespace containing frame_no, and writes it to dest.
fn fetch_segment_data( self: Arc<Self>, config: Self::Config, namespace: NamespaceName, key: SegmentKey, ) -> impl Future<Output = Result<impl FileExt>> + Send
Sourcefn meta(
&self,
config: &Self::Config,
namespace: &NamespaceName,
) -> impl Future<Output = Result<DbMeta>> + Send
fn meta( &self, config: &Self::Config, namespace: &NamespaceName, ) -> impl Future<Output = Result<DbMeta>> + Send
Fetch meta for namespace
async fn restore( &self, config: &Self::Config, namespace: &NamespaceName, restore_options: RestoreOptions, dest: impl FileExt, ) -> Result<()>
fn list_segments<'a>( &'a self, config: Self::Config, namespace: &'a NamespaceName, until: u64, ) -> impl Stream<Item = Result<SegmentInfo>> + 'a
Sourcefn default_config(&self) -> Self::Config
fn default_config(&self) -> Self::Config
Returns the default configuration for this storage
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".