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§
Sourcefn most_recent_story(&self) -> Result<StoryDate, PersistError>
fn most_recent_story(&self) -> Result<StoryDate, PersistError>
Returns the most recent story date.
Sourcefn shard_range(&self) -> Result<ShardRange, PersistError>
fn shard_range(&self) -> Result<ShardRange, PersistError>
Returns the range of shards for this index.
Sourcefn story_count(&self) -> Result<StorageSummary, PersistError>
fn story_count(&self) -> Result<StorageSummary, PersistError>
Count the docs in this index, breaking it out by index segment.
Sourcefn fetch_count(
&self,
query: StoryQuery,
max: usize,
) -> Result<usize, PersistError>
fn fetch_count( &self, query: StoryQuery, max: usize, ) -> Result<usize, PersistError>
Count the docs matching the query, at most max.
Sourcefn fetch_detail_one(
&self,
query: StoryQuery,
) -> Result<Option<HashMap<String, Vec<String>>>, PersistError>
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§
Sourcefn fetch<S: StoryScrapePayload>(
&self,
query: StoryQuery,
max: usize,
) -> Result<Vec<Story<S>>, PersistError>where
Self: StorageFetch<S>,
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.
Sourcefn fetch_one<S: StoryScrapePayload>(
&self,
query: StoryQuery,
) -> Result<Option<Story<S>>, PersistError>where
Self: StorageFetch<S>,
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.