Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Missing cbor tag encoding #33

Closed
dignifiedquire opened this issue Dec 20, 2016 · 7 comments · Fixed by #38
Closed

Missing cbor tag encoding #33

dignifiedquire opened this issue Dec 20, 2016 · 7 comments · Fixed by #38
Assignees

Comments

@dignifiedquire
Copy link
Member

dignifiedquire commented Dec 20, 2016

The implementation of this that I did, used tag 258 for encoding links {'/': mylink} in cbor (ref:

exports.LINK_TAG = 258
) which corresponds to the spec as far as I understand and it was planned to register this tag.
What happened to this?

cc @diasdavid @whyrusleeping @jbenet

@dignifiedquire
Copy link
Member Author

Original spec suggestion: ipfs/specs#61

@daviddias
Copy link
Member

To my understanding of how things developed, once we figured out the IPLD Format interface and stopped talking about CBOR as the IPLD format and moved to have several IPLD formats, CBOR became just a schemaless serialisation format that maps 1:1 to JSON.

The local resolver has the job of figuring out which are links, and it could use CBOR tags for that, but is there any benefit? If CBOR was length prefixed (so that we could seek), then it could make sense as the deserialization of some values would be faster, but since it is not, I don't see the value.

On the length prefixed for seeking note, I'm very interested in having a dag-ion that uses Amazon Ion, it is a way simpler serialisation protocol (just look at the size of the spec) that does everything we need. Unfortunately there are no Go or JavaScript implementations yet.

@dignifiedquire
Copy link
Member Author

Go or JavaScript implementations yet.

I might accept the challenge, I like writing serialisers, especially fast ones ;)

@dignifiedquire
Copy link
Member Author

A big benefit to using a specific tag would be performance, as we wouldn't have to scan all keys anymore when decoding. In either case we need to update the spec, as it still reflects the situation where it is expected to use a specific tag.

@daviddias
Copy link
Member

it still reflects the situation where it is expected to use a specific tag.

I believe we need to update the whole spec either way, it hasn't received any love AFAIK since August which was when CID came together and then September when IPLD Formats became a thing.

@ianopolous
Copy link
Member

FWIW, The Amazon ion implementation in Java looks much more complicated than the cbor implementation we are using.

@daviddias daviddias added the status/deferred Conscious decision to pause or backlog label Dec 22, 2016
@daviddias
Copy link
Member

@whyrusleeping your tags in go work as you replace the whole object or just the CID value:

// original
{
  someLink: {
    '/': '<someCID>'
  }
}
// a) representation of the version encoded with CID being converted
{
  someLink: {
    '/': CBORTAG
  }
}
// b) representation of the version encoded with the whole object
{
  someLink: CBORTAG
}

I believe it is option b), but I want to be sure.

@daviddias daviddias assigned daviddias and unassigned daviddias Jan 31, 2017
@daviddias daviddias added status/in-progress In progress and removed status/deferred Conscious decision to pause or backlog labels Jan 31, 2017
@daviddias daviddias removed the status/in-progress In progress label Jan 31, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants