Comments (7)
You wouldn't be able to use the full range of bytes, as two must be reserved for separator and lt
logic. Limiting the prefix to ASCII characters makes that easier to enforce.
from subleveldown.
The prefix separator is by default !
right? It's still possible to conflict with !
just by giving a prefix like abc!dsfgd
. So why not allow raw buffers as prefixes, since you can always check if the prefix separator bytes is within the raw buffer bytes? One can use the buf.includes
method to do this.
A more robust solution may use escaping applied to the prefix to always escape any occurrences of the prefix separator...
Not sure what you mean by lt
logic.
from subleveldown.
Sure, it's possible, at the cost of complexity. Can you explain your use case? I'm curious about the benefit of buffer prefixes, if you can't use the full range of bytes.
It's still possible to conflict with ! just by giving a prefix like abc!dsfgd
Not important for the discussion but FYI: subleveldown will throw a RangeError if you do that.
from subleveldown.
I'm using subleveldown to store dynamic sub-levels. Depending on the usecase, I would prefer to use the name of the sublevel to be a raw buffer instead because sometimes I'm using the names as indexes. And the value I'm indexing on is itself a buffer. Right now it just involves converting to a string which seems unnecessary. However I guess a robust solution would require prefix-separator escaping.
from subleveldown.
Wouldn't escaping hurt the ability to use it as an index?
from subleveldown.
Only for the sublevel prefix/names. We're not affecting the keys. Not sure what you mean by hurting its ability to use it as an index.
from subleveldown.
Can you share some code to clarify the use case?
from subleveldown.
Related Issues (20)
- How to get the exception `Inner database is not open`? HOT 2
- A way to get a deeply nested sublevel in one-go HOT 5
- Release v3.0.0 HOT 1
- Streams are ignoring fillCache option HOT 2
- Segfault with subleveldown HOT 27
- bytewise key-encoding on sub-level causes not found on other level HOT 20
- Adding _seek to SubIterator HOT 4
- Disable `clear()` HOT 2
- Take advantage of manifests and the squash down HOT 1
- An in-range update of abstract-leveldown is breaking the build 🚨 HOT 3
- Applies prefix twice on nested sublevel HOT 12
- An in-range update of levelup is breaking the build 🚨 HOT 2
- Remove unnecessary condition HOT 1
- Drop support of memdb
- Require deferredOpen support HOT 1
- Support "deep" option in clear() & iterator() HOT 10
- Possible issue with buffer keys HOT 10
- Decoder Err ! HOT 3
- Should the `createReadStream` method be scoped to the subs? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from subleveldown.