mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
Remove obsolete code, clean ups
This commit is contained in:
parent
13f79e6a65
commit
5f1af23539
@ -22,15 +22,9 @@ export default (env, argv) => {
|
||||
target: 'web',
|
||||
externals: {
|
||||
fs: '{ existsSync: () => true }',
|
||||
'fs-shim': '{ existsSync: () => true }',
|
||||
mkdirp: '{}'
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
|
||||
}
|
||||
}),
|
||||
new webpack.ProvidePlugin({
|
||||
process: 'process/browser',
|
||||
Buffer: ['buffer', 'Buffer']
|
||||
|
@ -20,7 +20,6 @@
|
||||
"dependencies": {
|
||||
"ipfs-pubsub-1on1": "next",
|
||||
"is-node": "^1.0.2",
|
||||
"localstorage-down": "^0.6.7",
|
||||
"logplease": "^1.2.15",
|
||||
"multihashes": "^4.0.3",
|
||||
"orbit-db-access-controllers": "next",
|
||||
@ -55,6 +54,7 @@
|
||||
"go-ipfs": "^0.9.1",
|
||||
"ipfs": "^0.59.0",
|
||||
"ipfsd-ctl": "^10.0.3",
|
||||
"localstorage-down": "^0.6.7",
|
||||
"localstorage-level-migration": "next",
|
||||
"markdown-toc": "^1.2.0",
|
||||
"mkdirp": "^1.0.4",
|
||||
|
@ -3,10 +3,6 @@ import mh from 'multihashes'
|
||||
|
||||
const defaultHashAlg = 'sha2-256'
|
||||
|
||||
// 'use strict'
|
||||
|
||||
// const ImmutableDB from './immutabledb-interface')
|
||||
|
||||
const createMultihash = (data, hashAlg) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
multihashing(data, hashAlg || defaultHashAlg, (err, multihash) => {
|
||||
@ -17,26 +13,16 @@ const createMultihash = (data, hashAlg) => {
|
||||
})
|
||||
}
|
||||
|
||||
// const LRU from 'lru')
|
||||
// const ImmutableDB from './immutabledb-interface')
|
||||
// const createMultihash from './create-multihash')
|
||||
|
||||
/* Memory store using an LRU cache */
|
||||
export default class MemStore {
|
||||
constructor () {
|
||||
this._store = {}// new LRU(1000)
|
||||
this._store = {}
|
||||
}
|
||||
|
||||
async put (value) {
|
||||
const data = value// new Buffer(JSON.stringify(value))
|
||||
const data = value
|
||||
const hash = await createMultihash(data)
|
||||
// console.log(this._store)
|
||||
// this._store.set(hash, data)
|
||||
if (!this._store) this._store = {}
|
||||
// console.log(this._store)
|
||||
// console.log(hash, data)
|
||||
this._store[hash] = data
|
||||
// return hash
|
||||
return {
|
||||
toJSON: () => {
|
||||
return {
|
||||
@ -48,12 +34,6 @@ export default class MemStore {
|
||||
}
|
||||
|
||||
async get (key) {
|
||||
// if (data) {
|
||||
// const value = JSON.parse(data)
|
||||
// return value
|
||||
// }
|
||||
|
||||
// return data
|
||||
return {
|
||||
toJSON: () => {
|
||||
return {
|
||||
|
@ -6,7 +6,6 @@ import rmrf from 'rimraf'
|
||||
import OrbitDB from '../src/OrbitDB.js'
|
||||
import Identities from 'orbit-db-identity-provider'
|
||||
import Keystore from 'orbit-db-keystore'
|
||||
import leveldown from 'leveldown'
|
||||
import storageAdapter from 'orbit-db-storage-adapter'
|
||||
|
||||
// Include test utilities
|
||||
@ -17,7 +16,7 @@ import {
|
||||
testAPIs,
|
||||
} from 'orbit-db-test-utils'
|
||||
|
||||
const storage = storageAdapter(leveldown)
|
||||
const storage = storageAdapter()
|
||||
|
||||
const dbPath1 = './orbitdb/tests/offline/db1'
|
||||
const dbPath2 = './orbitdb/tests/offline/db2'
|
||||
|
@ -4,7 +4,6 @@ import rmrf from 'rimraf'
|
||||
import path from 'path'
|
||||
import OrbitDB from '../src/OrbitDB.js'
|
||||
import Cache from 'orbit-db-cache'
|
||||
import localdown from 'localstorage-down'
|
||||
import Storage from 'orbit-db-storage-adapter'
|
||||
|
||||
// Include test utilities
|
||||
@ -22,11 +21,6 @@ const tests = [
|
||||
title: 'Persistency',
|
||||
orbitDBConfig: { directory: path.join(dbPath, '1') }
|
||||
},
|
||||
// {
|
||||
// title: 'Persistency with custom cache',
|
||||
// type: "custom",
|
||||
// orbitDBConfig: { directory: path.join(dbPath, '2') }
|
||||
// }
|
||||
]
|
||||
|
||||
Object.keys(testAPIs).forEach(API => {
|
||||
@ -41,12 +35,6 @@ Object.keys(testAPIs).forEach(API => {
|
||||
before(async () => {
|
||||
const options = Object.assign({}, test.orbitDBConfig)
|
||||
|
||||
if(test.type === "custom") {
|
||||
const customStorage = Storage(localdown)
|
||||
const customStore = await customStorage.createStore(dbPath)
|
||||
options.cache = new Cache(customStore)
|
||||
}
|
||||
|
||||
rmrf.sync(dbPath)
|
||||
ipfsd = await startIpfs(API, config.daemon1)
|
||||
ipfs = ipfsd.api
|
||||
|
@ -4,7 +4,6 @@ import rmrf from 'rimraf'
|
||||
import OrbitDB from '../src/OrbitDB.js'
|
||||
import Identities from 'orbit-db-identity-provider'
|
||||
import Keystore from 'orbit-db-keystore'
|
||||
import leveldown from 'leveldown'
|
||||
import storageAdapter from 'orbit-db-storage-adapter'
|
||||
|
||||
// Include test utilities
|
||||
@ -15,7 +14,7 @@ import {
|
||||
testAPIs,
|
||||
} from 'orbit-db-test-utils'
|
||||
|
||||
const storage = storageAdapter(leveldown)
|
||||
const storage = storageAdapter()
|
||||
|
||||
const keysPath = './orbitdb/identity/identitykeys'
|
||||
const dbPath = './orbitdb/tests/change-identity'
|
||||
|
Loading…
x
Reference in New Issue
Block a user