Module lua-rados

Functions

version () Get the version of librados.
create (id) Create handle for communicating with RADOS cluster.

Class Cluster

Cluster:conf_read_file (file) Configure the cluster handle using a Ceph config file.
Cluster:connect () Connect to the cluster.
Cluster:shutdown () Disconnect from the cluster.
Cluster:open_ioctx (name) Create an I/O context.

Class Ioctx

Ioctx:close () Close the I/O context.
Ioctx:stat (oid) Get object stat info (size/mtime)
Ioctx:write (oid, buf, length, offset) Write data to an object.
Ioctx:read (oid, length, offset) Read data from an object.
Ioctx:setxattr (oid, name, buf, size) Set xattr name on object
Ioctx:getxattr (oid, name) Get xattr name from object.
Ioctx:exec (oid, class, method, buf, length) Execute an OSD class method on an object.


Functions

version ()
Get the version of librados.

Usage:

    major, minor, extra = rados.version()

Returns:

  1. major version
  2. minor version
  3. extra version
create (id)
Create handle for communicating with RADOS cluster.

Parameters:

  • id: string the user to connect as (optional, or nil)

Usage:

  • cluster = rados.create()
  • cluster = rados.create('admin')

Returns:

  1. cluster handle object on success, nil otherwise
  2. error message and retval if failed

Class Cluster

Cluster:conf_read_file (file)
Configure the cluster handle using a Ceph config file.

Parameters:

  • file: string path to configuration file (optional, or nil)

Usage:

  • cluster:conf_read_file()
  • cluster:conf_read_file('/path/to/ceph.conf')

Returns:

  1. 0 on success, nil otherwise
  2. error message and retval if failed
Cluster:connect ()
Connect to the cluster.

Usage:

  • cluster:connect()
  • status, errstr, ret = cluster:connect()

Returns:

  1. 0 on success, nil otherwise
  2. error message and retval if failed
Cluster:shutdown ()
Disconnect from the cluster.

Usage:

    cluster:shutdown()
Cluster:open_ioctx (name)
Create an I/O context.

Parameters:

Usage:

    ioctx = cluster:open_ioctx('my_pool')

Returns:

  1. I/O context object or nil on failure
  2. errstr, ret if failed

Class Ioctx

Ioctx:close ()
Close the I/O context.

Usage:

    ioctx:close()
Ioctx:stat (oid)
Get object stat info (size/mtime)

Parameters:

Usage:

    size, mtime = ioctx:stat('obj3')

Returns:

  1. len, mtime, or nil on failure
  2. errstr and retval if failed
Ioctx:write (oid, buf, length, offset)
Write data to an object.

Parameters:

  • oid: string object name
  • buf: string buffer containing bytes
  • length: int number of bytes to write
  • offset: int offset in object from which to write

Usage:

    ioctx:write('obj3', 'data', #'data', 0)

Returns:

  1. number of bytes written, or nil on error
  2. errstr and retval if failed
Ioctx:read (oid, length, offset)
Read data from an object.

Parameters:

  • oid: string object name
  • length: int number of bytes read
  • offset: int offset in object from which to read

Usage:

    data = ioctx:read('obj3', 1000, 0)

Returns:

  1. string with at most length bytes, or nil on error
  2. errstr and retval if failed
Ioctx:setxattr (oid, name, buf, size)
Set xattr name on object

Parameters:

  • oid: string object name
  • name: string xattr name
  • buf: string value to set xattr name to
  • size: int of buf

Usage:

    ioctx:setxattr('obj3', 'name', 'data', #'data')

Returns:

  1. 0 on success, or nil on error
  2. errstr and retval if failed
Ioctx:getxattr (oid, name)
Get xattr name from object.

Parameters:

Usage:

    data = ioctx:getxattr('obj3', 'name')

Returns:

  1. string containing xattr name
  2. errstr and retval if failed
Ioctx:exec (oid, class, method, buf, length)
Execute an OSD class method on an object.

Parameters:

  • oid: string the name of the object
  • class: string the name of the class
  • method: string the name of the method
  • buf: string buffer containing method input
  • length: int length of input buffer

Usage:

    ret, reply = ioctx:exec('oid', 'cls', 'func', input, #input)

Returns:

  1. retval, output on success, else nil
  2. strerr, errval on failure
generated by LDoc 1.2