Trait skytable::actions::AsyncActions
source · [−]pub trait AsyncActions: AsyncSocket {
Show 19 methods
fn dbsize<'s>(&'s mut self) -> AsyncResult<'_, SkyResult<u64>> { ... }
fn del<'s>(
&'s mut self,
key: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<u64>> { ... }
fn exists<'s>(
&'s mut self,
key: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<u64>> { ... }
fn flushdb<'s>(&'s mut self) -> AsyncResult<'_, SkyResult<()>> { ... }
fn get<'s, T: FromSkyhashBytes>(
&'s mut self,
key: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<T>> { ... }
fn keylen<'s>(
&'s mut self,
key: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<u64>> { ... }
fn lskeys<'s, T: FromSkyhashBytes>(
&'s mut self,
count: u64
) -> AsyncResult<'_, SkyResult<T>> { ... }
fn mget<'s, T: FromSkyhashBytes>(
&'s mut self,
keys: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<T>> { ... }
fn mksnap<'s>(&'s mut self) -> AsyncResult<'_, SkyResult<SnapshotResult>> { ... }
fn mset<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<u64>> { ... }
fn mupdate<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<u64>> { ... }
fn pop<'s, T: FromSkyhashBytes>(
&'s mut self,
keys: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<T>> { ... }
fn mpop<'s, T: FromSkyhashBytes>(
&'s mut self,
keys: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<T>> { ... }
fn sdel<'s>(
&'s mut self,
keys: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<bool>> { ... }
fn set<'s>(
&'s mut self,
key: impl IntoSkyhashBytes + 's,
value: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<bool>> { ... }
fn sset<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<bool>> { ... }
fn supdate<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<bool>> { ... }
fn update<'s>(
&'s mut self,
key: impl IntoSkyhashBytes + 's,
value: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<()>> { ... }
fn uset<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<u64>> { ... }
}
aio
only.Expand description
Actions that can be run on an [AsyncSocket
] connection
Provided methods
fn dbsize<'s>(&'s mut self) -> AsyncResult<'_, SkyResult<u64>>
fn dbsize<'s>(&'s mut self) -> AsyncResult<'_, SkyResult<u64>>
Get the number of keys present in the database
fn del<'s>(
&'s mut self,
key: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<u64>>
fn del<'s>(
&'s mut self,
key: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<u64>>
Deletes a single or a number of keys
This is equivalent to:
DEL <k1> <k2> <k3> ...
This will return the number of keys that were deleted
fn exists<'s>(
&'s mut self,
key: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<u64>>
fn exists<'s>(
&'s mut self,
key: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<u64>>
Checks if a key (or keys) exist(s)
This is equivalent to:
EXISTS <k1> <k2> <k3> ...
This will return the number of keys that do exist
fn flushdb<'s>(&'s mut self) -> AsyncResult<'_, SkyResult<()>>
fn flushdb<'s>(&'s mut self) -> AsyncResult<'_, SkyResult<()>>
Removes all the keys present in the database
fn get<'s, T: FromSkyhashBytes>(
&'s mut self,
key: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<T>>
fn get<'s, T: FromSkyhashBytes>(
&'s mut self,
key: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<T>>
Get the value of a key
This is equivalent to:
GET <key>
fn keylen<'s>(
&'s mut self,
key: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<u64>>
fn keylen<'s>(
&'s mut self,
key: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<u64>>
Get the length of a key
This is equivalent to:
KEYLEN <key>
fn lskeys<'s, T: FromSkyhashBytes>(
&'s mut self,
count: u64
) -> AsyncResult<'_, SkyResult<T>>
fn lskeys<'s, T: FromSkyhashBytes>(
&'s mut self,
count: u64
) -> AsyncResult<'_, SkyResult<T>>
Returns a vector of keys
This is equivalent to:
LSKEYS <count>
Do note that the order might be completely meaningless
fn mget<'s, T: FromSkyhashBytes>(
&'s mut self,
keys: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<T>>
fn mget<'s, T: FromSkyhashBytes>(
&'s mut self,
keys: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<T>>
Get multiple keys
This is equivalent to:
MGET <k1> <k2> ...
This method expects either: [T; N]
, &[T; N]
or anything that derefs to &[T]
fn mksnap<'s>(&'s mut self) -> AsyncResult<'_, SkyResult<SnapshotResult>>
fn mksnap<'s>(&'s mut self) -> AsyncResult<'_, SkyResult<SnapshotResult>>
Creates a snapshot
This returns a SnapshotResult
containing the result. The reason SnapshotResult
is not
an error is because mksnap
might fail simply because an existing snapshot process was in progress
which is normal behavior and not an inherent error
fn mset<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<u64>>
fn mset<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<u64>>
Sets the value of multiple keys and values and returns the number of keys that were set
This is equivalent to:
MSET <k1> <v1> <k2> <v2> ...
with the only difference that you have to pass in the keys and values as separate objects
Panics
This method will panic if the number of keys and values are not equal
This method expects either: [T; N]
, &[T; N]
or anything that derefs to &[T]
fn mupdate<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<u64>>
fn mupdate<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<u64>>
Updates the value of multiple keys and values and returns the number of keys that were updated
This is equivalent to:
MUPDATE <k1> <v1> <k2> <v2> ...
with the only difference that you have to pass in the keys and values as separate objects
Panics
This method will panic if the number of keys and values are not equal
This method expects either: [T; N]
, &[T; N]
or anything that derefs to &[T]
fn pop<'s, T: FromSkyhashBytes>(
&'s mut self,
keys: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<T>>
fn pop<'s, T: FromSkyhashBytes>(
&'s mut self,
keys: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<T>>
Consumes a key if it exists
This will return the corresponding values of the provided key depending on the type for that table
This is equivalent to:
POP <key>
fn mpop<'s, T: FromSkyhashBytes>(
&'s mut self,
keys: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<T>>
fn mpop<'s, T: FromSkyhashBytes>(
&'s mut self,
keys: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<T>>
Consumes the provided keys if they exist
This is equivalent to:
MPOP <k1> <k2> <k3>
fn sdel<'s>(
&'s mut self,
keys: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<bool>>
fn sdel<'s>(
&'s mut self,
keys: impl IntoSkyhashAction + 's
) -> AsyncResult<'_, SkyResult<bool>>
Deletes all the provided keys if they exist or doesn’t do anything at all. This method will return true if all the provided keys were deleted, else it will return false
This is equivalent to:
SDEL <k1> <v1> <k2> <v2>
with the only difference that you have to pass in the keys and values as separate objects
fn set<'s>(
&'s mut self,
key: impl IntoSkyhashBytes + 's,
value: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<bool>>
fn set<'s>(
&'s mut self,
key: impl IntoSkyhashBytes + 's,
value: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<bool>>
Set the value of a key
This is equivalent to:
SET <k> <v>
fn sset<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<bool>>
fn sset<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<bool>>
Sets the value of all the provided keys or does nothing. This method will return true if all the keys were set or will return false if none were set
This is equivalent to:
SSET <k1> <v1> <k2> <v2> ...
with the only difference that you have to pass in the keys and values as separate objects
Panics
This method will panic if the number of keys and values are not equal
This method expects either: [T; N]
, &[T; N]
or anything that derefs to &[T]
fn supdate<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<bool>>
fn supdate<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<bool>>
Updates the value of all the provided keys or does nothing. This method will return true if all the keys were updated or will return false if none were updated.
This is equivalent to:
SUPDATE <key1> <value1> <key2> <value2> ...
with the only difference that you have to pass in the keys and values as separate objects
Panics
This method will panic if the number of keys and values are not equal
This method expects either: [T; N]
, &[T; N]
or anything that derefs to &[T]
fn update<'s>(
&'s mut self,
key: impl IntoSkyhashBytes + 's,
value: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<()>>
fn update<'s>(
&'s mut self,
key: impl IntoSkyhashBytes + 's,
value: impl IntoSkyhashBytes + 's
) -> AsyncResult<'_, SkyResult<()>>
Update the value of a key
This is equivalent to:
UPDATE <key> <value>
fn uset<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<u64>>
fn uset<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>(
&'s mut self,
keys: impl GetIterator<T> + 's,
values: impl GetIterator<U> + 's
) -> AsyncResult<'_, SkyResult<u64>>
Updates or sets all the provided keys and returns the number of keys that were set
This is equivalent to:
USET <key1> <value1> <key2> <value2> ...
with the only difference that you have to pass in the keys and values as separate objects
Panics
This method will panic if the number of keys is not equal to the number of values
This method expects either: [T; N]
, &[T; N]
or anything that derefs to &[T]