26 lines
576 B
JavaScript
26 lines
576 B
JavaScript
require('bare-process/global')
|
|
const EventEmitter = require('bare-events')
|
|
|
|
const PROTOCOL = 'sla-budget/v1'
|
|
|
|
class HyperP2PSlaBudget extends EventEmitter {
|
|
constructor (opts = {}) {
|
|
super()
|
|
this.topic = opts.topic || null
|
|
this._stats = { created: 0, errors: 0 }
|
|
}
|
|
|
|
getStats () {
|
|
return { ...this._stats, protocol: PROTOCOL, tier: 'scaffold' }
|
|
}
|
|
|
|
async ready () { return true }
|
|
|
|
_notImplemented (method) {
|
|
this._stats.errors++
|
|
throw new Error(`not implemented: scaffold (${method})`)
|
|
}
|
|
}
|
|
|
|
module.exports = { HyperP2PSlaBudget, PROTOCOL }
|