pub struct StoryIndex { /* private fields */ }
Implementations§
Source§impl StoryIndex
impl StoryIndex
pub fn new(location: PersistLocation) -> Result<Self, PersistError>
pub fn shards(&self) -> ShardRange
Sourcepub fn with_scrapes<F: FnOnce(&ScrapeStore) -> T, T>(&self, f: F) -> T
pub fn with_scrapes<F: FnOnce(&ScrapeStore) -> T, T>(&self, f: F) -> T
Borrow the ScrapeStore
for a period of time.
Trait Implementations§
Source§impl Storage for StoryIndex
impl Storage for StoryIndex
Source§fn most_recent_story(&self) -> Result<StoryDate, PersistError>
fn most_recent_story(&self) -> Result<StoryDate, PersistError>
Returns the most recent story date.
Source§fn shard_range(&self) -> Result<ShardRange, PersistError>
fn shard_range(&self) -> Result<ShardRange, PersistError>
Returns the range of shards for this index.
Source§fn 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.
Source§fn 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.
Source§fn 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.
Source§fn 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.
Source§fn 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.
Source§impl StorageFetch<Shard> for StoryIndex
impl StorageFetch<Shard> for StoryIndex
fn fetch_type( &self, query: StoryQuery, max: usize, ) -> Result<Vec<Story<Shard>>, PersistError>
Source§impl StorageFetch<TypedScrape> for StoryIndex
impl StorageFetch<TypedScrape> for StoryIndex
fn fetch_type( &self, query: StoryQuery, max: usize, ) -> Result<Vec<Story<TypedScrape>>, PersistError>
Source§impl StorageWriter for StoryIndex
impl StorageWriter for StoryIndex
Source§fn insert_scrapes<I: IntoIterator<Item = TypedScrape>>(
&mut self,
eval: &StoryEvaluator,
scrapes: I,
) -> Result<Vec<ScrapePersistResult>, PersistError>
fn insert_scrapes<I: IntoIterator<Item = TypedScrape>>( &mut self, eval: &StoryEvaluator, scrapes: I, ) -> Result<Vec<ScrapePersistResult>, PersistError>
Inserts individual scrapes, assuming that there is no story overlap in the input scrapes. If there are matching scrapes in stories in the index, those stories are updated with the new scrapes.
Source§fn insert_scrape_collections<I: IntoIterator<Item = ScrapeCollection>>(
&mut self,
eval: &StoryEvaluator,
scrape_collections: I,
) -> Result<Vec<ScrapePersistResult>, PersistError>
fn insert_scrape_collections<I: IntoIterator<Item = ScrapeCollection>>( &mut self, eval: &StoryEvaluator, scrape_collections: I, ) -> Result<Vec<ScrapePersistResult>, PersistError>
Inserts a set of pre-existing scrape collections, assuming that these stories do not already exist in the index. This is the fastest way to populate an index.
Source§fn reinsert_stories<I: IntoIterator<Item = StoryIdentifier>>(
&mut self,
eval: &StoryEvaluator,
stories: I,
) -> Result<Vec<ScrapePersistResult>, PersistError>
fn reinsert_stories<I: IntoIterator<Item = StoryIdentifier>>( &mut self, eval: &StoryEvaluator, stories: I, ) -> Result<Vec<ScrapePersistResult>, PersistError>
Re-insert a set of stories, assuming that they are in the index. This must only be used with a story sourced from this index. Note that the
Auto Trait Implementations§
impl !Freeze for StoryIndex
impl RefUnwindSafe for StoryIndex
impl Send for StoryIndex
impl Sync for StoryIndex
impl Unpin for StoryIndex
impl !UnwindSafe for StoryIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more