question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support different valueEncodings per prefix

See original GitHub issue

Was talking about this on IRC. Currently the valueEncoding is global per DB, making it hard to put different data types in the same hyperdb (e.g. both protobuf encoded hyperdrive stats and additional json metadata). While the valueEncoding can be a custom function, it gets only the value to be encoded/decoded, not the key.

I propose to allow optionally passing in multiple valueEncodings, keyed by prefix. That would allow different datatypes per prefix, making something like sublevel for hyperdb really simple.

Background is to allow storing additional metadata in a hyperdrive hyperdb (that does not have to fit into the hyperdrive stat protobufs). For that to work really cleanly I’d propose that hyperdrive prefixes all keys with e.g. @hd/ so that the hyperdb would be namespaced by default. This could also be optional if we’d have something like a global configuration key (does hyperdrive have this currently?) - which could also be useful for something like API or protocol version, should that ever change again.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
Frandocommented, Mar 23, 2018

That actually turned out easier than I first thought.

https://github.com/Frando/subhyperdb

Not all of hyperdb API is supported yet.

1reaction
hackergrrlcommented, Mar 22, 2018

Oh sorry no I meant your own layer atop hyperdb. So you’d have your own ‘put’ method that can figure out the codec to use based on key.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sv prefix proposal - libre-soc
SVPrefix has no support for svlen overrides in either the 48 or 64 bit instruction format either (svlen=0 as the only legal permitted...
Read more >
Prefix code - Wikipedia
A prefix code is a uniquely decodable code: given a complete and accurate sequence, a receiver can identify each word without requiring a...
Read more >
Encodings | Apache Parquet
Supported Types: all. This is the plain encoding that must be supported for types. It is intended to be the simplest encoding. Values...
Read more >
Encoding | Protocol Buffers - Google Developers
When a message is encoded, each key-value pair is turned into a record consisting of the ... Length prefixes are another major concept...
Read more >
Unicode & Character Encodings in Python: A Painless Guide
Python's Unicode support is strong and robust, but it takes some time to master. This tutorial is different because it's not language-agnostic but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found