nodejs thrift implementation
Switch branches/tags
Nothing to show
Pull request Compare This branch is 58 commits behind wadey:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
lib
LICENSE
README.md
package.json

README.md

node-thrift

Thrift protocol implementation for nodejs. As of version 0.0.1, the basic protocol has been implemented. The next step is to create a Thrift code generator that will generate the .js files from a Thrift specification.

An example of one of the Cassandra methods is included in the examples/ folder. This example was first generated by the upstream Thrift JavaScript generator, and then modified to accept a callback and work properly in a fully async environment. There is a good chance that the API will be volatile and change until a Thrift generator is completed.

NOTE: you must the the framed thrift transport, TFramedTransport in most implementations, on the server side. Using a popular example, this is enabled by default in Cassandra 0.7 (but configuration must be changed in Cassandra 0.6.x and earlier).

Usage:

Here is a Cassandra example:

var thrift = require('thrift'),
    Cassandra = require('./examples/Cassandra')
    cassandra_types = require('./examples/cassandra_types');

var conn = new thrift.Connection(Cassandra.Client, "localhost", 9160);
conn.open(function(client) {
  client.get_slice("Keyspace", "key", new ColumnParent({column_family: "ExampleCF", super_column: null}), new SlicePredicate({slice_range: new SliceRange({start: '', end: ''})}), ConsistencyLevel.ONE, function(err, data) {
    if (err) {
      // handle err
    } else {
      // data == [ColumnOrSuperColumn, ...]
    }
    conn.end();
  });
});