Struct pliantdb_local::Database [−][src]
pub struct Database<DB> { /* fields omitted */ }
Expand description
A local, file-based database.
Implementations
pub async fn open_local<P: AsRef<Path> + Send>(
path: P,
configuration: &Configuration
) -> Result<Self, Error>
pub async fn open_local<P: AsRef<Path> + Send>(
path: P,
configuration: &Configuration
) -> Result<Self, Error>
Creates a Storage
with a single-database named “default” with its data stored at path
.
Trait Implementations
fn apply_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction<'static>
) -> Pin<Box<dyn Future<Output = Result<Vec<OperationResult>, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn apply_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction<'static>
) -> Pin<Box<dyn Future<Output = Result<Vec<OperationResult>, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: '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
Retrieves a stored document from Collection
C
identified by id
.
Retrieves all documents matching ids
. Documents that are not found
are not returned, but no error will be generated. Read more
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
Queries for view entries matching View
.
fn query_with_docs<'life0, 'async_trait, V: View>(
&'life0 self,
key: Option<QueryKey<V::Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedDocument<V::Key, V::Value>>, Error>> + Send + 'async_trait>> where
Self: Sized,
V: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn query_with_docs<'life0, 'async_trait, V: View>(
&'life0 self,
key: Option<QueryKey<V::Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedDocument<V::Key, V::Value>>, Error>> + Send + 'async_trait>> where
Self: Sized,
V: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Queries for view entries matching View
.
Reduces the view entries matching View
.
fn reduce_grouped<'life0, 'async_trait, V: View>(
&'life0 self,
key: Option<QueryKey<V::Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedValue<V::Key, V::Value>>, Error>> + Send + 'async_trait>> where
Self: Sized,
V: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn reduce_grouped<'life0, 'async_trait, V: View>(
&'life0 self,
key: Option<QueryKey<V::Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedValue<V::Key, V::Value>>, Error>> + Send + 'async_trait>> where
Self: Sized,
V: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Fetches the last transaction id that has been committed, if any.
Accesses a collection for the connected schema::Schema
.
Inserts a newly created document into the connected schema::Schema
for the Collection
C
.
fn update<'life0, 'life1, 'life2, 'async_trait, C>(
&'life0 self,
doc: &'life1 mut Document<'life2>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
C: Collection + 'async_trait,
fn update<'life0, 'life1, 'life2, 'async_trait, C>(
&'life0 self,
doc: &'life1 mut Document<'life2>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
C: Collection + '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
fn delete<'life0, 'life1, 'life2, 'async_trait, C>(
&'life0 self,
doc: &'life1 Document<'life2>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
C: Collection + 'async_trait,
fn delete<'life0, 'life1, 'life2, 'async_trait, C>(
&'life0 self,
doc: &'life1 Document<'life2>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
C: Collection + 'async_trait,
Removes a Document
from the database.
fn execute_key_operation<'life0, 'async_trait>(
&'life0 self,
op: KeyOperation
) -> Pin<Box<dyn Future<Output = Result<Output, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn execute_key_operation<'life0, 'async_trait>(
&'life0 self,
op: KeyOperation
) -> Pin<Box<dyn Future<Output = Result<Output, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Executes a single KeyOperation
.
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
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
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
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
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
Deletes the value stored at key
.
The current namespace.
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
type Subscriber = Subscriber
type Subscriber = Subscriber
The Subscriber type for this PubSub
connection.
fn create_subscriber<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Subscriber, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn create_subscriber<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Subscriber, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Create a new Subscriber
for this relay.
fn publish<'life0, 'life1, 'async_trait, S: Into<String> + Send, P: Serialize + Sync>(
&'life0 self,
topic: S,
payload: &'life1 P
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
S: 'async_trait,
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn publish<'life0, 'life1, 'async_trait, S: Into<String> + Send, P: Serialize + Sync>(
&'life0 self,
topic: S,
payload: &'life1 P
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
S: 'async_trait,
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Publishes a payload
to all subscribers of topic
.
Publishes a payload
to all subscribers of all topics
.
Auto Trait Implementations
impl<DB> !RefUnwindSafe for Database<DB>
impl<DB> !UnwindSafe for Database<DB>
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self