Struct rados_hi::RadosCtx
[−]
[src]
pub struct RadosCtx(_);
An IO context encapsulates a few settings for all I/O operations done on it.
pool
- set when the io context is created (see rados_ioctx_create()).- snapshot context for writes (see
rados_ioctx_selfmanaged_snap_set_write_ctx
()) - snapshot id to read from (see
rados_ioctx_snap_set_read()
) - object locator for all single-object operations (see
rados_ioctx_locator_set_key()
) - namespace for all single-object operations (see
rados_ioctx_set_namespace()
). Set toLIBRADOS_ALL_NSPACES
beforerados_nobjects_list_open()
will list all objects in all namespaces.
Changing any of these settings is not thread-safe - librados users must synchronize any of these changes on their own, or use separate io contexts for each thread.
Methods
impl RadosCtx
[src]
fn new(rad: &Arc<Rados>, pool_name: &str) -> Result<RadosCtx, String>
[src]
Create an IO context.
The IO context allows you to perform operations within a particular pool.
IO context creation isn't cheap, especially on a slow network.
We put it in an Arc
in order to encourage reuse.
fn raw(&self) -> rados_ioctx_t
[src]
Access the raw rados_ioctx_t
.
fn write_bl(&self, oid: &str, bytes: &[u8]) -> Result<(), String>
[src]
fn write_full(&self, oid: &str, bytes: &[u8]) -> RadosWriteCompletion
[src]
Asychronously write an entire object. The object is filled with the provided data. If the object exists, it is atomically truncated and then written. Queues the write_full and returns.
fn write_full_bl(&self, oid: &str, bytes: &[u8]) -> Result<(), String>
[src]
fn read(&self, oid: &str, len: usize, off: u64) -> RadosReadCompletion
[src]
Asychronously read data from an object.
The IO context determines the snapshot to read from, if any was set by rados_ioctx_snap_set_read().
oid
- The name of the object to read from.len
- The number of bytes to read.off
- The offset to start reading from in the object.
fn stat(&self, oid: &str) -> RadosStatCompletion
[src]
Asynchronously get object stats (size/mtime).
oid
- The name of the object to check.
fn stat_bl(&self, oid: &str) -> Result<Option<RadosStat>, RadosError>
[src]
Get object stats (size/mtime).
fn remove(&self, oid: &str) -> RadosRemoveCompletion
[src]
Asychronously remove an object.
fn lock_exclusive_bl(
&self,
oid: &str,
name: &str,
cookie: &str,
desc: &str,
dur_sec: u32,
flags: u8
) -> Result<RadosLock, Error>
[src]
&self,
oid: &str,
name: &str,
cookie: &str,
desc: &str,
dur_sec: u32,
flags: u8
) -> Result<RadosLock, Error>
Take an exclusive lock on an object.
oid
- The name of the object.name
- The name of the lock.cookie
- User-defined identifier for this instance of the lock.desc
- User-defined lock description.dur_sec
- The duration of the lock. Set to 0 for infinite duration.flags
- Lock flags.
Returns 0 on success, negative error code on failure:
-EBUSY
if the lock is already held by another (client, cookie) pair.
-EEXIST
if the lock is already held by the same (client, cookie) pair.
Trait Implementations
impl Clone for RadosCtx
[src]
fn clone(&self) -> RadosCtx
[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