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 to LIBRADOS_ALL_NSPACES before rados_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]

[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.

[src]

Access the raw rados_ioctx_t.

[src]

[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.

[src]

[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.

[src]

Asynchronously get object stats (size/mtime).

  • oid - The name of the object to check.

[src]

Get object stats (size/mtime).

[src]

Asychronously remove an object.

[src]

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]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Send for RadosCtx
[src]

impl Sync for RadosCtx
[src]