4 ms·
There's no need to explicitly version your first version of this though. Those first-version values are easy to identify: they don't contain versioning informa
by Groxx 4y ago
There's no need to explicitly version your first version of this though. Those first-version values are easy to identify: they don't contain versioning information :)
E.g. say you have `5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8`. What version is that?
Well. It's exactly as long as a SHA1 hash. It doesn't start with "sha256:" or "md5:" or "h1:" or "rot13:". So it's SHA1. Easy and totally unambiguous.
Versioning can almost always begin with version 2.
- morelisp 4y agoMe, sowing: "Each record begins with a 4 octet BE value indicating the record length." Me, reaping: "Each record begins with a single byte indicating the record format version. In version 0, this is followed by a 3 octet BE value indicating the record length."
- Groxx 4y agoif you're storing the raw binary rather than hex or base64: yeah. there are often no illegal values, so there's no way to safely extend it, unless you can differentiate on length. for those, you have to leave versioning room up-front. even 1 bit is enough, since a `1` can imply "following data describes the version", if a bit wastefully in the long run.
- nh23423fefe 4y agosow then reap
- morelisp 4y agoWell this fucking sucks. What the fuck.
- cdelsolar 4y agoWhat are you guys even talking about
- etc-hosts 4y agohttps://twitter.com/screaminbutcalm/status/1105577845642878976 https://twitter.com/screaminbutcalm/status/11055778456428789...
- nh23423fefe 4y agoi deserved it, i guess, lol
- deleted 4y ago[deleted]
- kazinator 4y agoThat's not applicable to Grox's example. The initial version uses only hexadecimal digits for the SHA256. If you had: "each record begins with an 8 character record length, in hexadecimal, giving 32 bits", you have no problems. The new version has a 'V' character in byte 0, which is rejected as invalid by the old implementation.
- morelisp 4y agoLove too put another branch in the decoder I need to run a billion times.
- arccy 4y agoversioning also allows you to change the inputs on the future to include/exclude more info inconsistencies in how data is presented (optional version number) is a pain to deal with in code