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

Commit 6d32b7f

Browse files
committed
feat: add streaming/cancellable API
Upgrades to the latest interface-datastore which includes streaming APIs and passing AbortControllers. Uses the new Adapter class to implement these with minimal code changes.
1 parent fb5f13a commit 6d32b7f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
"dependencies": {
3333
"buffer": "^5.5.0",
3434
"idb": "^5.0.2",
35-
"interface-datastore": "^0.8.3"
35+
"interface-datastore": "^1.0.2"
3636
},
3737
"devDependencies": {
38-
"aegir": "^21.4.5",
38+
"aegir": "^22.0.0",
3939
"chai": "^4.2.0",
40-
"datastore-core": "^1.0.0",
41-
"datastore-level": "^0.14.1",
40+
"datastore-core": "^1.1.0",
41+
"datastore-level": "^1.1.0",
4242
"dirty-chai": "^2.0.1",
4343
"ipfs-utils": "^2.2.0",
4444
"iso-random-stream": "^1.1.1"

src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const { Buffer } = require('buffer')
44
const { openDB, deleteDB } = require('idb')
5-
const { Key, Errors, utils } = require('interface-datastore')
5+
const { Key, Errors, utils, Adapter } = require('interface-datastore')
66
const { filter, sortAll } = utils
77

88
const isStrictTypedArray = (arr) => {
@@ -70,8 +70,10 @@ const queryIt = async function * (q, store, location) {
7070
}
7171
}
7272

73-
class IdbDatastore {
73+
class IdbDatastore extends Adapter {
7474
constructor (location, options = {}) {
75+
super()
76+
7577
this.store = null
7678
this.options = options
7779
this.location = options.prefix + location

0 commit comments

Comments
 (0)