Skip to content

Commit

Permalink
fix: added stubs for functions required by TieredDatastore
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Sep 10, 2018
1 parent 47d44b6 commit c56b7d1
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![standard-readme](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)

> provides an implementation of an interface-datastore compliant api for pubsub
> provides an implementation of an api for pubsub to be used as a datastore with TieredDatastore
## Lead Maintainer

Expand Down
46 changes: 44 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const debug = require('debug')
const log = debug('datastore-pubsub:publisher')
log.error = debug('datastore-pubsub:publisher:error')

// DatastorePubsub is responsible for providing an [interface-datastore]{@link https://github.com/ipfs/interface-datastore}
// compliant api for pubsub.
// DatastorePubsub is responsible for providing an api for pubsub to be used as a datastore with
// [TieredDatastore]{@link https://github.com/ipfs/js-datastore-core/blob/master/src/tiered.js}
class DatastorePubsub {
/**
* Creates an instance of DatastorePubsub.
Expand Down Expand Up @@ -228,6 +228,48 @@ class DatastorePubsub {
log(`record for ${key.toString()} was stored in the datastore`)
})
}

open (callback) {
const errMsg = `open function was not implemented yet`

log.error(errMsg)
return callback(errcode(new Error(errMsg), 'ERR_NOT_IMPLEMENTED_YET'))
}

has (key, callback) {
const errMsg = `has function was not implemented yet`

log.error(errMsg)
return callback(errcode(new Error(errMsg), 'ERR_NOT_IMPLEMENTED_YET'))
}

delete (key, callback) {
const errMsg = `delete function was not implemented yet`

log.error(errMsg)
return callback(errcode(new Error(errMsg), 'ERR_NOT_IMPLEMENTED_YET'))
}

close (callback) {
const errMsg = `close function was not implemented yet`

log.error(errMsg)
return callback(errcode(new Error(errMsg), 'ERR_NOT_IMPLEMENTED_YET'))
}

batch () {
const errMsg = `batch function was not implemented yet`

log.error(errMsg)
throw errcode(new Error(errMsg), 'ERR_NOT_IMPLEMENTED_YET')
}

query () {
const errMsg = `query function was not implemented yet`

log.error(errMsg)
throw errcode(new Error(errMsg), 'ERR_NOT_IMPLEMENTED_YET')
}
}

exports = module.exports = DatastorePubsub

0 comments on commit c56b7d1

Please sign in to comment.