Hey folks, 

I've been putting some work in the riak-js client for Node.js recently, and as 
we're getting pretty close to doing a release, I wanted to keep you posted on 
changes and especially breaking changes. 

About a year ago, Francisco Treacy started rewriting the code (originally 
written in CoffeeScript) in pure JavaScript. First up, thanks for all the great 
work, Frank!

After he sought a new maintainer for the library earlier this year, the fine 
folks of mostlyserious.io took over maintainership [1], and I eventually hopped 
on board and started hacking on the new JavaScript implementation too, to 
finish off missing bits [2].

Along the way, the domain riakjs.org unfortunately expired, but the website 
found a new home at http://riakjs.com, thanks to Vincent Mac [3].

The good news is that things are looking pretty good, and pretty much ready to 
be shipped, pending some updates on documentation, which I'll get to this week. 
The slightly bad news (only slightly, really) is that there are breaking 
changes.

As the client hasn't officially reached v1.0 yet, I figured it's still a good 
opportunity to move things around, make things more explicit and cleaner.

The basic APIs, though, are still the same or at least very similar. The most 
important changes affect Riak Search and MapReduce.

Riak Search is now fully supported, which means documents (i.e. JavaScript 
objects) can be added and removed directly without the need to store them in 
Riak. The functionality is namespace in the client, e.g. to find documents, you 
can use the following snippet:

db.search.find("users", "email:me...@paperplanes.de")

Same for adding and removing documents:

db.search.add("users", {id: "mathias", email: "me...@paperplanes.de"}) or
db.search.add("users", [{id: "roidrage", email: "me...@paperplanes.de"}, {id: 
"mathias", email: "math...@travis-ci.org"}])

db.search.remove("users", [{id: "mathias"}, {query: 
'email:"me...@paperplanes.de"'}])

MapReduce was also moved to its own namespace, with the API being pretty much 
the same as in the CoffeeScript client:

db.mapreduce.add("users").map("Riak.mapValuesJson").run()

Moving these out into separate namespaces is mostly a matter of clarity and 
separating concerns, drawing some inspiration from other Riak clients.

There are other changes, e.g. regarding bucket properties (now db.getBucket() 
and db.saveBucket()), Luwak (getFile(), removeFile(), saveFile()), though Luwak 
would also be a candidate to be moved into a different namespace and having to 
be explicitly enabled because it's been deprecated and is not included in the 
standard distribution anymore.

So we're close to doing a release, but I just wanted to make sure information 
on what things might break is out before we do. If you rely strongly on 
existing APIs, make sure to pin your package.json to 0.4.1.

The next release might still be a bit rough around the edge, and it'll be 
missing support for Protocol Buffers, but one step at a time :)

Let me know if you have any suggestions or feedback!

Cheers, Mathias

[1] https://github.com/mostlyserious/riak-js
[2] https://github.com/basho-labs/riak-js
[3] https://github.com/vincentmac/riakjs.com
-- 
http://riakhandbook.com

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to