0.2.0 • Published 10 years ago

riak2-protobuf v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

Riak Protocol Buffer Stream

Build Status

A Riak Protocol Buffer stream for Node.JS.

var RiakSocket = require('riak2-protobuf');
var socket = new RiakSocket();

socket.write('RpbGetServerInfoReq');

socket.once('data', function (data) {
  console.log(data);
  // { node: 'riak@127.0.0.1',
  //   server_version: '2.0.0beta1' }
});

Install

npm install riakjs2-protobuf

Writing to the socket

The socket accepts a data object and a message type:

// send ping request
socket.write('RpbPingReq');

// send get request
socket.write({
  bucket: 'mybucket',
  key: 'mykey'
}, 'RpbGetReq');

Reading from the socket

The socket emits response data:

// process response
socket.once('data', function (data) {
  console.log(data._code, data._type);
  console.log(data);
});

Implementation notes

These message types have not yet been tested and the socket will return data from Riak as-is:

27,RpbSearchQueryReq,riak_search
28,RpbSearchQueryResp,riak_search
29,RpbResetBucketReq,riak
30,RpbResetBucketResp,riak
31,RpbGetBucketTypeReq,riak
32,RpbSetBucketTypeReq,riak
40,RpbCSBucketReq,riak_kv
41,RpbCSBucketResp,riak_kv
54,RpbYokozunaIndexGetReq,riak_yokozuna
55,RpbYokozunaIndexGetResp,riak_yokozuna
56,RpbYokozunaIndexPutReq,riak_yokozuna
57,RpbYokozunaIndexDeleteReq,riak_yokozuna
58,RpbYokozunaSchemaGetReq,riak_yokozuna
59,RpbYokozunaSchemaGetResp,riak_yokozuna
60,RpbYokozunaSchemaPutReq,riak_yokozuna
253,RpbAuthReq,riak
254,RpbAuthResp,riak
255,RpbStartTls,riak

License

MIT