Struct bonsaidb::server::ServerDatabase
source · [−]Expand description
A database belonging to a CustomServer
.
Methods from Deref<Target = Database>
Trait Implementations
sourceimpl<B> Connection for ServerDatabase<B> where
B: Backend,
impl<B> Connection for ServerDatabase<B> where
B: Backend,
Pass-through implementation
sourcefn get<'life0, 'async_trait, C, PrimaryKey>(
&'life0 self,
id: PrimaryKey
) -> Pin<Box<dyn Future<Output = Result<Option<OwnedDocument>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
C: Collection + 'async_trait,
PrimaryKey: Into<AnyDocumentId<<C as Collection>::PrimaryKey>> + Send + 'async_trait,
ServerDatabase<B>: 'async_trait,
fn get<'life0, 'async_trait, C, PrimaryKey>(
&'life0 self,
id: PrimaryKey
) -> Pin<Box<dyn Future<Output = Result<Option<OwnedDocument>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
C: Collection + 'async_trait,
PrimaryKey: Into<AnyDocumentId<<C as Collection>::PrimaryKey>> + Send + 'async_trait,
ServerDatabase<B>: 'async_trait,
Retrieves a stored document from Collection
C
identified by id
. Read more
sourcefn get_multiple<'life0, 'async_trait, C, PrimaryKey, DocumentIds, I>(
&'life0 self,
ids: DocumentIds
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
C: Collection + 'async_trait,
DocumentIds: IntoIterator<Item = PrimaryKey, IntoIter = I> + Send + Sync + 'async_trait,
I: Iterator<Item = PrimaryKey> + Send + Sync + 'async_trait,
PrimaryKey: Into<AnyDocumentId<<C as Collection>::PrimaryKey>> + Send + Sync + 'async_trait,
ServerDatabase<B>: 'async_trait,
fn get_multiple<'life0, 'async_trait, C, PrimaryKey, DocumentIds, I>(
&'life0 self,
ids: DocumentIds
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
C: Collection + 'async_trait,
DocumentIds: IntoIterator<Item = PrimaryKey, IntoIter = I> + Send + Sync + 'async_trait,
I: Iterator<Item = PrimaryKey> + Send + Sync + 'async_trait,
PrimaryKey: Into<AnyDocumentId<<C as Collection>::PrimaryKey>> + Send + Sync + 'async_trait,
ServerDatabase<B>: 'async_trait,
Retrieves all documents matching ids
. Documents that are not found
are not returned, but no error will be generated. Read more
sourcefn list<'life0, 'async_trait, C, R, PrimaryKey>(
&'life0 self,
ids: R,
order: Sort,
limit: Option<usize>
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
C: Collection + 'async_trait,
R: Into<Range<PrimaryKey>> + Send + 'async_trait,
PrimaryKey: Into<AnyDocumentId<<C as Collection>::PrimaryKey>> + Send + 'async_trait,
ServerDatabase<B>: 'async_trait,
fn list<'life0, 'async_trait, C, R, PrimaryKey>(
&'life0 self,
ids: R,
order: Sort,
limit: Option<usize>
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
C: Collection + 'async_trait,
R: Into<Range<PrimaryKey>> + Send + 'async_trait,
PrimaryKey: Into<AnyDocumentId<<C as Collection>::PrimaryKey>> + Send + 'async_trait,
ServerDatabase<B>: 'async_trait,
Retrieves all documents within the range of ids
. To retrieve all
documents, pass in ..
for ids
. Read more
sourcefn count<'life0, 'async_trait, C, R, PrimaryKey>(
&'life0 self,
ids: R
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
C: Collection + 'async_trait,
R: Into<Range<PrimaryKey>> + Send + 'async_trait,
PrimaryKey: Into<AnyDocumentId<<C as Collection>::PrimaryKey>> + Send + 'async_trait,
ServerDatabase<B>: 'async_trait,
fn count<'life0, 'async_trait, C, R, PrimaryKey>(
&'life0 self,
ids: R
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
C: Collection + 'async_trait,
R: Into<Range<PrimaryKey>> + Send + 'async_trait,
PrimaryKey: Into<AnyDocumentId<<C as Collection>::PrimaryKey>> + Send + 'async_trait,
ServerDatabase<B>: 'async_trait,
Counts the number of documents within the range of ids
. Read more
sourcefn query<'life0, 'async_trait, V>(
&'life0 self,
key: Option<QueryKey<<V as View>::Key>>,
order: Sort,
limit: Option<usize>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<Map<<V as View>::Key, <V as View>::Value>, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
V: SerializedView + 'async_trait,
ServerDatabase<B>: Sized,
ServerDatabase<B>: 'async_trait,
fn query<'life0, 'async_trait, V>(
&'life0 self,
key: Option<QueryKey<<V as View>::Key>>,
order: Sort,
limit: Option<usize>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<Map<<V as View>::Key, <V as View>::Value>, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
V: SerializedView + 'async_trait,
ServerDatabase<B>: Sized,
ServerDatabase<B>: 'async_trait,
sourcefn query_with_docs<'life0, 'async_trait, V>(
&'life0 self,
key: Option<QueryKey<<V as View>::Key>>,
order: Sort,
limit: Option<usize>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<MappedDocuments<OwnedDocument, V>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
V: SerializedView + 'async_trait,
ServerDatabase<B>: Sized,
ServerDatabase<B>: 'async_trait,
fn query_with_docs<'life0, 'async_trait, V>(
&'life0 self,
key: Option<QueryKey<<V as View>::Key>>,
order: Sort,
limit: Option<usize>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<MappedDocuments<OwnedDocument, V>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
V: SerializedView + 'async_trait,
ServerDatabase<B>: Sized,
ServerDatabase<B>: 'async_trait,
sourcefn reduce<'life0, 'async_trait, V>(
&'life0 self,
key: Option<QueryKey<<V as View>::Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<<V as View>::Value, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
V: SerializedView + 'async_trait,
ServerDatabase<B>: Sized,
ServerDatabase<B>: 'async_trait,
fn reduce<'life0, 'async_trait, V>(
&'life0 self,
key: Option<QueryKey<<V as View>::Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<<V as View>::Value, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
V: SerializedView + 'async_trait,
ServerDatabase<B>: Sized,
ServerDatabase<B>: 'async_trait,
sourcefn reduce_grouped<'life0, 'async_trait, V>(
&'life0 self,
key: Option<QueryKey<<V as View>::Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedValue<<V as View>::Key, <V as View>::Value>, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
V: SerializedView + 'async_trait,
ServerDatabase<B>: Sized,
ServerDatabase<B>: 'async_trait,
fn reduce_grouped<'life0, 'async_trait, V>(
&'life0 self,
key: Option<QueryKey<<V as View>::Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedValue<<V as View>::Key, <V as View>::Value>, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
V: SerializedView + 'async_trait,
ServerDatabase<B>: Sized,
ServerDatabase<B>: 'async_trait,
sourcefn delete_docs<'life0, 'async_trait, V>(
&'life0 self,
key: Option<QueryKey<<V as View>::Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
V: SerializedView + 'async_trait,
ServerDatabase<B>: Sized,
ServerDatabase<B>: 'async_trait,
fn delete_docs<'life0, 'async_trait, V>(
&'life0 self,
key: Option<QueryKey<<V as View>::Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
V: SerializedView + 'async_trait,
ServerDatabase<B>: Sized,
ServerDatabase<B>: 'async_trait,
Deletes all of the documents associated with this view. Read more
sourcefn apply_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction
) -> Pin<Box<dyn Future<Output = Result<Vec<OperationResult, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
fn apply_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction
) -> Pin<Box<dyn Future<Output = Result<Vec<OperationResult, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
Applies a Transaction
to the schema::Schema
. If any operation in the
Transaction
fails, none of the operations will be applied to the
schema::Schema
. Read more
sourcefn list_executed_transactions<'life0, 'async_trait>(
&'life0 self,
starting_id: Option<u64>,
result_limit: Option<usize>
) -> Pin<Box<dyn Future<Output = Result<Vec<Executed, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
fn list_executed_transactions<'life0, 'async_trait>(
&'life0 self,
starting_id: Option<u64>,
result_limit: Option<usize>
) -> Pin<Box<dyn Future<Output = Result<Vec<Executed, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
Lists executed Transaction
s from this schema::Schema
. By default, a maximum of
1000 entries will be returned, but that limit can be overridden by
setting result_limit
. A hard limit of 100,000 results will be
returned. To begin listing after another known transaction_id
, pass
transaction_id + 1
into starting_id
. Read more
sourcefn last_transaction_id<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
fn last_transaction_id<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
Fetches the last transaction id that has been committed, if any.
sourcefn compact_collection<'life0, 'async_trait, C>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
C: Collection + 'async_trait,
ServerDatabase<B>: 'async_trait,
fn compact_collection<'life0, 'async_trait, C>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
C: Collection + 'async_trait,
ServerDatabase<B>: 'async_trait,
Compacts the collection to reclaim unused disk space. Read more
sourcefn compact<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
fn compact<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
Compacts the entire database to reclaim unused disk space. Read more
sourcefn compact_key_value_store<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
fn compact_key_value_store<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
Compacts the key value store to reclaim unused disk space. Read more
sourcefn collection<C>(&self) -> Collection<'_, Self, C> where
C: Collection,
fn collection<C>(&self) -> Collection<'_, Self, C> where
C: Collection,
Accesses a collection for the connected schema::Schema
.
sourcefn insert<'life0, 'async_trait, C, PrimaryKey, B>(
&'life0 self,
id: Option<PrimaryKey>,
contents: B
) -> Pin<Box<dyn Future<Output = Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
C: Collection + 'async_trait,
PrimaryKey: Into<AnyDocumentId<<C as Collection>::PrimaryKey>> + Send + 'async_trait,
B: Into<Bytes> + Send + 'async_trait,
Self: 'async_trait,
fn insert<'life0, 'async_trait, C, PrimaryKey, B>(
&'life0 self,
id: Option<PrimaryKey>,
contents: B
) -> Pin<Box<dyn Future<Output = Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
C: Collection + 'async_trait,
PrimaryKey: Into<AnyDocumentId<<C as Collection>::PrimaryKey>> + Send + 'async_trait,
B: Into<Bytes> + Send + 'async_trait,
Self: 'async_trait,
Inserts a newly created document into the connected schema::Schema
for the Collection
C
. If id
is None
a unique id will be
generated. If an id is provided and a document already exists with that
id, a conflict error will be returned. Read more
sourcefn update<'life0, 'life1, 'async_trait, C, D>(
&'life0 self,
doc: &'life1 mut D
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
C: Collection + 'async_trait,
D: Document<C> + Send + Sync + 'async_trait,
Self: 'async_trait,
fn update<'life0, 'life1, 'async_trait, C, D>(
&'life0 self,
doc: &'life1 mut D
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
C: Collection + 'async_trait,
D: Document<C> + Send + Sync + 'async_trait,
Self: 'async_trait,
Updates an existing document in the connected schema::Schema
for the
Collection
C
. Upon success, doc.revision
will be updated with
the new revision. Read more
sourcefn overwrite<'a, 'life0, 'async_trait, C, PrimaryKey>(
&'life0 self,
id: PrimaryKey,
contents: Vec<u8, Global>
) -> Pin<Box<dyn Future<Output = Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>> + Send + 'async_trait, Global>> where
'a: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
PrimaryKey: Into<AnyDocumentId<<C as Collection>::PrimaryKey>> + Send + 'async_trait,
Self: 'async_trait,
fn overwrite<'a, 'life0, 'async_trait, C, PrimaryKey>(
&'life0 self,
id: PrimaryKey,
contents: Vec<u8, Global>
) -> Pin<Box<dyn Future<Output = Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>> + Send + 'async_trait, Global>> where
'a: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
PrimaryKey: Into<AnyDocumentId<<C as Collection>::PrimaryKey>> + Send + 'async_trait,
Self: 'async_trait,
Overwrites an existing document, or inserts a new document. Upon success,
doc.revision
will be updated with the new revision information. Read more
sourcefn delete<'life0, 'life1, 'async_trait, C, H>(
&'life0 self,
doc: &'life1 H
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
C: Collection + 'async_trait,
H: HasHeader + Send + Sync + 'async_trait,
Self: 'async_trait,
fn delete<'life0, 'life1, 'async_trait, C, H>(
&'life0 self,
doc: &'life1 H
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
C: Collection + 'async_trait,
H: HasHeader + Send + Sync + 'async_trait,
Self: 'async_trait,
Removes a Document
from the database. Read more
sourcefn view<V>(&self) -> View<'_, Self, V> where
V: SerializedView,
fn view<V>(&self) -> View<'_, Self, V> where
V: SerializedView,
Initializes View
for schema::View
V
.
sourcefn query_with_collection_docs<'life0, 'async_trait, V>(
&'life0 self,
key: Option<QueryKey<<V as View>::Key>>,
order: Sort,
limit: Option<usize>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<MappedDocuments<CollectionDocument<<V as View>::Collection>, V>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
V: SerializedView + 'async_trait,
Self: 'async_trait,
<V as View>::Collection: SerializedCollection,
<<V as View>::Collection as SerializedCollection>::Contents: Debug,
fn query_with_collection_docs<'life0, 'async_trait, V>(
&'life0 self,
key: Option<QueryKey<<V as View>::Key>>,
order: Sort,
limit: Option<usize>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<MappedDocuments<CollectionDocument<<V as View>::Collection>, V>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
V: SerializedView + 'async_trait,
Self: 'async_trait,
<V as View>::Collection: SerializedCollection,
<<V as View>::Collection as SerializedCollection>::Contents: Debug,
sourceimpl<B> Deref for ServerDatabase<B> where
B: Backend,
impl<B> Deref for ServerDatabase<B> where
B: Backend,
sourceimpl<B> KeyValue for ServerDatabase<B> where
B: Backend,
impl<B> KeyValue for ServerDatabase<B> where
B: Backend,
Pass-through implementation
sourcefn execute_key_operation<'life0, 'async_trait>(
&'life0 self,
op: KeyOperation
) -> Pin<Box<dyn Future<Output = Result<Output, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
fn execute_key_operation<'life0, 'async_trait>(
&'life0 self,
op: KeyOperation
) -> Pin<Box<dyn Future<Output = Result<Output, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
Executes a single KeyOperation
.
sourcefn set_key<S, V>(&'a self, key: S, value: &'a V) -> Builder<'a, Self, V>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
where
S: Into<String>,
V: Serialize + Send + Sync,
fn set_key<S, V>(&'a self, key: S, value: &'a V) -> Builder<'a, Self, V>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
where
S: Into<String>,
V: Serialize + Send + Sync,
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
Sets key
to value
. This function returns a builder that is also a
Future. Awaiting the builder will execute Command::Set
with the options
given. Read more
sourcefn set_binary_key<S>(&'a self, key: S, bytes: &'a [u8]) -> Builder<'a, Self, ()>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
where
S: Into<String>,
fn set_binary_key<S>(&'a self, key: S, bytes: &'a [u8]) -> Builder<'a, Self, ()>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
where
S: Into<String>,
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
Sets key
to bytes
. This function returns a builder that is also
a Future. Awaiting the builder will execute Command::Set
with
the options given. Read more
sourcefn set_numeric_key<S, V>(&self, key: S, value: V) -> Builder<'_, Self, ()>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
where
S: Into<String>,
V: Into<Numeric>,
fn set_numeric_key<S, V>(&self, key: S, value: V) -> Builder<'_, Self, ()>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
where
S: Into<String>,
V: Into<Numeric>,
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
Sets key
to value
. This stores the value as a Numeric
,
enabling atomic math operations to be performed on this key. This
function returns a builder that is also a Future. Awaiting the
builder will execute Command::Set
with the options given. Read more
sourcefn increment_key_by<S, V>(&self, key: S, value: V) -> Builder<'_, Self, V>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: TryFrom<Numeric, Error = IncompatibleTypeError>, type Output = Result<V, Error>;
where
S: Into<String> + Send + Sync,
V: Into<Numeric> + TryFrom<Numeric, Error = IncompatibleTypeError> + Send + Sync,
fn increment_key_by<S, V>(&self, key: S, value: V) -> Builder<'_, Self, V>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: TryFrom<Numeric, Error = IncompatibleTypeError>, type Output = Result<V, Error>;
where
S: Into<String> + Send + Sync,
V: Into<Numeric> + TryFrom<Numeric, Error = IncompatibleTypeError> + Send + Sync,
K: KeyValue,
V: TryFrom<Numeric, Error = IncompatibleTypeError>, type Output = Result<V, Error>;
Increments key
by value
. The value stored must be a Numeric
,
otherwise an error will be returned. The result of the increment
will be the value
’s type. For example, if the stored value is
currently a u64
, but value
is a f64
, the current value will be
converted to an f64
, and the stored value will be an f64
. Read more
sourcefn decrement_key_by<S, V>(&self, key: S, value: V) -> Builder<'_, Self, V>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: TryFrom<Numeric, Error = IncompatibleTypeError>, type Output = Result<V, Error>;
where
S: Into<String> + Send + Sync,
V: Into<Numeric> + TryFrom<Numeric, Error = IncompatibleTypeError> + Send + Sync,
fn decrement_key_by<S, V>(&self, key: S, value: V) -> Builder<'_, Self, V>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: TryFrom<Numeric, Error = IncompatibleTypeError>, type Output = Result<V, Error>;
where
S: Into<String> + Send + Sync,
V: Into<Numeric> + TryFrom<Numeric, Error = IncompatibleTypeError> + Send + Sync,
K: KeyValue,
V: TryFrom<Numeric, Error = IncompatibleTypeError>, type Output = Result<V, Error>;
Decrements key
by value
. The value stored must be a Numeric
,
otherwise an error will be returned. The result of the decrement
will be the value
’s type. For example, if the stored value is
currently a u64
, but value
is a f64
, the current value will be
converted to an f64
, and the stored value will be an f64
. Read more
sourcefn get_key<S>(&self, key: S) -> Builder<'_, Self>ⓘNotable traits for Builder<'a, K>impl<'a, K> Future for Builder<'a, K> where
K: KeyValue, type Output = Result<Option<Value>, Error>;
where
S: Into<String>,
fn get_key<S>(&self, key: S) -> Builder<'_, Self>ⓘNotable traits for Builder<'a, K>impl<'a, K> Future for Builder<'a, K> where
K: KeyValue, type Output = Result<Option<Value>, Error>;
where
S: Into<String>,
K: KeyValue, type Output = Result<Option<Value>, Error>;
Gets the value stored at key
. This function returns a builder that is also a
Future. Awaiting the builder will execute Command::Get
with the options
given. Read more
sourcefn delete_key<'life0, 'async_trait, S>(
&'life0 self,
key: S
) -> Pin<Box<dyn Future<Output = Result<KeyStatus, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
S: Into<String> + Send + 'async_trait,
Self: 'async_trait,
fn delete_key<'life0, 'async_trait, S>(
&'life0 self,
key: S
) -> Pin<Box<dyn Future<Output = Result<KeyStatus, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
S: Into<String> + Send + 'async_trait,
Self: 'async_trait,
Deletes the value stored at key
.
sourcefn key_namespace(&self) -> Option<&str>
fn key_namespace(&self) -> Option<&str>
The current namespace.
sourcefn with_key_namespace(&self, namespace: &str) -> Namespaced<'_, Self>
fn with_key_namespace(&self, namespace: &str) -> Namespaced<'_, Self>
Access this Key-Value store within a namespace. When using the returned
Namespaced
instance, all keys specified will be separated into their
own storage designated by namespace
. Read more
sourceimpl<B> PubSub for ServerDatabase<B> where
B: Backend,
impl<B> PubSub for ServerDatabase<B> where
B: Backend,
Uses CustomServer
’s PubSub
relay.
type Subscriber = ServerSubscriber<B>
type Subscriber = ServerSubscriber<B>
The Subscriber type for this PubSub
connection.
sourcefn create_subscriber<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<<ServerDatabase<B> as PubSub>::Subscriber, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
fn create_subscriber<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<<ServerDatabase<B> as PubSub>::Subscriber, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
ServerDatabase<B>: 'async_trait,
Create a new Subscriber
for this relay.
sourcefn publish<'life0, 'life1, 'async_trait, S, P>(
&'life0 self,
topic: S,
payload: &'life1 P
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
S: Into<String> + Send + 'async_trait,
P: Serialize + Sync + 'async_trait,
ServerDatabase<B>: 'async_trait,
fn publish<'life0, 'life1, 'async_trait, S, P>(
&'life0 self,
topic: S,
payload: &'life1 P
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
S: Into<String> + Send + 'async_trait,
P: Serialize + Sync + 'async_trait,
ServerDatabase<B>: 'async_trait,
Publishes a payload
to all subscribers of topic
.
sourcefn publish_to_all<'life0, 'life1, 'async_trait, P>(
&'life0 self,
topics: Vec<String, Global>,
payload: &'life1 P
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
P: Serialize + Sync + 'async_trait,
ServerDatabase<B>: 'async_trait,
fn publish_to_all<'life0, 'life1, 'async_trait, P>(
&'life0 self,
topics: Vec<String, Global>,
payload: &'life1 P
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
P: Serialize + Sync + 'async_trait,
ServerDatabase<B>: 'async_trait,
Publishes a payload
to all subscribers of all topics
.
Auto Trait Implementations
impl<B = NoBackend> !RefUnwindSafe for ServerDatabase<B>
impl<B> Send for ServerDatabase<B>
impl<B> Sync for ServerDatabase<B>
impl<B> Unpin for ServerDatabase<B>
impl<B = NoBackend> !UnwindSafe for ServerDatabase<B>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more