0.2.10 • Published 8 years ago

rados v0.2.10

Weekly downloads
49
License
-
Repository
github
Last release
8 years ago

node-rados

Ceph rados client for node

Installation

From npm:

sudo apt-get install librados-dev
npm install rados

From source:

sudo apt-get install nodejs node-gyp librados-dev
git clone https://github.com/ksperis/node-rados
cd node-rados
npm install nan
node-gyp rebuild

Usage

Load module :

var rados = require('./build/Release/rados');
// or, if installed whith npm in node_modules
var rados = require('rados');

Connect to cluster :

cluster = new rados.Rados(cluster, user, conffile)	// return Rados object
cluster.connect()									// on err, return err code
cluster.shutdown()									// on err, return err code

cluster.get_fsid()									// return String (null on error)
cluster.create_pool(pool_name, [auid], [crush_rule])// on err, return err code
cluster.delete_pool(pool_name)						// on err, return err code
cluster.pool_list()									// return Array (null on error)

Create / Delete Ioctx :

ioctx = new rados.Ioctx(cluster, poolname)			// on error, throw error
ioctx.destroy()
ioctx.pool_set_auid(auid)							// on error, return error
ioctx.pool_get_auid(auid)							// on error, return auid (negative value on error)

Manage snapshots :

ioctx.snap_create(snapname)							// on err, return err code
ioctx.snap_remove(snapname)							// on err, return err code
ioctx.snap_rollback(oid, snapname)					// on err, return err code

Sync Buffered functions :

ioctx.read(oid, [size], [offset])					// return Buffer (null on error)
ioctx.write(oid, buffer, [size], [offset])			// on err, return err code
ioctx.write_full(oid, buffer, [size])				// on err, return err code
ioctx.clone_range(dst, dst_off, src, src_off, size)	// on err, return err code
ioctx.append(oid, buffer, [size])					// on err, return err code
ioctx.trunc(oid, size)								// on err, return err code
ioctx.remove(oid)									// on err, return err code
ioctx.stat(oid)										// return Object with attr psize, pmtime

AIO functions :

ioctx.aio_read(oid, [size], [offset], function (err, data) {})
ioctx.aio_write(oid, buffer, [size], [offset], function (err) {})
ioctx.aio_append(oid, buffer, [size], function (err) {})
ioctx.aio_write_full(oid, buffer, [size], function (err) {})
ioctx.aio_flush()
ioctx.aio_flush_async(function (err) {})

Manage Attr :

ioctx.getxattr(oid, attr, [size])					// return String (null on error)
ioctx.setxattr(oid, attr, value, [size])			// on err, return err code
ioctx.rmxattr(oid, attr)							// on err, return err code
ioctx.getxattrs(oid)								// return object with attributes (null on error)
0.2.10

8 years ago

0.2.9

9 years ago

0.2.8

9 years ago

0.2.7

9 years ago

0.2.6

9 years ago

0.2.5

9 years ago

0.2.4

9 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago