pub struct FirestoreCacheCollectionConfiguration {
pub collection_name: String,
pub parent: Option<String>,
pub listener_target: FirestoreListenerTarget,
pub collection_load_mode: FirestoreCacheCollectionLoadMode,
pub collection_watch: FirestoreCacheCollectionWatch,
/* private fields */
}Expand description
Configuration for a single cached collection.
Fields§
§collection_name: StringThe collection ID, for example users.
parent: Option<String>An optional parent document path, for caching a sub-collection.
listener_target: FirestoreListenerTargetThe Firestore listener target ID used to keep this collection up to date. It must be unique across every listener in your application, not just within the cache.
collection_load_mode: FirestoreCacheCollectionLoadModeHow this collection is populated at startup, which also determines whether list/query
may be served from the cache.
collection_watch: FirestoreCacheCollectionWatchWhich documents of the collection the cache holds and listens to.
Implementations§
Source§impl FirestoreCacheCollectionConfiguration
impl FirestoreCacheCollectionConfiguration
Sourcepub fn new<S>(
collection_name: S,
listener_target: FirestoreListenerTarget,
collection_load_mode: FirestoreCacheCollectionLoadMode,
) -> Self
pub fn new<S>( collection_name: S, listener_target: FirestoreListenerTarget, collection_load_mode: FirestoreCacheCollectionLoadMode, ) -> Self
Creates a configuration for a collection.
Sourcepub fn listener_target_params(
&self,
resume_type: Option<FirestoreListenerTargetResumeType>,
) -> FirestoreListenerTargetParams
pub fn listener_target_params( &self, resume_type: Option<FirestoreListenerTargetResumeType>, ) -> FirestoreListenerTargetParams
The listener target that keeps this collection up to date.
Backends use this in load so that a collection
limited to named documents is listened to as a documents target rather than as a query over
the whole collection.
Sourcepub fn listener_read_time() -> FirestoreInstant
pub fn listener_read_time() -> FirestoreInstant
The point in time a newly attached listener target should be resumed from.
Deliberately a little behind the local clock: a read time in the server’s future is rejected as invalid, and a client clock can easily run slightly ahead. The cost is a few redundant document changes, which are idempotent.
Sourcepub fn with_documents<I>(self, document_ids: I) -> Self
pub fn with_documents<I>(self, document_ids: I) -> Self
Caches and listens to only these documents of the collection, instead of all of them.
Sourcepub fn watched_document_ids(&self) -> Option<&[String]>
pub fn watched_document_ids(&self) -> Option<&[String]>
The document IDs this collection is limited to, if any.
Sourcepub fn with_parent<S>(self, parent: S) -> Self
pub fn with_parent<S>(self, parent: S) -> Self
Caches a sub-collection under the given parent document path.
Use FirestoreDb::parent_path to build the parent.
Trait Implementations§
Source§impl From<FirestoreCacheCollectionConfiguration> for FirestoreCacheCollection
impl From<FirestoreCacheCollectionConfiguration> for FirestoreCacheCollection
Source§fn from(config: FirestoreCacheCollectionConfiguration) -> Self
fn from(config: FirestoreCacheCollectionConfiguration) -> Self
Auto Trait Implementations§
impl Freeze for FirestoreCacheCollectionConfiguration
impl RefUnwindSafe for FirestoreCacheCollectionConfiguration
impl Send for FirestoreCacheCollectionConfiguration
impl Sync for FirestoreCacheCollectionConfiguration
impl Unpin for FirestoreCacheCollectionConfiguration
impl UnsafeUnpin for FirestoreCacheCollectionConfiguration
impl UnwindSafe for FirestoreCacheCollectionConfiguration
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request