ethersphere / bee

Bee is a Swarm client implemented in Go. It’s the basic building block for the Swarm network: a private; decentralized; and self-sustaining network for permissionless publishing and access to your (application) data.
https://www.ethswarm.org
BSD 3-Clause "New" or "Revised" License
1.45k stars 338 forks source link

feat: feed wrapping #4677

Closed nugaon closed 1 week ago

nugaon commented 4 months ago

This feature drops the JSON structure with CAC reference and timestamp in feed payload in order to be capable of wrapping a whole content addressed chunk instead. The feed payload resolution is backward compatible by checking the span + ts + swarmHash size in content and trying to retrieve the content under swarmHash.

Because the SOC content needs to be resolved in one request and there is no ts attribute of a feed anymore, the Feed API must be updated and it has breaking change on its GET endpoint. Additionally, at parameter is no longer in use at sequential feeds.

Since now feed endpoint can return content bigger than one chunk and that can be erasure coded, erasure-code related request headers have been added. Some application may use this endpoint to simply get the latest index of a sequential feed, for that new header is introduced swarm-only-root-chunk which is a boolean type and if it is true then Bee does not retrieve the whole chunk tree.

GET /soc/{owner}/{id} method is introduced with required path parameters owner and id which are hex encoded strings. This new method handles root chunk as a Single Owner Chunk by default and resolves and returns content similarly as GET /feed. Both endpoints return newly introduced header swarm-soc-signature which encodes the signature of the Single Owner Chunk in question.

Checklist

Description

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

nugaon commented 2 weeks ago

This must go through a SWIP

Wrote SWIP and created PR for that

is direct resolutiion into content really needed? wouldnt it be much simpler if this was done in 2 steps on cllient side?

This is desired to eliminate; the content can be resolved by only 1 request. Moreover, with bigger content there is no API functionality to pass a whole chunk to resolve (and that way would be more complex)

Cafe137 commented 1 week ago

Please add the new headers to corsHandler allowedHeaders