Remove Log and Database dependency injection

This commit is contained in:
haad
2023-04-06 08:45:23 +03:00
parent a94d2a7918
commit d681bb720a
9 changed files with 37 additions and 38 deletions

View File

@@ -1,15 +1,14 @@
import { EventEmitter } from 'events'
import PQueue from 'p-queue'
import Sync from './sync.js'
import { Log, Entry } from './oplog/index.js'
import { ComposedStorage, LRUStorage, IPFSBlockStorage, LevelStorage } from './storage/index.js'
import pathJoin from './utils/path-join.js'
const defaultReferencesCount = 16
const defaultCacheSize = 1000
const Database = async ({ OpLog, ipfs, identity, address, name, access, directory, meta, headsStorage, entryStorage, indexStorage, referencesCount, syncAutomatically }) => {
const { Log, Entry } = OpLog
const Database = async ({ ipfs, identity, address, name, access, directory, meta, headsStorage, entryStorage, indexStorage, referencesCount, syncAutomatically }) => {
directory = pathJoin(directory || './orbitdb', `./${address}/`)
meta = meta || {}
referencesCount = referencesCount || defaultReferencesCount