Skip to content

Conversation

Kubuxu
Copy link
Contributor

@Kubuxu Kubuxu commented Oct 7, 2025

Uses Curio PDP APIs to trigger piece deletion resolves #207

Uses Curio PDP APIs to trigger piece deletion resolves #207

Signed-off-by: Jakub Sztandera <[email protected]>
@github-project-automation github-project-automation bot moved this to 📌 Triage in FS Oct 7, 2025
Copy link

cloudflare-workers-and-pages bot commented Oct 7, 2025

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 f5709ad Commit Preview URL

Branch Preview URL
Oct 08 2025, 03:05 PM

@rjan90 rjan90 moved this from 📌 Triage to 🔎 Awaiting review in FS Oct 7, 2025
@Kubuxu
Copy link
Contributor Author

Kubuxu commented Oct 7, 2025

There are a few things I don't love about the implementation

  • fetching client dataset ID for every request
  • taking the first matching piece (there could be multiple)

@rjan90 rjan90 requested a review from rvagg October 7, 2025 16:24
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.

It'll do, I would assume that typically this isn't a common operation.

I also want to get away with asking the server for our piece list and use the contract instead (outlined here #249 (comment) but I realise from this that we still need piece ID).

@Kubuxu can you see a good reason why we validate on clientDataSetId and not just dataSetId? Would it be terrible if we just switched in the contract because event there we have indirection when we validate.

@github-project-automation github-project-automation bot moved this from 🔎 Awaiting review to ✔️ Approved by reviewer in FS Oct 8, 2025
@rvagg
Copy link
Collaborator

rvagg commented Oct 8, 2025

Opened #286 to deal with the extra call, I think we can make this nicer by just storing a copy of clientDataSetId when we have it on context creation. It's also used in AddPieces and we have another dedicated call for it then, although at least in that case we can do it in parallel with 3 other calls.

* @param pieceCid - The PieceCID identifier
* @returns Transaction hash of the delete operation
*/
async deletePiece(pieceCid: string | PieceCID): Promise<string> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

hey, this could be:

Suggested change
async deletePiece(pieceCid: string | PieceCID): Promise<string> {
async deletePiece(piece: string | PieceCID | number): Promise<string> {

and if it's a number then we skip the pieceId look-up and just use that.

Then, if we do #249 (comment) and expose a getPieces(): AsyncGenerator<{ cid: PieceCID, id: number }> on the context, the user can be in charge of choosing which piece to delete and if there's duplicates they can pinpoint exactly which one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, I've implemented accepting the pieceID

@rvagg
Copy link
Collaborator

rvagg commented Oct 8, 2025

cool, lgtm sans that private

@Kubuxu Kubuxu merged commit ac946dc into master Oct 8, 2025
7 of 8 checks passed
@Kubuxu Kubuxu deleted the feat/piece-delete branch October 8, 2025 15:01
@github-project-automation github-project-automation bot moved this from ✔️ Approved by reviewer to 🎉 Done in FS Oct 8, 2025
rvagg added a commit that referenced this pull request Oct 14, 2025
* feat: add piece deletion to storage context

Uses Curio PDP APIs to trigger piece deletion resolves #207

Signed-off-by: Jakub Sztandera <[email protected]>

* feat(delete): allow deletion of pieces by the pieceID

Signed-off-by: Jakub Sztandera <[email protected]>

* Update packages/synapse-sdk/src/storage/context.ts

Co-authored-by: Rod Vagg <[email protected]>

---------

Signed-off-by: Jakub Sztandera <[email protected]>
Co-authored-by: Rod Vagg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

Allow client to delete a piece

3 participants