Skip to content

RFC - Cleansing the 🐉🐉🐉 #139

Closed
@daviddias

Description

@daviddias

It has become extremely complicated to understand what is happening inside this module, the similar names (**store everything), the fact that the API docs were removed in favor of aegir docs but those are not getting published and how things are being initialized.

The API that we need is only:

const options = {
  path: <path to store the repo in>,
  storageBackends: {
    root: <a interface-datastore compatible class> // default to fs-datastore
    blocks: <a interface-datastore compatible class> // default to fs-datastore
    datastore <a interface-datastore compatible class> // default to level-datastore
  }
}
const repo = new Repo(options)

repo.init(cb) // creates the folder structure
repo.open(cb) // locks the repo 
repo.close(cb) // unlocks the repo

// get and put values at the root of the repo
repo.{get(key), put(key, value}  

// get and put blocks. Knows how to do the sharding and appending .data to the keys
repo.blocks.{get(key), put(key, value}  

// get and put kv. Exposes the full interface-datastore API
repo.datastore.{<full interface-datastore API>}  

The lock is a special case just to be compatible with go. In Node.js should continue to use fs.

What I'm proposing

  • Avoid modules like 'sharding datastore' and just do the sharding from within the blocks file here
  • Refactor the code, improve comments and flow
  • Bring back API docs for the README.
  • Write more tests to ensure that there are no breaking changes in the feature that affect how files get stored and how configuration works.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions