-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Links without Tsize #5
Comments
* Splits build step up into build:js and build:types * Adds ts definitions through jsdoc comments * Adds `prepare` script to build types before publishing and after `npm i` * Makes `Tsize` property of DAGLinks mandatory (fixes #5)
* Splits build step up into build:js and build:types * Adds ts definitions through jsdoc comments * Adds `prepare` script to build types before publishing and after `npm i` * Makes `Tsize` property of DAGLinks mandatory (fixes #5)
The intention of That schema also matches the new Go codec, https://github.com/ipld/go-codec-dagpb, so they're doing the same thing in accepting a missing But we could change that. I don't have any strong opinions other than consistency. We get to choose the lens that we want to view the PB as, and we landed on that schema in the spec after iterating around the various forms of it. Two options for dealing with it can be found in what we did with
So we could choose to do something similar with A half-way hack is to make |
Maybe a more focused response is - what are the chances that if we remove If we're looking at a near-0% chance, then we could just remove If there's only a slightly above 0% chance, maybe we could forgo the round-trip consistency and say that we interpret a missing one as |
maybe we should export a const { totalSize } = require('@ipld/dag-pb/util')
// totalSize(links: PBLink[]): number
const size = totalSize(node.links) I'm not sure what else would be useful but there's probably some other patterns that could be generalised |
AFAIK IPFS implementations have only ever created links with |
I think the TODO here is to enumerate, or just PR, utility functions that make this all much easier. Such as #5 (reference) |
It looks like this module can generate links without a
Tsize
property. The protobuf schema allows for this (along with not having a Name or a Hash) but we're previously decided that implementations should generate a value forTsize
.Would you accept a PR making this field mandatory?
It means you won't be able to do things like:
..but IPFS will not do that for the reasons in the linked thread above.
The text was updated successfully, but these errors were encountered: