Skip to main content

StorageReadProvider

Trait StorageReadProvider 

Source
pub trait StorageReadProvider: Sync {
    type Reader: Read + Seek;

    // Required methods
    fn open_reader(&self, item_identifier: &str) -> Result<Self::Reader>;
    fn get_length(&self, item_identifier: &str) -> Result<u64>;
    fn exists(&self, item_identifier: &str) -> bool;
}
Expand description

This module provides traits and implementations to access a storage system, it could be a file system or an exchange store.

The StorageReadProvider trait is an abstraction for accessing a storage system in a read only manner. It could be implemented with a file system or an exchange store. It provides methods to open a storage for reading, get the length of the storage and check if a storage with a given identifier exists.

The method is defined in a way that it can work with both file system and BigStorageShim.

Implementations of this trait will be used by DiskIndexReader to access the storage system.

The internal Reader associated type of the StorageReadProvider trait is defined by the StorageReader trait.

Required Associated Types§

Required Methods§

Source

fn open_reader(&self, item_identifier: &str) -> Result<Self::Reader>

Open a storage with the given identifier for read.

Source

fn get_length(&self, item_identifier: &str) -> Result<u64>

Get the length of the storage with the given identifier.

Source

fn exists(&self, item_identifier: &str) -> bool

Check if the storage with the given identifier exists.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§