Trait Storage

Source
pub trait Storage: Send + Sync {
    // Required methods
    fn most_recent_story(&self) -> Result<StoryDate, PersistError>;
    fn shard_range(&self) -> Result<ShardRange, PersistError>;
    fn story_count(&self) -> Result<StorageSummary, PersistError>;
    fn fetch_count(
        &self,
        query: StoryQuery,
        max: usize,
    ) -> Result<usize, PersistError>;
    fn fetch_detail_one(
        &self,
        query: StoryQuery,
    ) -> Result<Option<HashMap<String, Vec<String>>>, PersistError>;

    // Provided methods
    fn fetch<S: StoryScrapePayload>(
        &self,
        query: StoryQuery,
        max: usize,
    ) -> Result<Vec<Story<S>>, PersistError>
       where Self: StorageFetch<S> { ... }
    fn fetch_one<S: StoryScrapePayload>(
        &self,
        query: StoryQuery,
    ) -> Result<Option<Story<S>>, PersistError>
       where Self: StorageFetch<S> { ... }
}
Expand description

The underlying storage engine.

Required Methods§

Source

fn most_recent_story(&self) -> Result<StoryDate, PersistError>

Returns the most recent story date.

Source

fn shard_range(&self) -> Result<ShardRange, PersistError>

Returns the range of shards for this index.

Source

fn story_count(&self) -> Result<StorageSummary, PersistError>

Count the docs in this index, breaking it out by index segment.

Source

fn fetch_count( &self, query: StoryQuery, max: usize, ) -> Result<usize, PersistError>

Count the docs matching the query, at most max.

Source

fn fetch_detail_one( &self, query: StoryQuery, ) -> Result<Option<HashMap<String, Vec<String>>>, PersistError>

Fetches the index-specific story details for a single story.

Provided Methods§

Source

fn fetch<S: StoryScrapePayload>( &self, query: StoryQuery, max: usize, ) -> Result<Vec<Story<S>>, PersistError>
where Self: StorageFetch<S>,

Fetch a list of stories with the specified payload type.

Source

fn fetch_one<S: StoryScrapePayload>( &self, query: StoryQuery, ) -> Result<Option<Story<S>>, PersistError>
where Self: StorageFetch<S>,

Fetch a single story with the specified payload type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§