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

Commit

Permalink
feat: add streaming/cancellable API
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
achingbrain committed May 7, 2020
1 parent fb5f13a commit 6d32b7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"dependencies": {
"buffer": "^5.5.0",
"idb": "^5.0.2",
"interface-datastore": "^0.8.3"
"interface-datastore": "^1.0.2"
},
"devDependencies": {
"aegir": "^21.4.5",
"aegir": "^22.0.0",
"chai": "^4.2.0",
"datastore-core": "^1.0.0",
"datastore-level": "^0.14.1",
"datastore-core": "^1.1.0",
"datastore-level": "^1.1.0",
"dirty-chai": "^2.0.1",
"ipfs-utils": "^2.2.0",
"iso-random-stream": "^1.1.1"
Expand Down
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const { Buffer } = require('buffer')
const { openDB, deleteDB } = require('idb')
const { Key, Errors, utils } = require('interface-datastore')
const { Key, Errors, utils, Adapter } = require('interface-datastore')
const { filter, sortAll } = utils

const isStrictTypedArray = (arr) => {
Expand Down Expand Up @@ -70,8 +70,10 @@ const queryIt = async function * (q, store, location) {
}
}

class IdbDatastore {
class IdbDatastore extends Adapter {
constructor (location, options = {}) {
super()

this.store = null
this.options = options
this.location = options.prefix + location
Expand Down

0 comments on commit 6d32b7f

Please sign in to comment.