[−][src]Trait agilulf::AsyncDatabase
Abstraction layer for a AsyncDatabase. Every method return a Future.
The return type of these function are fixed as Pin<Box<dyn Future<Output = Result<_>> + Send + '_>>
rather than a generic type for convenience.
Required methods
fn get(&self, key: Slice) -> Pin<Box<dyn Future<Output = Result<Slice>> + Send>>
fn put(
&self,
key: Slice,
value: Slice
) -> Pin<Box<dyn Future<Output = Result<()>> + Send>>
&self,
key: Slice,
value: Slice
) -> Pin<Box<dyn Future<Output = Result<()>> + Send>>
fn scan(
&self,
start: Slice,
end: Slice
) -> Pin<Box<dyn Future<Output = Vec<(Slice, Slice)>> + Send>>
&self,
start: Slice,
end: Slice
) -> Pin<Box<dyn Future<Output = Vec<(Slice, Slice)>> + Send>>
SCAN don't return a Result
because if nothing is found, an empty vector will be returned.
fn delete(&self, key: Slice) -> Pin<Box<dyn Future<Output = Result<()>> + Send>>
Implementors
impl AsyncDatabase for Database
[src]
fn get(
&self,
key: Slice
) -> Pin<Box<dyn Future<Output = DatabaseResult<Slice>> + Send>>
[src]
&self,
key: Slice
) -> Pin<Box<dyn Future<Output = DatabaseResult<Slice>> + Send>>
GET request for the database will firstly read from MemDatabase. And then read from frozen database . Then will find in SSTable. If they are all not found, error will be returned.
fn put(
&self,
key: Slice,
value: Slice
) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send>>
[src]
&self,
key: Slice,
value: Slice
) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send>>
PUT request to this database will simply run PUT command on MemDatabase and check whether MemDatabase is so big that needs to freeze.
fn scan(
&self,
start: Slice,
end: Slice
) -> Pin<Box<dyn Future<Output = Vec<(Slice, Slice)>> + Send>>
[src]
&self,
start: Slice,
end: Slice
) -> Pin<Box<dyn Future<Output = Vec<(Slice, Slice)>> + Send>>
SCAN operation will merge every iterator from MemDatabase and FrozenDatabase and SStable together and return.
fn delete(
&self,
key: Slice
) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send>>
[src]
&self,
key: Slice
) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send>>
impl<T: SyncDatabase> AsyncDatabase for T
[src]
Every sync database can be wrapped as an async database easily. With this wrapper, MemDatabase can be used directly on Server.
fn get(&self, key: Slice) -> Pin<Box<dyn Future<Output = Result<Slice>> + Send>>
[src]
fn put(
&self,
key: Slice,
value: Slice
) -> Pin<Box<dyn Future<Output = Result<()>> + Send>>
[src]
&self,
key: Slice,
value: Slice
) -> Pin<Box<dyn Future<Output = Result<()>> + Send>>
fn scan(
&self,
start: Slice,
end: Slice
) -> Pin<Box<dyn Future<Output = Vec<(Slice, Slice)>> + Send>>
[src]
&self,
start: Slice,
end: Slice
) -> Pin<Box<dyn Future<Output = Vec<(Slice, Slice)>> + Send>>