Created
March 5, 2017 13:29
-
-
Save juliangruber/e5b682585e3708a86659be63dd2f9c64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rad = require('random-access-directory') | |
var store = rad(procss.env.HOME + '/.dat/') | |
// create a first store | |
store = store('hypercore.txt') | |
store.get(0, ...) | |
// create another store, based on the first one | |
// this way modules can pass the store instance | |
// down to child modules | |
store = store('hyperdrive.txt') | |
var feed = hypercore(store('hypercore.txt')) | |
// ok so a module that wants to use an | |
// abstract-random-access store but also needs | |
// some for dependent modules, needs to require | |
// you to pass a random-access-directory instance. | |
// what though if you want all to be in-memory? | |
// should we instead turn this module into one | |
// that works with any abstract-random-access | |
// store? then it could be something like this: | |
var store = multirandom(function (name) { | |
return raf(basedir + '/' + name) | |
}) | |
// create a first store | |
store = store('hypercore.txt') | |
store.get(0, ...) | |
// create another store, based on the first one | |
// this way modules can pass the store instance | |
// down to child modules | |
store = store('hyperdrive.txt') | |
// this means, do we want to introduce a new | |
// interface, the abstract-random-access-FACTORY? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment