-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
46 lines (42 loc) · 915 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var level = require('level-test')()
, clusterGet = require('./cluster-get')
// server 1
, config1 = {
servers: [
'127.0.0.1:8001'
, '127.0.0.1:8002'
]
, port: 8000
}
, db1 = level('server1')
, get1 = clusterGet(db1, config1)
// server 2
, config2 = {
servers: [
'127.0.0.1:8000'
, '127.0.0.1:8002'
]
, port: 8001
}
, db2 = level('server2')
, get2 = clusterGet(db2, config2)
// server 3
, config3 = {
servers: [
'127.0.0.1:8000'
, '127.0.0.1:8001'
]
, port: 8002
}
, db3 = level('server3')
, get3 = clusterGet(db3, config3)
db1.put('foo', 'bar', function () {
db2.put('foo', 'bas', function () {
get3('foo', function (err, data) {
console.log('data:', data)
get1.close()
get2.close()
get3.close()
})
})
})