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
280
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.3k
cooking infrastructure with chef
roidrage
4
230
The Message Queue is Dead, Long Live the Message Queue
roidrage
4
700
designing for concurrency with riak
roidrage
11
1.8k
metrics, monitoring, logging
roidrage
82
15k
design for cloud - jax 2012
roidrage
2
300
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
360
Other Decks in Programming
See All in Programming
設計やレビューに悩んでいるPHPerに贈る、クリーンなオブジェクト設計の指針たち
panda_program
3
350
ReadMoreTextView
fornewid
1
450
イベントストーミングから始めるドメイン駆動設計
jgeem
4
870
Team topologies and the microservice architecture: a synergistic relationship
cer
PRO
0
940
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
1
190
Using AI Tools Around Software Development
inouehi
0
1.2k
AIネイティブなプロダクトをGolangで挑む取り組み
nmatsumoto4
0
120
Railsアプリケーションと パフォーマンスチューニング ー 秒間5万リクエストの モバイルオーダーシステムを支える事例 ー Rubyセミナー 大阪
falcon8823
3
780
Java on Azure で LangGraph!
kohei3110
0
160
Enterprise Web App. Development (2): Version Control Tool Training Ver. 5.1
knakagawa
1
120
無関心の谷
kanayannet
0
180
PostgreSQLのRow Level SecurityをPHPのORMで扱う Eloquent vs Doctrine #phpcon #track2
77web
1
100
Featured
See All Featured
Become a Pro
speakerdeck
PRO
28
5.4k
Building Applications with DynamoDB
mza
95
6.5k
Statistics for Hackers
jakevdp
799
220k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
We Have a Design System, Now What?
morganepeng
52
7.6k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
920
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.9k
4 Signs Your Business is Dying
shpigford
184
22k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Mobile First: as difficult as doing things right
swwweet
223
9.7k
Building an army of robots
kneath
306
45k
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