Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
feat: add open method
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Mar 22, 2017
1 parent 6264c70 commit fd12c6b
Show file tree
Hide file tree
Showing 8 changed files with 398 additions and 324 deletions.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@
"pull-stream": "^3.5.0"
},
"devDependencies": {
"aegir": "^10.0.0",
"aegir": "^11.0.1",
"async": "^2.1.5",
"chai": "^3.5.0",
"cids": "^0.4.1",
"flow-bin": "^0.41.0",
"cids": "^0.4.2",
"dirty-chai": "^1.2.2",
"flow-bin": "^0.42.0",
"memdown": "^1.2.4",
"rimraf": "^2.6.1"
},
"contributors": [
"Friedel Ziegelmayer <dignifiedquire@gmail.com>"
]
}
}
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ class LevelDatastore {
}))
}

open (callback /* : Callback<void> */) /* : void */ {
this.db.open(callback)
}

put (key /* : Key */, value /* : Buffer */, callback /* : Callback<void> */) /* : void */ {
this.db.put(key.toString(), value, callback)
}
Expand Down
6 changes: 4 additions & 2 deletions test/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
chai.use(require('dirty-chai'))
const expect = chai.expect
const pull = require('pull-stream')
const path = require('path')
const utils = require('interface-datastore').utils
const rimraf = require('rimraf')
const each = require('async/each')
const MountStore = require('datastore-core').MountDatastore
const Key = require('interface-datastore').Key
const expect = require('chai').expect
const CID = require('cids')

const LevelStore = require('../src')
Expand Down Expand Up @@ -59,7 +61,7 @@ describe('LevelDatastore', () => {
store.query({}),
pull.map((e) => new CID(e.key.toBuffer())),
pull.collect((err, cids) => {
expect(err).to.not.exist
expect(err).to.not.exist()
expect(cids[0].version).to.be.eql(0)
expect(cids).to.have.length(4)
done()
Expand Down
2 changes: 1 addition & 1 deletion test/test-repo/datastore/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000054
MANIFEST-000059
6 changes: 3 additions & 3 deletions test/test-repo/datastore/LOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
2017/03/15-14:58:36.441989 70000b29f000 Recovering log #53
2017/03/15-14:58:36.443168 70000b29f000 Delete type=0 #53
2017/03/15-14:58:36.443262 70000b29f000 Delete type=3 #52
2017/03/22-23:24:49.565876 7000052f9000 Recovering log #58
2017/03/22-23:24:49.567538 7000052f9000 Delete type=0 #58
2017/03/22-23:24:49.567619 7000052f9000 Delete type=3 #56
6 changes: 3 additions & 3 deletions test/test-repo/datastore/LOG.old
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
2017/03/15-14:57:31.986982 700010d11000 Recovering log #51
2017/03/15-14:57:31.990378 700010d11000 Delete type=0 #51
2017/03/15-14:57:31.990492 700010d11000 Delete type=3 #50
2017/03/22-23:14:37.131325 700008059000 Recovering log #57
2017/03/22-23:14:37.133087 700008059000 Delete type=0 #57
2017/03/22-23:14:37.133656 700008059000 Delete type=3 #54
Binary file not shown.
Loading

0 comments on commit fd12c6b

Please sign in to comment.