Skip to content

sp

Service Provider HTTP Operations

import * as SP from '@filoz/synapse-core/sp'
Namespace Description
addPieces -
addPiecesApiRequest -
createDataSet -
createDataSetAndAddPieces -
createDataSetAndAddPiecesApiRequest -
createDataSetApiRequest -
createPieceBatcher -
deletePiece -
deletePieces -
findPiece -
getDataSet -
hasPiece -
isReachable -
ping -
prepareAddPieces -
prepareCreateDataSetAndAddPieces -
pullPieces -
pullPiecesApiRequest -
schedulePieceDeletion -
schedulePieceDeletions -
submitCommit -
terminateService -
terminateServiceApiRequest -
upload -
uploadPiece -
uploadPieces -
uploadPieceStreaming -
waitForAddPieces -
waitForCreateDataSet -
waitForCreateDataSetAddPieces -
waitForDeletePieces -
waitForFlushReceipt -
waitForPullPieces -
waitForPullPiecesApiRequest -
waitForSubmission -
waitForTerminateService -
Class Description
AbortError -
NetworkError -
TimeoutError -
Type Alias Description
AddPiecesCommit A signed add pieces commit from prepareAddPieces, ready for submitCommit.
BasePullPiecesOptions Base options for pulling pieces.
Commit A signed commit, saved before sending so it can be resubmitted or recovered after a crash.
CommitPiece One piece of a Commit, in JSON-safe form.
CreateDataSetAndAddPiecesCommit A signed create data set and add pieces commit from prepareCreateDataSetAndAddPieces, ready for submitCommit.
CreateDataSetAndAddPiecesOptions -
DataSet Data set from the PDP API.
EnqueuePiece -
FlushResult -
OnParked Called after the piece is on this SP, before it joins the addPieces window. The callback is awaited, so a thrown error keeps the piece out of the batch (retry with PieceBatcher.enqueue). PieceBatcher.close waits for it the same way it waits for park/pull I/O.
OnSubmitted Called once per flushed window, after the provider accepts the addPieces (or createDataSetAndAddPieces) call and before any piece promise of that window settles. It is awaited, so it can persist the record first.
PieceBatcher -
PieceBatcherWait When to flush a tumbling addPieces window (limiter overflow, flush(), and close() always flush regardless).
PieceResult -
PullInput -
PullPieceInput Input piece for a pull request with typed PieceCID.
PullPieceResult Status of one input piece, matched back to its position in the pieces input.
PullToExistingDataSetOptions Options for pulling pieces into an existing data set.
PullToNewDataSetOptions Options for creating a new data set and pulling pieces into it.
PullWaitOptions Options for waiting until a pull finishes, shared by waitForPullPiecesApiRequest and waitForPullPieces.
SubmittedBatch A flushed window that the provider accepted, before its transaction is confirmed.
SubmittedPiece One piece of a SubmittedBatch, in JSON-safe form.
TerminateServiceStatusPending -
TerminateServiceStatusResponse -
TerminateServiceStatusSuccess -
UploadInput -
UploadPieceStreamingData Data accepted by uploadPieceStreaming.
UploadResult -
Variable Description
DataSetSchema -
TerminateServiceStatusPendingSchema Schema for the termination status while the provider’s transaction is pending. The hash is empty until the provider’s relay task sends the transaction.
TerminateServiceStatusSuccessSchema Schema for the confirmed termination status. The hash may be empty when the service was already terminated on chain without a provider transaction.
Function Description
addPieces Add pieces to a data set
addPiecesApiRequest Add pieces to a data set on the PDP API.
createDataSet Create a data set
createDataSetAndAddPieces Create a data set and add pieces to it
createDataSetAndAddPiecesApiRequest Create a data set and add pieces to it on PDP API
createDataSetApiRequest Create a data set on PDP API
createPieceBatcher Create a stateful piece batcher that parks/pulls immediately and coalesces addPieces.
deletePiece Delete one piece from a data set on the PDP API.
deletePieces Delete pieces from a data set on the PDP API in one transaction.
findPiece Find a piece on the PDP API.
getDataSet Get a data set from the PDP API.
hasPiece Check whether a provider has a piece.
isReachable Check whether a provider’s PDP API answers a ping.
ping Ping the PDP API. Resolves when the provider answers with a 2xx status.
prepareAddPieces Sign an add pieces commit and return it as JSON-safe data, without sending it.
prepareCreateDataSetAndAddPieces Sign a create data set and add pieces commit and return it as JSON-safe data, without sending it.
pullPieces Pull pieces from external storage providers into a data set.
pullPiecesApiRequest Initiate a piece pull request or get status of an existing one.
schedulePieceDeletion Schedule one piece deletion.
schedulePieceDeletions Schedule piece deletions in one transaction.
submitCommit Send a commit from prepareAddPieces or prepareCreateDataSetAndAddPieces to the PDP API.
terminateService Terminate a data set service via the service provider
terminateServiceApiRequest Request data set termination on the PDP API.
terminateServiceStatusUrl Build the termination status URL for a data set, pollable with waitForTerminateService. Useful for resuming tracking of a previously requested termination.
upload Upload multiple pieces to a data set on the PDP API.
uploadPiece Upload a piece to the PDP API.
uploadPieces Upload pieces to an existing data set and add them in one signed request.
uploadPieceStreaming Upload piece data using the 3-step CommP-last streaming protocol.
validateDeletePiecesBatch Validate a delete-pieces batch before signing or sending it.
waitForAddPieces Wait for an add pieces transaction on chain, following replace-by-fee replacements.
waitForCreateDataSet Wait for a create data set transaction on chain, following replace-by-fee replacements.
waitForCreateDataSetAddPieces Wait for a create data set and add pieces transaction on chain, following replace-by-fee replacements.
waitForDeletePieces Wait for a schedule piece deletions transaction on chain, following replace-by-fee replacements.
waitForFlushReceipt Wait for a flushed batch to land on chain and get its piece IDs.
waitForPullPieces Wait for pull pieces completion.
waitForPullPiecesApiRequest Wait for pull pieces completion API request.
waitForTerminateService Wait for the data set termination status.