Skip to content

Comments

feat: new core piece url retriever#617

Open
hugomrdias wants to merge 7 commits intomasterfrom
hugomrdias/piece-retriver
Open

feat: new core piece url retriever#617
hugomrdias wants to merge 7 commits intomasterfrom
hugomrdias/piece-retriver

Conversation

@hugomrdias
Copy link
Member

No description provided.

@hugomrdias hugomrdias requested a review from rvagg as a code owner February 18, 2026 14:04
@github-project-automation github-project-automation bot moved this to 📌 Triage in FOC Feb 18, 2026
@socket-security
Copy link

socket-security bot commented Feb 18, 2026

@rjan90 rjan90 moved this from 📌 Triage to 🔎 Awaiting review in FOC Feb 18, 2026
@rjan90 rjan90 added this to the M4.0: mainnet staged milestone Feb 18, 2026
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 18, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
synapse-dev 2e2a637 Commit Preview URL

Branch Preview URL
Feb 18 2026, 03:47 PM

override name: 'InvalidPieceCIDError' = 'InvalidPieceCIDError'

constructor(input: unknown, options?: SynapseErrorOptions) {
let msg = 'Invalid piece CID.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let msg = 'Invalid piece CID.'
let msg = 'Invalid piece CID'

* @param signal - {@link AbortSignal}
* @returns The piece URL
*/
export async function pingProviders(providers: PDPProvider[], pieceCid: PieceCID, signal?: AbortSignal) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the wrong name, it's not a ping and we shouldn't export it as a ping, "locate", "find", "confirm", "check" are all better words. findPieceOnProviders(), locatePieceFromProviders(), something like that?

}
return false
},
{ concurrency: 5 }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to increase this to 10 to make the most of concurrency potential? Most users will hopefully have 2 or 3 SPs they deal with so it won't matter much, but some will have more so we're doing a hunting expedition here for one that has the piece.

* console.log(data)
* ```
*/
export async function downloadAndValidate(options: downloadAndValidate.OptionsType): Promise<Uint8Array> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to change this response type to a stream, but since we're starting from Promise<Uint8Array> in the sdk this is fine, but let's plan to make it the users's problem to deal with a stream in the future and we can ditch the accumulation in here

Copy link
Collaborator

@rvagg rvagg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving with some suggestions inline. The ping comment is more than a suggestion though, wrong word and I'd like to see that changed before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔎 Awaiting review

Development

Successfully merging this pull request may close these issues.

3 participants