jbenet / random-ideas

random ideas
juan.benet.ai
324 stars 12 forks source link

multipack #14

Open jbenet opened 10 years ago

jbenet commented 10 years ago

In the vein of multiaddr and multihash, it's silly that applications usually default to picking one binary encoding. The truth is that applications doing non trivial things will end up with multiple encodings. Hence I propose a self-identifying meta binary encoding. Int prefix identifies the encoding of the following binary blob. We'll just need to keep another table. Luckily, there's so few widely used general formats that I wouldn't expect to hit two bytes this decade :).

Example table:

0x01 protobuf
0x02 capnp
dominictarr commented 9 years ago

where ever you keep the table would be a point of centralization, mind you. I have been day dreaming about having a canonical schema, and then identifying a type as the hash of schema. So you could have a (multi)hash at the start of the object, pointing to the machine readable schema - this way you can dynamically add schemas without maintaining a central list.

sesam commented 4 years ago

Consider a git repo full of files and .git/blobs/ full of small binary files containing a mix of stuff. On what level should these 2 bytes file type prefixes be managed? Probably on the file system level, like Mac OS does it.

We humans function best with at least some centralisation (country of residence rather than lawlessness) and a bit of context (language, timezone, locale, ...) and our devices typically share this with us for UX reasons and compatibility (frequencies for mobile data) reasons. This lookup table with 2 byte prefixes can be shared and hash addressed and I would just use the same lookup table as those whom I communicate with without worrying who put together the table.