Struct cocaine::service::storage::Storage
[−]
[src]
pub struct Storage { /* fields omitted */ }
Storage service wrapper.
Methods
impl Storage
[src]
fn new(service: Service) -> Self
[src]
Constructs a new storage service wrapper using the specified service.
fn into_inner(self) -> Service
[src]
Consumes this wrapper, yielding an underlying service.
fn read(
&self,
collection: &str,
key: &str
) -> impl Future<Item = Vec<u8>, Error = Error>
[src]
&self,
collection: &str,
key: &str
) -> impl Future<Item = Vec<u8>, Error = Error>
Reads the data that is kept at the specified collection and key.
Examples
use cocaine::{Core, Service}; use cocaine::service::Storage; let mut core = Core::new().unwrap(); let storage = Storage::new(Service::new("storage", &core.handle())); let future = storage.read("collection", "key"); let data = core.run(future).unwrap();
fn write(
&self,
collection: &str,
key: &str,
data: &[u8],
indexes: &[&str]
) -> impl Future<Item = (), Error = Error>
[src]
&self,
collection: &str,
key: &str,
data: &[u8],
indexes: &[&str]
) -> impl Future<Item = (), Error = Error>
Writes the specified data into the storage.
Optional indexes can also be associated with the data written.
Returns a future, which will be resolved either when the data is successfully written into the storage or some error occurred.
Examples
use cocaine::{Core, Service}; use cocaine::service::Storage; let mut core = Core::new().unwrap(); let storage = Storage::new(Service::new("storage", &core.handle())); let future = storage.write("collection", "key", "le message".as_bytes(), &[]); core.run(future).unwrap();
Trait Implementations
impl Clone for Storage
[src]
fn clone(&self) -> Storage
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more