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

Custom separator #48

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jmatsushita
Copy link
Contributor

This allows to set an option { sep : mySeparator } when creating a hypertrie. This for instances allows to use Buffer.alloc(1) as a separator as when creating a sub hyperbee.

The test file is just the iterator.js test suite using Buffer.alloc(1) as a separator.

@@ -4,7 +4,7 @@ module.exports = Get

function Get (db, key, opts, cb) {
this._db = db
this._node = new Node({key, flags: (opts && opts.hidden) ? Node.Flags.HIDDEN : 0}, 0, null, db.hash)
this._node = new Node({key, flags: (opts && opts.hidden) ? Node.Flags.HIDDEN : 0}, 0, null, db.hash, opts.sep)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldnt it be easier just to load this from the db instance? It's not really configurable per node/iterator anyway, but more of a db wide thing.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we don't need all the options updates

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sounds good! I'll work on this later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants