git ssb

3+

Dominic / ssb-blobs



Tree: bde3bf7b399b05e5d5c6475ee35ef2745c6788de

Files: bde3bf7b399b05e5d5c6475ee35ef2745c6788de / set.js

456 bytesRaw
1var pull = require('pull-stream')
2var pl = require('pull-level')
3
4module.exports = function (db) {
5 var set = {}
6
7 pull(
8 pl.read(db, {live: true}),
9 pull.drain(function (e) {
10 if(!e.sync)
11 if(e.type === 'del')
12 delete set[e.key]
13 else set[e.key] = e.value
14 })
15 )
16
17 return {
18 set: set,
19 add: function (key, cb) {
20 db.put(key, -1, cb)
21 },
22 remove: function (key, cb) {
23 db.del(key, cb)
24 }
25 }
26}
27
28
29

Built with git-ssb-web