Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

raw codec #223

Open
achingbrain opened this issue Nov 14, 2019 · 3 comments
Open

raw codec #223

achingbrain opened this issue Nov 14, 2019 · 3 comments
Assignees

Comments

@achingbrain
Copy link
Member

Is the raw codec documented anywhere? I want to link to it from a spec document but there doesn't seem to be anything in the block-layer/codecs directory.

I guess it could be as simple as "It's an opaque stream of bytes".

@rvagg
Copy link
Member

rvagg commented Jan 1, 2020

👍 we need a block-layer/codecs/raw.md and it shouldn't be too hard, I'll try and remember to get to this soon.

@rvagg rvagg self-assigned this Jan 1, 2020
@mvdan
Copy link
Contributor

mvdan commented Sep 4, 2021

Here's a question for the spec. Are zero bytes valid in the "raw" codec? Nearly all other codecs should reject empty input on decode, I think. Take JSON and CBOR including their "DAG" variants, for example - a value/node in either can't be encoded as zero bytes.

I think the "raw" codec is special enough that it might be OK for it to be zero bytes. But also, it probably makes no sense for an IPLD block to have zero length.

@rvagg
Copy link
Member

rvagg commented Sep 6, 2021

dag-pb has a special case for zero bytes, it's a form we have to recognise, so there's an existing case for it. I would say that it's valid for raw to have zero bytes since a zero length byte array is a perfectly reasonable programmatic construct. The difference with dag-cbor and dag-json is that there's no clear connection between a zero length block and what the data model should be representing for it, since both of those require something even for "empty" recursives and bytes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants