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
220
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
14k
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
レガシーな Android アプリのリアーキテクチャ戦略
oidy
1
170
開発効率向上のためのリファクタリングの一歩目の選択肢 ~コード分割~ / JJUG CCC 2024 Fall
ryounasso
0
370
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
920
PLoP 2024: The evolution of the microservice architecture pattern language
cer
PRO
0
1.7k
プロジェクト新規参入者のリードタイム短縮の観点から見る、品質の高いコードとアーキテクチャを保つメリット
d_endo
1
1k
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
440
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
1
290
破壊せよ!データ破壊駆動で考えるドメインモデリング / data-destroy-driven
minodriven
16
4.1k
Vue3の一歩踏み込んだパフォーマンスチューニング2024
hal_spidernight
3
3.1k
推し活としてのrails new/oshikatsu_ha_iizo
sakahukamaki
3
1.7k
CPython 인터프리터 구조 파헤치기 - PyCon Korea 24
kennethanceyer
0
250
デプロイを任されたので、教わった通りにデプロイしたら障害になった件 ~俺のやらかしを越えてゆけ~
techouse
52
32k
Featured
See All Featured
A designer walks into a library…
pauljervisheath
202
24k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Optimizing for Happiness
mojombo
376
69k
Designing for humans not robots
tammielis
249
25k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
9
680
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
92
16k
4 Signs Your Business is Dying
shpigford
180
21k
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
Ruby is Unlike a Banana
tanoku
96
11k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
167
49k
RailsConf 2023
tenderlove
29
880
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
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