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

First proposal of injected EventStore #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions src/FeedStore.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
'use strict'

const EventStore = require('orbit-db-eventstore')
const FeedIndex = require('./FeedIndex')

class FeedStore extends EventStore {
constructor (ipfs, id, dbname, options) {
if(!options) options = {}
if(!options.Index) Object.assign(options, { Index: FeedIndex })
super(ipfs, id, dbname, options)
this._type = 'feed'
}
const genFeedStore = function(EventStore) {
class FeedStore extends EventStore {
constructor (ipfs, id, dbname, options) {
if(!options) options = {}
if(!options.Index) Object.assign(options, { Index: FeedIndex })
super(ipfs, id, dbname, options)
this._type = 'feed'
}

remove (hash, options = {}) {
return this.del(hash, options)
}
remove (hash, options = {}) {
return this.del(hash, options)
}

del (hash, options = {}) {
const operation = {
op: 'DEL',
key: null,
value: hash
del (hash, options = {}) {
const operation = {
op: 'DEL',
key: null,
value: hash
}
return this._addOperation(operation, options)
}
return this._addOperation(operation, options)
}
return FeedStore
}

module.exports = FeedStore

module.exports = genFeedStore