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
Mathias Meyer
January 17, 2013
Programming
1
270
riak-js
History and tour of riak-js, the Node.js client for Riak.
Mathias Meyer
January 17, 2013
Tweet
Share
More Decks by Mathias Meyer
See All by Mathias Meyer
Building and Scaling an Distributed and Inclusive Team
roidrage
0
1.2k
cooking infrastructure with chef
roidrage
4
230
The Message Queue is Dead, Long Live the Message Queue
roidrage
4
680
designing for concurrency with riak
roidrage
11
1.8k
metrics, monitoring, logging
roidrage
82
15k
design for cloud - jax 2012
roidrage
2
290
A Riak Query Tale
roidrage
5
1k
Don't Use NoSQL
roidrage
10
1k
Designing Applications for Amazon Web Services (GOTO Aarhus)
roidrage
6
350
Other Decks in Programming
See All in Programming
歴史と現在から考えるスケーラブルなソフトウェア開発のプラクティス
i10416
0
300
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
430
선언형 UI에서의 상태관리
l2hyunwoo
0
270
混沌とした例外処理とエラー監視に秩序をもたらす
morihirok
13
2.2k
php-conference-japan-2024
tasuku43
0
430
ESLintプラグインを使用してCDKのセオリーを適用する
yamanashi_ren01
2
240
知られざるDMMデータエンジニアの生態 〜かつてツチノコと呼ばれし者〜
takaha4k
1
420
Beyond ORM
77web
11
1.6k
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
1.3k
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
170
AHC041解説
terryu16
0
380
ドメインイベント増えすぎ問題
h0r15h0
2
560
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
Into the Great Unknown - MozCon
thekraken
34
1.6k
Documentation Writing (for coders)
carmenintech
67
4.5k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
3
180
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Optimising Largest Contentful Paint
csswizardry
33
3k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Scaling GitHub
holman
459
140k
BBQ
matthewcrist
85
9.4k
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