Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate DB into the level db interface so db levels are the same as db #8

Closed
CMCDragonkai opened this issue Dec 1, 2021 · 1 comment · Fixed by #12
Closed

Integrate DB into the level db interface so db levels are the same as db #8

CMCDragonkai opened this issue Dec 1, 2021 · 1 comment · Fixed by #12
Assignees
Labels
design Requires design (architecture, protocol, specification and task list requires further work) development Standard development r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management

Comments

@CMCDragonkai
Copy link
Member

Specification

Similar to #5, I find that it shouldn't be necessary in PK to have db and vaults running their own DB. The vaults is using EFS which has to use the root DB, but the operations should be workable under a sublevel of the DB used by all of PK.

To do this, the API of js-db has to be brought into the leveldb abstract interface, that creation of sublevels is the same as creating another DB.

Another way is to just make our level call return another DB instance, but always with the option of accessing the underlying .db property for the underlying leveldb to do certain operations.

This should be done with investigating #5 so that a consistent solution can be found.

Additional context

Tasks

  1. ...
  2. ...
  3. ...
@CMCDragonkai CMCDragonkai added development Standard development design Requires design (architecture, protocol, specification and task list requires further work) labels Dec 1, 2021
@CMCDragonkai
Copy link
Member Author

The way subleveldown works is that it forces prefixes to be strings, even though they could be buffers instead. It also uses the ! as the default prefix separator, although this can be changed. This is something I'd like changed, so that sublevels can be created with buffers purely rather than strings.

One of the things that could be done is to allow an interface like:

get(keys: string | Buffer | Array<string | Buffer>)

This would enable us to do things like:

get('some key')
get(['prefix1', 'prefix2', Buffer.from('prefix3'), 'abc'])

Which is alot more flexible than the current interface we have.

Right now some special features we want to use in leveldb can only be done with db.db.

Instead our DB is currently wrapping db in order to provide a slightly different interface for our usage, and the automatic encryption/decryption (which according to #5 would be better done on a lower level, below the leveldb level).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Requires design (architecture, protocol, specification and task list requires further work) development Standard development r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management
Development

Successfully merging a pull request may close this issue.

2 participants