This repository was archived by the owner on Dec 2, 2024. It is now read-only.
Drop support of key & value types other than string and Buffer#179
Merged
Drop support of key & value types other than string and Buffer#179
Conversation
vweevers
commented
Sep 8, 2019
04491d3 to
da9fc40
Compare
vweevers
commented
Sep 13, 2019
da9fc40 to
e4a827b
Compare
vweevers
commented
Sep 14, 2019
| if (err) throw err | ||
| }) | ||
| }) | ||
| ``` |
Member
Author
There was a problem hiding this comment.
Should we include this? I wrote it to see if it could work, and it does for common cases, but not if:
- You target old browsers that don't support binary keys (IE, Edge and a few others, the ones in red here)
- You used custom key or value types (numbers etc); these come out stringified
- You mixed key types (e.g. strings and buffers); keys may conflict.
We could (also) choose to:
- Drop browsers that don't support binary keys
- Store keys as base64 strings for these browsers (you won't be able to read existing string data though).
- Use a new database prefix (to avoid reading old data altogether)
vweevers
commented
Sep 14, 2019
| if (err) throw err | ||
| }) | ||
| }) | ||
| ``` |
Member
Author
There was a problem hiding this comment.
I also considered adding the upgrade method to the manifest, which level (and layers in between) could detect and then proxy, but it's too early for that. We should first add manifests to abstract-leveldown and work out the details there.
31 tasks
ralphtheninja
approved these changes
Sep 15, 2019
This was referenced Sep 18, 2019
achingbrain
added a commit
to ipfs/js-ipfs-repo-migrations
that referenced
this pull request
Jan 28, 2021
We use the [level](https://www.npmjs.com/package/level) module to supply either [leveldown](http://npmjs.com/package/leveldown) or [level-js](https://www.npmjs.com/package/level-js) to [datastore-level](https://www.npmjs.com/package/datastore-level) depending on if we're running under node or in the browser. `level@6.x.x` upgrades the `level-js` dependency from `4.x.x` to `5.x.x` which includes the changes from [Level/level-js#179](Level/level-js#179) so `>5.x.x` requires all database keys/values to be Uint8Arrays and they can no longer be strings. We already store values as Uint8Arrays but our keys are strings, so here we add a migration to converts all datastore keys to Uint8Arrays. N.b. `leveldown` already does this conversion for us so this migration only needs to run in the browser.
achingbrain
added a commit
to ipfs/js-ipfs-repo-migrations
that referenced
this pull request
Jan 28, 2021
We use the [level](https://www.npmjs.com/package/level) module to supply either [leveldown](http://npmjs.com/package/leveldown) or [level-js](https://www.npmjs.com/package/level-js) to [datastore-level](https://www.npmjs.com/package/datastore-level) depending on if we're running under node or in the browser. `level@6.x.x` upgrades the `level-js` dependency from `4.x.x` to `5.x.x` which includes the changes from [Level/level-js#179](Level/level-js#179) so `>5.x.x` requires all database keys/values to be Uint8Arrays and they can no longer be strings. We already store values as Uint8Arrays but our keys are strings, so here we add a migration to converts all datastore keys to Uint8Arrays. N.b. `leveldown` already does this conversion for us so this migration only needs to run in the browser.
achingbrain
added a commit
to ipfs/js-ipfs-repo-migrations
that referenced
this pull request
Jan 28, 2021
We use the [level](https://www.npmjs.com/package/level) module to supply either [leveldown](http://npmjs.com/package/leveldown) or [level-js](https://www.npmjs.com/package/level-js) to [datastore-level](https://www.npmjs.com/package/datastore-level) depending on if we're running under node or in the browser. `level@6.x.x` upgrades the `level-js` dependency from `4.x.x` to `5.x.x` which includes the changes from [Level/level-js#179](Level/level-js#179) so `>5.x.x` requires all database keys/values to be Uint8Arrays and they can no longer be strings. We already store values as Uint8Arrays but our keys are strings, so here we add a migration to converts all datastore keys to Uint8Arrays. N.b. `leveldown` already does this conversion for us so this migration only needs to run in the browser.
achingbrain
added a commit
to ipfs/js-ipfs-repo-migrations
that referenced
this pull request
Jan 28, 2021
We use the [level](https://www.npmjs.com/package/level) module to supply either [leveldown](http://npmjs.com/package/leveldown) or [level-js](https://www.npmjs.com/package/level-js) to [datastore-level](https://www.npmjs.com/package/datastore-level) depending on if we're running under node or in the browser. `level@6.x.x` upgrades the `level-js` dependency from `4.x.x` to `5.x.x` which includes the changes from [Level/level-js#179](Level/level-js#179) so `>5.x.x` requires all database keys/values to be Uint8Arrays and they can no longer be strings. We already store values as Uint8Arrays but our keys are strings, so here we add a migration to converts all datastore keys to Uint8Arrays. N.b. `leveldown` already does this conversion for us so this migration only needs to run in the browser.
achingbrain
added a commit
to ipfs/js-ipfs-repo-migrations
that referenced
this pull request
Jan 29, 2021
We use the [level](https://www.npmjs.com/package/level) module to supply either [leveldown](http://npmjs.com/package/leveldown) or [level-js](https://www.npmjs.com/package/level-js) to [datastore-level](https://www.npmjs.com/package/datastore-level) depending on if we're running under node or in the browser. `level@6.x.x` upgrades the `level-js` dependency from `4.x.x` to `5.x.x` which includes the changes from [Level/level-js#179](Level/level-js#179) so `>5.x.x` requires all database keys/values to be Uint8Arrays and they can no longer be strings. We already store values as Uint8Arrays but our keys are strings, so here we add a migration to converts all datastore keys to Uint8Arrays. N.b. `leveldown` already does this conversion for us so this migration only needs to run in the browser.
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #174. WIP.