Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
riak-js
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Mathias Meyer
January 17, 2013
Programming
320
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
riak-js
History and tour of riak-js, the Node.js client for Riak.
Mathias Meyer
January 17, 2013
More Decks by Mathias Meyer
See All by Mathias Meyer
Building and Scaling an Distributed and Inclusive Team
roidrage
0
1.4k
cooking infrastructure with chef
roidrage
4
250
The Message Queue is Dead, Long Live the Message Queue
roidrage
4
730
designing for concurrency with riak
roidrage
11
1.9k
metrics, monitoring, logging
roidrage
82
15k
design for cloud - jax 2012
roidrage
2
340
A Riak Query Tale
roidrage
5
1k
Don't Use NoSQL
roidrage
10
1.1k
Designing Applications for Amazon Web Services (GOTO Aarhus)
roidrage
6
380
Other Decks in Programming
See All in Programming
初めてのKubernetes 本番運用でハマった話
oku053
0
130
えっ!!コードを読まずに開発を!?
hananouchi
0
210
どこまでゆるくて許されるのか
tk3fftk
0
490
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
170
1B+ /day規模のログを管理する技術
broadleaf
0
140
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
2
1.5k
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
220
act2-costs.pdf
sumedhbala
0
110
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
110
JAWS-UG横浜 #102 AWSサ終供養LT会 成仏できない AWS サービスたち 〜本日、三体供養します〜
maroon1st
0
210
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
ITヒヤリハットを整理してみた ~ライフサイクルと原因から考える再発防止策~
koukimiura
1
110
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
1
430
How to Ace a Technical Interview
jacobian
281
24k
4 Signs Your Business is Dying
shpigford
187
22k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
Everyday Curiosity
cassininazir
0
260
So, you think you're a good person
axbom
PRO
2
2.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
Color Theory Basics | Prateek | Gurzu
gurzu
0
390
Become a Pro
speakerdeck
PRO
31
6k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.8k
Transcript
riak-js Mathias Meyer, @roidrage, Riak Meetup NYC
travis-ci.org
riakhandbook.com
riak-js
simple node.js library for riak
simple node.js library for riak
heavily used in riak handbook
ancient history
first commit
2 march 2010
frank06/riak-js
javascript
port to coffeescript
rewritten in javascript
mostlyserious/riak-js
senchalabs/riak-js
mostlyserious/riak-js
apply(roidrage)
october 2011
v0.4.1
api changes
november 2012
v0.9.0
simple interface
riak = require('riak-js').getClient()
riak.get('users', 'roidrage')
user = {name: 'Mathias Meyer'} riak.save('users', 'roidrage', user)
riak.get('users', 'roidrage', function(error, data) { console.log(data); } )
riak.get('users', 'roidrage', function(error, data) { if (error.notFound) { console.log('User doesn't
exist!'); } } )
meta
riak.get('users', 'roidrage', {r: 1});
riak.get('users', 'roidrage', function(error, data, meta) { console.log(meta.vclock); } )
reusable
riak.get('users', 'roidrage', function(error, user, meta) { user.city = 'Berlin'; riak.save('users',
'roidrage', user, meta); } )
links
riak.save('users', 'roidrage', user, {links: [{bucket: 'users', key: 'tsantero', tag: 'bromance'}]
});
riak.walk('users', 'roidrage', [['users', '_', 'bromance']])
map reduce
riak.mapreduce.add('users'). map('Riak.mapValuesJson'). run()
riak.mapreduce.add('users'). map(function(obj) { return [obj.values[0]]; }). run()
javascript!
riak.mapreduce.add('users'). map(function(v) { return [v.values[0].name]; }). reduce('Riak.reduceSort'). run()
search
riak.saveBucket('users', {search: true})
riak.save('users', 'roidrage', {name: 'Mathias Meyer'});
riak.search.find('users', 'name:Mathias*')
search — map reduce
riak.mapreduce.search('users', 'name:Mathias*'). map('Riak.mapValuesJson'). run()
secondary indexes
riak.save('users', 'roidrage', {name: 'Mathias Meyer'}, {index: {name: 'Mathias Meyer', born:
1977}});
riak.query('users', {born: 1977})
riak.query('users', {born: [1977, 1980]})
instrumentation
riak.registerListener({ 'riak.request.end': function(event) {}, 'riak.request.start': function(event) {} });
metrics
riak.registerListener({ 'riak.request.end': function(event) { var duration = event.finished_at - event.started_at,
name = 'riak.request.' + event.method.toLowerCase(); metrics.timing(name, runtime); } });
related: http://www.paperplanes.de/2012/12/27/a-plea-for-client-library-instrumentation.html
the future
protocol buffers
custom agents
reconciling conflicts
riak.get('users', 'roidrage', function(error, data, meta) { if (meta.status == 300)
{ // merge siblings } } )
riak.onConflict(function(siblings) { return siblings.reduce(...); })
riak cs
yokozuna