Closed pfrazee closed 6 years ago
I still kind of wish we could deal with nested schemas
I'm not against revisiting this. It should pretty much always be layered (one structure on top of another) so all we need is a standard separator. The downside is that it adds some complexity (multiple types emitted instead of just 1).
I don't remember that much about the wire representation of protobuf, but we will implicitly still be trying to parse a lot of random bytestrings to see if they "match" this schema.
Hmm, yeah that's true.
Should we mention that folks should specifically avoid having a protobuf message that has a string field as the first entry, because that could accidentally get interpreted as a "type" string?
Tricky. If it ends up possible that non-header messages have strings at tag 1, then we have to interpret an unknown type string in the same way we interpret no header at all. We could add some magic numbers to the schema, except that wouldn't be backwards compatible. Might not be a huge deal.
Do we need to set a sane max version length (1024 bytes?) to prevent gnarly/weird parsing?
Is there a way to put a max string length on protobuf fields? @mafintosh
Are the proposed version names for hyperdrive / hyperdb also part of the DEP, or do they only serve as an example? If they only serve as an example, it might be good to make it extra clear that the names aren't being specified in this DEP.
edit: typo
Are the proposed version names for hyperdrive / hyperdb also part of the DEP, or do they only serve as an example? If they only serve as an example, it might be good to make it extra clear that the names aren't being specified in this DEP.
Agree. They're just examples
To summarize the current state of this in my eyes:
Just fixed that "hypercore-v1" thing and added a note that the strings will be in the data structures' DEPs.
I renamed type
to dataStructureType
. I'm open to discussion on this. I have some code that's trying to handle dats generally in preparation for more types. In it, I referred to each general item as a "dat" and the instance of hypercore/hyperdrive/hyperdb as that dat's "data structure". So:
var dat = {
key: '...',
dataStructureType: 'hyperdrive',
dataStructure: hyperdrive(...)
}
The word dataStructure
is a little clunky but it does seem to work alright.
Standardizes a
HypercoreHeader
message which can be used as the first entry in hypercores to declare the datastructure along with custom fields.