diff --git a/src/db/interface.js b/src/db/database.js similarity index 100% rename from src/db/interface.js rename to src/db/database.js diff --git a/src/db/index.js b/src/db/index.js index 7d17ea9..cc2f9ba 100644 --- a/src/db/index.js +++ b/src/db/index.js @@ -1,4 +1,4 @@ -export { default as Database } from './interface.js' +export { default as Database } from './database.js' export { default as DocumentStore } from './document-store.js' export { default as EventStore } from './event-store.js' export { default as Feed } from './feed.js' diff --git a/test/document-store.spec.js b/test/document-store.spec.js index f35b505..2282503 100644 --- a/test/document-store.spec.js +++ b/test/document-store.spec.js @@ -4,9 +4,8 @@ import Log from '../src/log.js' import Entry from '../src/entry.js' import IdentityProvider from '../src/identities/index.js' import KeyStore from '../src/key-store.js' -import IPFSBlockStorage from '../src/storage/ipfs-block.js' -import LevelStorage from '../src/storage/level.js' import { DocumentStore, Database } from '../src/db/index.js' +import { IPFSBlockStorage, LevelStorage } from '../src/storage/index.js' // Test utils // import { config, testAPIs, getIpfsPeerId, waitForPeers, startIpfs, stopIpfs } from 'orbit-db-test-utils' diff --git a/test/event-store.spec.js b/test/event-store.spec.js index e552f58..2ace0ff 100644 --- a/test/event-store.spec.js +++ b/test/event-store.spec.js @@ -4,9 +4,8 @@ import Log from '../src/log.js' import Entry from '../src/entry.js' import IdentityProvider from '../src/identities/index.js' import KeyStore from '../src/key-store.js' -import IPFSBlockStorage from '../src/storage/ipfs-block.js' -import LevelStorage from '../src/storage/level.js' import { EventStore, Database } from '../src/db/index.js' +import { IPFSBlockStorage, LevelStorage } from '../src/storage/index.js' // Test utils import { config, testAPIs, startIpfs, stopIpfs, getIpfsPeerId, waitForPeers } from 'orbit-db-test-utils' diff --git a/test/feed.spec.js b/test/feed.spec.js index 075bbfc..18b8741 100644 --- a/test/feed.spec.js +++ b/test/feed.spec.js @@ -4,9 +4,8 @@ import Log from '../src/log.js' import Entry from '../src/entry.js' import IdentityProvider from '../src/identities/index.js' import KeyStore from '../src/key-store.js' -import IPFSBlockStorage from '../src/storage/ipfs-block.js' -import LevelStorage from '../src/storage/level.js' import { Feed, Database } from '../src/db/index.js' +import { IPFSBlockStorage, LevelStorage } from '../src/storage/index.js' // Test utils import { config, testAPIs, getIpfsPeerId, waitForPeers, startIpfs, stopIpfs } from 'orbit-db-test-utils' diff --git a/test/keyvalue.spec.js b/test/keyvalue.spec.js index fed2ad2..6c5416c 100644 --- a/test/keyvalue.spec.js +++ b/test/keyvalue.spec.js @@ -4,12 +4,8 @@ import Log from '../src/log.js' import Entry from '../src/entry.js' import IdentityProvider from '../src/identities/index.js' import KeyStore from '../src/key-store.js' - -import KeyValueStore from '../src/db/keyvalue.js' -import KeyValueStorePersisted from '../src/db/keyvalue-persisted.js' -import Database from '../src/db/interface.js' -import IPFSBlockStorage from '../src/storage/ipfs-block.js' -import LevelStorage from '../src/storage/level.js' +import { KeyValue, KeyValuePersisted, Database } from '../src/db/index.js' +import { IPFSBlockStorage, LevelStorage } from '../src/storage/index.js' // Test utils import { config, testAPIs, getIpfsPeerId, waitForPeers, startIpfs, stopIpfs } from 'orbit-db-test-utils' @@ -116,10 +112,10 @@ Object.keys(testAPIs).forEach((IPFS) => { // error = err } - // kv1 = await KeyValueStore({ KeyValue: KeyValueStore, OpLog, Database, ipfs: ipfs1, identity: testIdentity1, databaseId, accessController }) - // kv2 = await KeyValueStore({ KeyValue: KeyValueStore, OpLog, Database, ipfs: ipfs2, identity: testIdentity2, databaseId, accessController }) - kv1 = await KeyValueStorePersisted({ KeyValue: KeyValueStore, OpLog, Database, ipfs: ipfs1, identity: testIdentity1, databaseId, accessController }) - kv2 = await KeyValueStorePersisted({ KeyValue: KeyValueStore, OpLog, Database, ipfs: ipfs2, identity: testIdentity2, databaseId, accessController }) + // kv1 = await KeyValue({ KeyValue: KeyValue, OpLog, Database, ipfs: ipfs1, identity: testIdentity1, databaseId, accessController }) + // kv2 = await KeyValue({ KeyValue: KeyValue, OpLog, Database, ipfs: ipfs2, identity: testIdentity2, databaseId, accessController }) + kv1 = await KeyValuePersisted({ KeyValue: KeyValue, OpLog, Database, ipfs: ipfs1, identity: testIdentity1, databaseId, accessController }) + kv2 = await KeyValuePersisted({ KeyValue: KeyValue, OpLog, Database, ipfs: ipfs2, identity: testIdentity2, databaseId, accessController }) // kv1.events.on('update', onUpdate) kv2.events.on('update', onUpdate) @@ -242,10 +238,10 @@ Object.keys(testAPIs).forEach((IPFS) => { // ++syncCount // } - // kv1 = await KeyValueStore({ KeyValue: KeyValueStore, OpLog, Database, ipfs: ipfs1, identity: testIdentity1, databaseId, accessController }) - // kv2 = await KeyValueStore({ KeyValue: KeyValueStore, OpLog, Database, ipfs: ipfs2, identity: testIdentity2, databaseId, accessController }) - kv1 = await KeyValueStorePersisted({ KeyValue: KeyValueStore, OpLog, Database, ipfs: ipfs1, identity: testIdentity1, databaseId, accessController }) - kv2 = await KeyValueStorePersisted({ KeyValue: KeyValueStore, OpLog, Database, ipfs: ipfs2, identity: testIdentity2, databaseId, accessController }) + // kv1 = await KeyValue({ KeyValue: KeyValue, OpLog, Database, ipfs: ipfs1, identity: testIdentity1, databaseId, accessController }) + // kv2 = await KeyValue({ KeyValue: KeyValue, OpLog, Database, ipfs: ipfs2, identity: testIdentity2, databaseId, accessController }) + kv1 = await KeyValuePersisted({ KeyValue: KeyValue, OpLog, Database, ipfs: ipfs1, identity: testIdentity1, databaseId, accessController }) + kv2 = await KeyValuePersisted({ KeyValue: KeyValue, OpLog, Database, ipfs: ipfs2, identity: testIdentity2, databaseId, accessController }) // kv1.events.on('update', onUpdate) kv2.events.on('update', onUpdate) @@ -277,10 +273,10 @@ Object.keys(testAPIs).forEach((IPFS) => { await kv1.close() await kv2.close() - // kv1 = await KeyValueStore({ KeyValue: KeyValueStore, OpLog, Database, ipfs: ipfs1, identity: testIdentity1, databaseId, accessController }) - // kv2 = await KeyValueStore({ KeyValue: KeyValueStore, OpLog, Database, ipfs: ipfs2, identity: testIdentity2, databaseId, accessController }) - kv1 = await KeyValueStorePersisted({ KeyValue: KeyValueStore, OpLog, Database, ipfs: ipfs1, identity: testIdentity1, databaseId, accessController }) - kv2 = await KeyValueStorePersisted({ KeyValue: KeyValueStore, OpLog, Database, ipfs: ipfs2, identity: testIdentity2, databaseId, accessController }) + // kv1 = await KeyValue({ KeyValue: KeyValue, OpLog, Database, ipfs: ipfs1, identity: testIdentity1, databaseId, accessController }) + // kv2 = await KeyValue({ KeyValue: KeyValue, OpLog, Database, ipfs: ipfs2, identity: testIdentity2, databaseId, accessController }) + kv1 = await KeyValuePersisted({ KeyValue: KeyValue, OpLog, Database, ipfs: ipfs1, identity: testIdentity1, databaseId, accessController }) + kv2 = await KeyValuePersisted({ KeyValue: KeyValue, OpLog, Database, ipfs: ipfs2, identity: testIdentity2, databaseId, accessController }) console.time('get') const value0 = await kv2.get('init')