Documentation
¶
Index ¶
- Variables
- func IsDataSetServiceEnded(err error) bool
- func IsDataSetWriteBlocked(err error) bool
- func IsNoProviderCandidates(err error) bool
- func IsProviderCandidateWait(err error) bool
- func IsProviderUnavailable(err error) bool
- func IsTerminationBlocked(err error) bool
- func LegacyPieceStorageIDLimit(network string) uint64
- func NewApprovedProviderCatalog(chain cleanupChainCaller, view common.Address) (*approvedProviderCatalog, error)
- func NewClient(ctx context.Context, cfg ClientConfig) (*sdk.Client, error)
- func NewProviderHTTPClient(timeout time.Duration, allowPrivate bool) *http.Client
- func NormalizeProviderOperationError(ctx context.Context, err error) error
- func ValidateNetworkChainID(network string, actual int64) error
- func ValidateWalletSubmission(identity walletoperation.ExecutionIdentity, ...) error
- type ChainEpochReader
- type CleanupContext
- type CleanupPieceState
- type CleanupPieceStatus
- type CleanupPiecesState
- type ClientConfig
- type ClientNonceState
- type CommitNonceReader
- type CommitRejection
- type DataSetCreationStatusInput
- type DataSetServiceEndedError
- type DataSetTarget
- type NoProviderCandidatesError
- type PDPBatchUploadProbe
- type PDPStatusChecker
- type PDPStatusCheckerOptions
- type PDPStatusResult
- type PDPStatusState
- type ParkedPieceChecker
- type ParkedPieceState
- type PaymentAccountInfo
- type ProviderInventory
- type ProviderPiecesState
- type ProviderTarget
- type ProviderUnavailableError
- type PullErrorDisposition
- type ReadinessCheck
- type ReadinessChecker
- type ReadinessCheckerOption
- type ReadinessClient
- type ReadinessClientFactory
- type ReadinessConfig
- type ReadinessMode
- type ReadinessResult
- type ReadinessStatus
- type RemovalChainReader
- type RemovalPreflight
- type RemovalProvingConfig
- type RemovalRejection
- type ServiceTerminator
- type StorageClient
- type StorageServiceAdapter
- func (s *StorageServiceAdapter) ConfigureCleanupChain(chain cleanupChainCaller) error
- func (s *StorageServiceAdapter) ConfigureProviderHTTPClient(allowPrivate bool)
- func (s *StorageServiceAdapter) ConfigureTerminationChain(chain terminationTransactionReader)
- func (s *StorageServiceAdapter) ContextIdentity() storage.ContextIdentity
- func (s *StorageServiceAdapter) DeletionStates(ctx context.Context, dataSetID sdktypes.BigInt, pieceIDs []sdktypes.BigInt) (CleanupPiecesState, error)
- func (s *StorageServiceAdapter) Download(ctx context.Context, pieceCID cid.Cid, opts *storage.DownloadOptions) (io.ReadCloser, error)
- func (s *StorageServiceAdapter) FindMatchingDataSet(ctx context.Context, providerID sdktypes.BigInt, metadata map[string]string, ...) (*storage.DataSetRef, error)
- func (s *StorageServiceAdapter) ObserveTermination(ctx context.Context, dataSetID sdktypes.BigInt, known TerminationResult) (*TerminationResult, bool, error)
- func (s *StorageServiceAdapter) ObserveTerminationDirect(ctx context.Context, dataSetID sdktypes.BigInt, known TerminationResult) (*TerminationResult, bool, error)
- func (s *StorageServiceAdapter) OpenCleanupContext(ctx context.Context, dataSetID sdktypes.BigInt, ...) (CleanupContext, error)
- func (s *StorageServiceAdapter) OpenDataSetTarget(ctx context.Context, dataSetID sdktypes.BigInt, ...) (DataSetTarget, error)
- func (s *StorageServiceAdapter) OpenProviderTarget(ctx context.Context, providerID sdktypes.BigInt, ...) (ProviderTarget, error)
- func (s *StorageServiceAdapter) PDPVerifierAddress() common.Address
- func (s *StorageServiceAdapter) PrepareUpload(ctx context.Context, dataSize uint64, targets []StorageTarget) (*sdkcosts.MultiContextCosts, error)
- func (s *StorageServiceAdapter) ProviderPiecesKnown(ctx context.Context, serviceURL string, dataSetID sdktypes.BigInt, ...) (ProviderPiecesState, error)
- func (s *StorageServiceAdapter) SelectUploadTargets(ctx context.Context, opts storage.SelectUploadContextsOptions) ([]StorageTarget, error)
- func (s *StorageServiceAdapter) SetTransferCounters(counters *observability.TransferCounters)
- func (s *StorageServiceAdapter) TerminateService(ctx context.Context, dataSetID sdktypes.BigInt, hooks TerminationHooks) (*TerminationResult, error)
- func (s *StorageServiceAdapter) TerminateServiceDirect(ctx context.Context, dataSetID sdktypes.BigInt, hooks TerminationHooks) (*TerminationResult, error)
- func (s *StorageServiceAdapter) VerifyServicePayer(ctx context.Context, dataSetID sdktypes.BigInt) error
- type StorageTarget
- type TerminationBlockedError
- type TerminationHooks
- type TerminationResult
- type WalletInfo
- type WalletOperator
- type WalletQuerier
- type WalletReplayClient
- type WalletSubmission
Constants ¶
This section is empty.
Variables ¶
var ( ErrStoreSessionMissing = errors.New("upload session is unavailable") ErrStoreSessionClaimed = errors.New("upload session is already claimed") ErrStoreSessionIncomplete = errors.New("upload session is incomplete") ErrStoreUploadTruncated = errors.New("upload ended before all bytes were sent") )
var ( ErrTerminationEvidenceConflict = errors.New("termination evidence conflicts with the saved transaction") ErrTerminationTransactionFailed = errors.New("termination transaction failed on chain") // ErrTerminationNotSent means no termination request or transaction left // the process during the failed call. ErrTerminationNotSent = errors.New("this termination request was not sent") // ErrTerminationTransactionNotSent means the payer wallet broadcast no // termination transaction, although a provider relay request may have left. ErrTerminationTransactionNotSent = errors.New("the payer wallet sent no termination transaction; the provider may still terminate the data set") // ErrTerminationRequestAbsent means the provider holds no client termination // request for a data set whose service the chain shows still running. ErrTerminationRequestAbsent = errors.New("provider has no termination request") )
var ( ErrWalletReplayInvalidEvidence = errors.New("could not verify the saved wallet transaction") ErrWalletReplaySkipped = errors.New("wallet transaction replay skipped") ErrWalletReplayBroadcast = errors.New("wallet transaction replay broadcast failed") // ErrWalletTransactionDisplaced means a finalized transaction used the saved // transaction's nonce, so it can never land. What that transaction did is unknown. ErrWalletTransactionDisplaced = errors.New("wallet transaction nonce was used by another transaction") // ErrWalletPermitExpired means the saved transaction's permit expired before // the finalized block, so it cannot succeed in any later block. ErrWalletPermitExpired = errors.New("wallet transaction permit expired") )
var ErrProviderTransactionRejected = pdp.ErrTxRejected
ErrProviderTransactionRejected is the adapter-level identity for a provider transaction that reached a terminal rejected state.
var ErrServicePaidByAnother = errors.New("data set is paid for by another wallet")
ErrServicePaidByAnother means the chain records the data set as paid for by a wallet other than the one signing. Under this configuration its number names someone else's service, so it is never terminated; an operator has to put the original wallet or network back.
ErrTerminationObservationUnavailable identifies an unavailable provider status read. A failed lookup is neither evidence that an earlier transaction is absent nor permission to resend it. First-request fallback requires no historical submission evidence.
Functions ¶
func IsDataSetServiceEnded ¶
func IsDataSetWriteBlocked ¶
IsDataSetWriteBlocked reports whether err means the data set can no longer accept writes because its PDP payment ended. The SDK raises it while validating the data set, before the provider is contacted, so a commit that fails this way never reached the provider.
func IsNoProviderCandidates ¶
func IsProviderCandidateWait ¶
IsProviderCandidateWait identifies an empty selection without a failed probe.
func IsProviderUnavailable ¶
func IsTerminationBlocked ¶
IsTerminationBlocked reports whether termination needs operator action rather than another attempt.
func LegacyPieceStorageIDLimit ¶
LegacyPieceStorageIDLimit returns the first data set ID of the network's compact piece layout, or zero for a network without one.
func NewApprovedProviderCatalog ¶
func NewApprovedProviderCatalog(chain cleanupChainCaller, view common.Address) (*approvedProviderCatalog, error)
NewApprovedProviderCatalog reads every page of the approved list at one chain block.
func NewProviderHTTPClient ¶
NewProviderHTTPClient applies the configured provider URL policy to HTTP requests.
func NormalizeProviderOperationError ¶
NormalizeProviderOperationError classifies failures from a known provider endpoint. Callers must not use it for chain RPC or mixed resolution work.
func ValidateNetworkChainID ¶
func ValidateWalletSubmission ¶
func ValidateWalletSubmission(identity walletoperation.ExecutionIdentity, operationType model.WalletOperationType, amount *big.Int, submission WalletSubmission) error
ValidateWalletSubmission checks frozen identity and transaction intent without RPC calls.
Types ¶
type ChainEpochReader ¶
ChainEpochReader observes the chain head. Replacement uses it to decide when a terminated service has genuinely ended.
func NewChainEpochReader ¶
func NewChainEpochReader(source blockNumberSource) ChainEpochReader
NewChainEpochReader reads the epoch from the chain head.
The wall-clock estimate available elsewhere in the SDK derives an epoch from genesis time and can run ahead of the chain, which would let a replacement retire a source before its service has really ended. Retirement therefore only trusts an observed block number.
type CleanupContext ¶
type CleanupContext interface {
DeletePiecesByID(context.Context, []sdktypes.BigInt) (*sdktypes.WriteResult, error)
}
CleanupContext abstracts the SDK operations needed to remove PDP pieces.
type CleanupPieceState ¶
type CleanupPieceState struct {
Status CleanupPieceStatus
BlockNumber uint64
}
CleanupPieceState is an observation of one exact on-chain piece at one block.
type CleanupPieceStatus ¶
type CleanupPieceStatus string
const ( CleanupPiecePresent CleanupPieceStatus = "present" CleanupPieceScheduled CleanupPieceStatus = "scheduled" CleanupPieceDataSetCleanup CleanupPieceStatus = "dataset_cleanup" CleanupPieceRemoved CleanupPieceStatus = "removed" )
type CleanupPiecesState ¶ added in v0.1.1
type CleanupPiecesState struct {
Pieces map[string]CleanupPieceStatus
QueueLength int
BlockNumber uint64
VerifierVersion string
}
CleanupPiecesState contains one block's observations, keyed by decimal piece ID.
type ClientConfig ¶
type ClientConfig struct {
PrivateKey string
RPCURL string
WithCDN bool
AllowPrivateNetworks bool
Logger *slog.Logger
}
ClientConfig contains SynapS3 runtime settings forwarded into synapse-go.
type ClientNonceState ¶
type ClientNonceState struct {
Consumed bool
DataSetID sdktypes.BigInt
NextPieceID sdktypes.BigInt
}
ClientNonceState is what FWSS recorded for one add-pieces nonce. Once the pieces it signed are added, the nonce stays consumed and names the data set they joined and the piece ID that data set will assign next.
func (ClientNonceState) PieceIDs ¶
func (s ClientNonceState) PieceIDs(count int) ([]sdktypes.BigInt, error)
PieceIDs returns the IDs a consumed nonce assigned to count pieces. PDPVerifier numbers the pieces of one request consecutively from firstAdded, and FWSS piecesAdded records firstAdded + count as the next piece ID, so they end at NextPieceID-1.
type CommitNonceReader ¶
type CommitNonceReader interface {
// ClientNonce reports what FWSS recorded for a nonce this node's payer
// signed.
ClientNonce(ctx context.Context, nonce sdktypes.BigInt) (ClientNonceState, error)
// PieceCIDAt returns the piece CID a data set holds at a piece ID, or
// cid.Undef when none is there.
PieceCIDAt(ctx context.Context, dataSetID, pieceID sdktypes.BigInt) (cid.Cid, error)
}
CommitNonceReader reads the chain record that settles whether a signed add-pieces request was added, without scanning blocks or event logs.
func NewCommitNonceReader ¶
func NewCommitNonceReader(chain viewCaller, view, verifier, payer common.Address) (CommitNonceReader, error)
NewCommitNonceReader reads nonces payer signed from the FWSS view contract and piece identities from PDPVerifier.
type CommitRejection ¶
type CommitRejection uint8
CommitRejection classifies a SubmitCommit failure the provider answered with a 4xx status.
const ( CommitNotRejected CommitRejection = iota // data set (404) or reports it terminated (409). CommitRejectedDataSetUnavailable // CommitRejectedByProvider covers every other 4xx, including a piece the // provider no longer holds and rate limiting. CommitRejectedByProvider )
func ClassifyCommitRejection ¶
func ClassifyCommitRejection(err error) CommitRejection
ClassifyCommitRejection reports whether a SubmitCommit error is a provider 4xx. AddPieces is the only provider call SubmitCommit makes, and Curio answers every 4xx from it before sending a transaction, so a rejected submission never reached the chain.
type DataSetServiceEndedError ¶
type DataSetServiceEndedError struct {
Cause error
}
DataSetServiceEndedError reports typed evidence that an established data set no longer represents a writable service.
func (*DataSetServiceEndedError) Error ¶
func (e *DataSetServiceEndedError) Error() string
func (*DataSetServiceEndedError) Unwrap ¶
func (e *DataSetServiceEndedError) Unwrap() error
type DataSetTarget ¶
type DataSetTarget interface {
StorageTarget
ContextIdentity() storage.ContextIdentity
CreateStoreSession(ctx context.Context) (string, error)
UploadStoreSession(ctx context.Context, serviceURL, sessionID string, reader io.Reader, opts *storage.StoreOptions) (*storage.StoreResult, error)
FinalizeStoreSession(ctx context.Context, serviceURL, sessionID string, pieceCID cid.Cid) error
PresignForCommit(context.Context, []storage.PieceInput) ([]byte, error)
SubmitPull(context.Context, storage.PullRequest) (*storage.PullResult, error)
SubmitCommit(context.Context, storage.CommitRequest) (*storage.CommitSubmission, error)
GetCommitStatus(context.Context, string) (*storage.CommitStatus, error)
PieceStatus(context.Context, cid.Cid) (*storage.PieceStatus, error)
// CheckWritable reads the data set's chain state and reports whether it
// still accepts new pieces. It contacts no provider.
CheckWritable(context.Context) error
}
DataSetTarget is an immutable existing data set used for piece operations.
type NoProviderCandidatesError ¶
type NoProviderCandidatesError struct {
Cause error
}
NoProviderCandidatesError reports that automatic selection cannot currently satisfy a newly authorized replica slot.
func (*NoProviderCandidatesError) Error ¶
func (e *NoProviderCandidatesError) Error() string
func (*NoProviderCandidatesError) Unwrap ¶
func (e *NoProviderCandidatesError) Unwrap() error
type PDPBatchUploadProbe ¶
type PDPBatchUploadProbe struct {
// contains filtered or unexported fields
}
func NewPDPBatchUploadProbe ¶
func NewPDPBatchUploadProbe(allowPrivate bool) *PDPBatchUploadProbe
func (*PDPBatchUploadProbe) Probe ¶
func (p *PDPBatchUploadProbe) Probe(ctx context.Context, serviceURL string) (providerbenchmark.Measurement, error)
Probe measures only the PUT phase; the upload session is intentionally not finalized.
type PDPStatusChecker ¶
type PDPStatusChecker struct {
// contains filtered or unexported fields
}
func NewPDPStatusChecker ¶
func NewPDPStatusChecker(opts PDPStatusCheckerOptions) *PDPStatusChecker
func (*PDPStatusChecker) CheckDataSetCreationStatus ¶
func (c *PDPStatusChecker) CheckDataSetCreationStatus(ctx context.Context, input DataSetCreationStatusInput) PDPStatusResult
func (*PDPStatusChecker) FindParkedPiece ¶
func (c *PDPStatusChecker) FindParkedPiece(ctx context.Context, serviceURL string, pieceCID cid.Cid) (ParkedPieceState, error)
FindParkedPiece checks the provider-local piece endpoint once. Its client uses the same redirect, DNS, and private-network protections as status polling.
type PDPStatusCheckerOptions ¶
type PDPStatusResult ¶
type PDPStatusState ¶
type PDPStatusState string
const ( PDPStatusPending PDPStatusState = "pending" PDPStatusConfirmed PDPStatusState = "confirmed" PDPStatusRejected PDPStatusState = "rejected" PDPStatusMismatch PDPStatusState = "mismatch" PDPStatusUnknown PDPStatusState = "unknown" )
type ParkedPieceChecker ¶
type ParkedPieceChecker interface {
FindParkedPiece(context.Context, string, cid.Cid) (ParkedPieceState, error)
}
ParkedPieceChecker observes the provider's parked-piece endpoint without treating an on-chain lookup as evidence that an upload did not happen.
type ParkedPieceState ¶
type ParkedPieceState string
ParkedPieceState describes the provider-local state of a content-addressed piece before it has been committed on chain.
const ( ParkedPieceMissing ParkedPieceState = "missing" ParkedPieceProcessing ParkedPieceState = "processing" ParkedPieceReady ParkedPieceState = "parked" )
type PaymentAccountInfo ¶
type PaymentAccountInfo struct {
Funds *big.Int
AvailableFunds *big.Int
LockupCurrent *big.Int
LockupRate *big.Int
LockupLastSettledAt *big.Int
FundedUntilEpoch *big.Int
FundedUntilTime *time.Time
RunwaySeconds *int64
LockupRatePerDay *big.Int
LockupRatePerMonth *big.Int
NoActiveSpend bool
}
PaymentAccountInfo holds USDFC payment contract account state.
type ProviderInventory ¶
type ProviderPiecesState ¶ added in v0.1.1
type ProviderPiecesState struct {
Known []sdktypes.BigInt
Unknown []sdktypes.BigInt
Errors map[string]error
}
ProviderPiecesState separates explicit provider absence from failed observations.
type ProviderTarget ¶
type ProviderTarget interface {
StorageTarget
CreateDataSet(context.Context, *storage.CreateDataSetOptions) (*storage.CreateDataSetResult, error)
WaitForDataSetCreated(context.Context, string, sdktypes.BigInt) (*storage.CreateDataSetResult, error)
// ContextIdentity is the payer, chain, and record keeper the target signs
// for. Client data set IDs are only unique within it.
ContextIdentity() storage.ContextIdentity
// FindDataSetByClientDataSetID reads the chain for the data set a create
// request with this ID produced. Not found only means none is visible yet.
FindDataSetByClientDataSetID(context.Context, sdktypes.BigInt) (storage.DataSetRef, bool, error)
}
ProviderTarget is an unbound provider used to create or resume creation of a data set. Creating a data set does not mutate the target into a bound one.
type ProviderUnavailableError ¶
type ProviderUnavailableError struct {
}
ProviderUnavailableError reports a recoverable provider or transport dependency failure.
func (*ProviderUnavailableError) Error ¶
func (e *ProviderUnavailableError) Error() string
func (*ProviderUnavailableError) Unwrap ¶
func (e *ProviderUnavailableError) Unwrap() error
type PullErrorDisposition ¶
type PullErrorDisposition uint8
const ( PullErrorUnknown PullErrorDisposition = iota PullErrorRetryable PullErrorTerminal )
func ClassifyPullError ¶
func ClassifyPullError(err error) PullErrorDisposition
ClassifyPullError keeps SDK-specific pull failures at the adapter boundary. Provider and caller interruptions remain retryable; deterministic request or provider rejection errors are terminal. Unknown errors use the task's bounded retry budget so a newly introduced SDK error cannot create a permanent loop.
type ReadinessCheck ¶
type ReadinessCheck struct {
ID string `json:"id"`
Status ReadinessStatus `json:"status"`
Message string `json:"message"`
Action string `json:"action,omitempty"`
RequiredUSDFC string `json:"required_usdfc,omitempty"`
}
type ReadinessChecker ¶
type ReadinessChecker struct {
// contains filtered or unexported fields
}
func NewReadinessChecker ¶
func NewReadinessChecker(cfg ReadinessConfig, runtime ReadinessClient, opts ...ReadinessCheckerOption) *ReadinessChecker
func (*ReadinessChecker) CheckDraft ¶
func (c *ReadinessChecker) CheckDraft(ctx context.Context, cfg ReadinessConfig) ReadinessResult
func (*ReadinessChecker) CheckRuntime ¶
func (c *ReadinessChecker) CheckRuntime(ctx context.Context) ReadinessResult
type ReadinessCheckerOption ¶
type ReadinessCheckerOption func(*ReadinessChecker)
func WithReadinessClientFactory ¶
func WithReadinessClientFactory(factory ReadinessClientFactory) ReadinessCheckerOption
func WithReadinessLogger ¶
func WithReadinessLogger(logger *slog.Logger) ReadinessCheckerOption
func WithReadinessTimeout ¶
func WithReadinessTimeout(timeout time.Duration) ReadinessCheckerOption
type ReadinessClient ¶
type ReadinessClient interface {
ProviderInventory(context.Context, ReadinessConfig) (ProviderInventory, error)
Address() common.Address
Chain() chain.Chain
ResolvedAddresses() sdk.ResolvedAddresses
Payments() readinessPayments
Storage() readinessStorage
Close() error
}
func AdaptReadinessClient ¶
func AdaptReadinessClient(client *sdk.Client) ReadinessClient
type ReadinessClientFactory ¶
type ReadinessClientFactory func(context.Context, ReadinessConfig) (ReadinessClient, error)
type ReadinessConfig ¶
type ReadinessConfig struct {
Network string
RPCURL string
PrivateKey string
WithCDN bool
AllowPrivateNetworks bool
DefaultCopies int
AnchorProviderTier string
ProviderTimeout time.Duration
ProviderConcurrency int
}
func ReadinessConfigFromFilecoinConfig ¶
func ReadinessConfigFromFilecoinConfig(cfg config.FilecoinConfig) ReadinessConfig
type ReadinessMode ¶
type ReadinessMode string
const ( ReadinessModeRuntime ReadinessMode = "runtime" ReadinessModeDraft ReadinessMode = "draft" )
type ReadinessResult ¶
type ReadinessResult struct {
Status ReadinessStatus `json:"status"`
Mode ReadinessMode `json:"mode"`
CheckedAt time.Time `json:"checked_at"`
Checks []ReadinessCheck `json:"checks"`
PartialErrors map[string]string `json:"partial_errors,omitempty"`
// contains filtered or unexported fields
}
func (*ReadinessResult) Finish ¶
func (r *ReadinessResult) Finish()
Finish updates the aggregate readiness status from the contained checks.
type ReadinessStatus ¶
type ReadinessStatus string
const ( ReadinessStatusReady ReadinessStatus = "ready" ReadinessStatusWarning ReadinessStatus = "warning" ReadinessStatusBlocked ReadinessStatus = "blocked" ReadinessStatusUnknown ReadinessStatus = "unknown" )
type RemovalChainReader ¶ added in v0.1.1
type RemovalChainReader interface {
Preflight(context.Context, sdktypes.BigInt) (RemovalPreflight, error)
ProvingConfig(context.Context) (RemovalProvingConfig, error)
}
RemovalChainReader reads the service and payment conditions for a removal.
func NewRemovalChainReader ¶ added in v0.1.1
func NewRemovalChainReader(dataSets removalStorageReader, payerPayments removalPaymentsReader, identity storage.ContextIdentity, epochs ChainEpochReader) RemovalChainReader
type RemovalPreflight ¶ added in v0.1.1
type RemovalProvingConfig ¶ added in v0.1.1
type RemovalRejection ¶ added in v0.1.1
type RemovalRejection uint8
const ( RemovalNotRejected RemovalRejection = iota RemovalRejectedPieceNotFound RemovalRejectedByProvider )
func ClassifyRemovalRejection ¶ added in v0.1.1
func ClassifyRemovalRejection(err error) RemovalRejection
ClassifyRemovalRejection retains the distinction between an explicit refusal and an uncertain send. A refusal does not revoke an exposed removal signature.
type ServiceTerminator ¶
type ServiceTerminator interface {
PDPVerifierAddress() common.Address
// TerminateService wraps its error with ErrTerminationNotSent when nothing
// left the process, and with ErrTerminationTransactionNotSent when only a
// provider relay request may have.
TerminateService(ctx context.Context, dataSetID sdktypes.BigInt, hooks TerminationHooks) (*TerminationResult, error)
// VerifyServicePayer reads the data set's record and fails with
// ErrServicePaidByAnother when this wallet does not pay for it; any other
// error means the record could not be read. It sends nothing, so a caller can
// check before committing to a termination.
VerifyServicePayer(ctx context.Context, dataSetID sdktypes.BigInt) error
// ContextIdentity reports the payer, chain, and record keeper this
// terminator signs for, so a caller can tell that a recorded request was
// made under another one.
ContextIdentity() storage.ContextIdentity
}
ServiceTerminator is the destructive service-lifecycle boundary. It is used only after replacement cleanup authorization and the retirement safety gate have both passed.
type StorageClient ¶
type StorageClient interface {
ContextIdentity() storage.ContextIdentity
PDPVerifierAddress() common.Address
Download(ctx context.Context, pieceCID cid.Cid, opts *storage.DownloadOptions) (io.ReadCloser, error)
PrepareUpload(ctx context.Context, dataSize uint64, targets []StorageTarget) (*sdkcosts.MultiContextCosts, error)
SelectUploadTargets(ctx context.Context, opts storage.SelectUploadContextsOptions) ([]StorageTarget, error)
OpenProviderTarget(ctx context.Context, providerID sdktypes.BigInt, opts storage.NewProviderContextOptions) (ProviderTarget, error)
OpenDataSetTarget(ctx context.Context, dataSetID sdktypes.BigInt, opts storage.NewDataSetContextOptions) (DataSetTarget, error)
FindMatchingDataSet(ctx context.Context, providerID sdktypes.BigInt, metadata map[string]string, withCDN bool) (*storage.DataSetRef, error)
OpenCleanupContext(ctx context.Context, dataSetID sdktypes.BigInt, opts storage.NewDataSetContextOptions) (CleanupContext, error)
// DeletionStates reads exact piece or data-set cleanup evidence at one block.
// Removed data sets require the caller's recorded creation identity.
DeletionStates(ctx context.Context, dataSetID sdktypes.BigInt, pieceIDs []sdktypes.BigInt) (CleanupPiecesState, error)
ProviderPiecesKnown(ctx context.Context, serviceURL string, dataSetID sdktypes.BigInt, pieceIDs []sdktypes.BigInt) (ProviderPiecesState, error)
}
StorageClient abstracts the synapse-go storage service for download plus staged provider operations.
type StorageServiceAdapter ¶
type StorageServiceAdapter struct {
// contains filtered or unexported fields
}
StorageServiceAdapter adapts synapse-go's concrete immutable storage contexts to SynapS3's testable staged storage interface.
func AdaptStorageService ¶
func AdaptStorageService(service *storage.Service, dataSets *warmstorage.Service, identity storage.ContextIdentity) *StorageServiceAdapter
AdaptStorageService wraps the SDK storage service. dataSets reads the FWSS service state that termination checks before every request, and identity is what this service signs for: destructive requests refuse a record that belongs to another payer.
func (*StorageServiceAdapter) ConfigureCleanupChain ¶
func (s *StorageServiceAdapter) ConfigureCleanupChain(chain cleanupChainCaller) error
ConfigureCleanupChain uses the existing chain connection for exact piece and scheduled-removal reads during cleanup.
func (*StorageServiceAdapter) ConfigureProviderHTTPClient ¶
func (s *StorageServiceAdapter) ConfigureProviderHTTPClient(allowPrivate bool)
ConfigureProviderHTTPClient preserves the deployment URL policy for uploads.
func (*StorageServiceAdapter) ConfigureTerminationChain ¶
func (s *StorageServiceAdapter) ConfigureTerminationChain(chain terminationTransactionReader)
ConfigureTerminationChain uses the existing chain connection to observe saved transactions.
func (*StorageServiceAdapter) ContextIdentity ¶
func (s *StorageServiceAdapter) ContextIdentity() storage.ContextIdentity
ContextIdentity reports the payer, chain, and record keeper this service signs for.
func (*StorageServiceAdapter) DeletionStates ¶ added in v0.1.1
func (s *StorageServiceAdapter) DeletionStates(ctx context.Context, dataSetID sdktypes.BigInt, pieceIDs []sdktypes.BigInt) (CleanupPiecesState, error)
func (*StorageServiceAdapter) Download ¶
func (s *StorageServiceAdapter) Download(ctx context.Context, pieceCID cid.Cid, opts *storage.DownloadOptions) (io.ReadCloser, error)
func (*StorageServiceAdapter) FindMatchingDataSet ¶
func (*StorageServiceAdapter) ObserveTermination ¶
func (s *StorageServiceAdapter) ObserveTermination(ctx context.Context, dataSetID sdktypes.BigInt, known TerminationResult) (*TerminationResult, bool, error)
ObserveTermination reads chain and provider evidence without sending a request.
func (*StorageServiceAdapter) ObserveTerminationDirect ¶
func (s *StorageServiceAdapter) ObserveTerminationDirect(ctx context.Context, dataSetID sdktypes.BigInt, known TerminationResult) (*TerminationResult, bool, error)
ObserveTerminationDirect checks the admitted transaction without consulting a provider request that can still describe a preceding failed attempt or an unresolved relay.
func (*StorageServiceAdapter) OpenCleanupContext ¶
func (s *StorageServiceAdapter) OpenCleanupContext(ctx context.Context, dataSetID sdktypes.BigInt, opts storage.NewDataSetContextOptions) (CleanupContext, error)
func (*StorageServiceAdapter) OpenDataSetTarget ¶
func (s *StorageServiceAdapter) OpenDataSetTarget(ctx context.Context, dataSetID sdktypes.BigInt, opts storage.NewDataSetContextOptions) (DataSetTarget, error)
func (*StorageServiceAdapter) OpenProviderTarget ¶
func (s *StorageServiceAdapter) OpenProviderTarget(ctx context.Context, providerID sdktypes.BigInt, opts storage.NewProviderContextOptions) (ProviderTarget, error)
func (*StorageServiceAdapter) PDPVerifierAddress ¶
func (s *StorageServiceAdapter) PDPVerifierAddress() common.Address
func (*StorageServiceAdapter) PrepareUpload ¶
func (s *StorageServiceAdapter) PrepareUpload(ctx context.Context, dataSize uint64, targets []StorageTarget) (*sdkcosts.MultiContextCosts, error)
func (*StorageServiceAdapter) ProviderPiecesKnown ¶ added in v0.1.1
func (s *StorageServiceAdapter) ProviderPiecesKnown(ctx context.Context, serviceURL string, dataSetID sdktypes.BigInt, pieceIDs []sdktypes.BigInt) (ProviderPiecesState, error)
func (*StorageServiceAdapter) SelectUploadTargets ¶
func (s *StorageServiceAdapter) SelectUploadTargets(ctx context.Context, opts storage.SelectUploadContextsOptions) ([]StorageTarget, error)
func (*StorageServiceAdapter) SetTransferCounters ¶
func (s *StorageServiceAdapter) SetTransferCounters(counters *observability.TransferCounters)
func (*StorageServiceAdapter) TerminateService ¶
func (s *StorageServiceAdapter) TerminateService(ctx context.Context, dataSetID sdktypes.BigInt, hooks TerminationHooks) (*TerminationResult, error)
TerminateService is a destructive boundary used only after the retirement safety gate passes. It reads the payer-checked chain record before sending and records each transaction hash through hooks as soon as it is known. Direct fallback requires proof that the relay holds no request from this call.
func (*StorageServiceAdapter) TerminateServiceDirect ¶
func (s *StorageServiceAdapter) TerminateServiceDirect(ctx context.Context, dataSetID sdktypes.BigInt, hooks TerminationHooks) (*TerminationResult, error)
TerminateServiceDirect submits a fresh transaction after an operator authorized another paid attempt, after a reverted one or to complete one whose relayed request stayed unresolved.
func (*StorageServiceAdapter) VerifyServicePayer ¶
func (s *StorageServiceAdapter) VerifyServicePayer(ctx context.Context, dataSetID sdktypes.BigInt) error
VerifyServicePayer checks ownership without sending a transaction.
type StorageTarget ¶
type StorageTarget interface {
ProviderID() sdktypes.BigInt
DataSetRef() (storage.DataSetRef, bool)
GetProviderInfo() storage.Provider
CDNEnabled() bool
PieceURL(cid.Cid) string
ServiceURL() string
}
StorageTarget abstracts the immutable identity shared by provider and data set targets returned by synapse-go.
type TerminationBlockedError ¶
TerminationBlockedError means the service cannot be terminated until an operator resolves something the gateway must not decide on its own, such as settling outstanding payment debt. It is never retried automatically.
func (*TerminationBlockedError) Error ¶
func (e *TerminationBlockedError) Error() string
func (*TerminationBlockedError) Unwrap ¶
func (e *TerminationBlockedError) Unwrap() error
type TerminationHooks ¶ added in v0.1.1
type TerminationHooks struct {
// OnSubmitted receives a transaction hash as soon as one is known.
OnSubmitted func(hash string) error
// BeforeDirect runs before the payer wallet may broadcast a transaction. An
// error prevents the direct submission.
BeforeDirect func() error
}
TerminationHooks lets the caller persist termination progress synchronously.
type TerminationResult ¶
type TerminationResult struct {
TxHash string
ConfirmedTxHash string
ReceiptStatus *uint64
EndEpoch *int64
}
TerminationResult retains submission evidence and the verified service end, when known. A submitted transaction does not establish its end epoch.
type WalletInfo ¶
type WalletInfo struct {
Address string
Network string
ChainID int64
Nonce *uint64
CurrentEpoch *big.Int
EpochDurationSeconds int64
PaymentsAddress string
USDFCAddress string
USDFCDecimals uint8
FILGasBalance *big.Int
USDFCWalletBalance *big.Int
PaymentAccount *PaymentAccountInfo
Errors map[string]string
}
WalletInfo holds a snapshot of the wallet's on-chain state. Fields are nil when the corresponding RPC call failed; see Errors for details.
type WalletOperator ¶
type WalletOperator interface {
WalletIdentity() walletoperation.ExecutionIdentity
FundUSDFC(ctx context.Context, amount *big.Int) (WalletSubmission, error)
WithdrawUSDFC(ctx context.Context, amount *big.Int) (WalletSubmission, error)
ApproveFWSS(ctx context.Context) (WalletSubmission, error)
RebroadcastSignedTransaction(ctx context.Context, operationType model.WalletOperationType, amount *big.Int, submission WalletSubmission, observationTimeout time.Duration) error
}
WalletOperator broadcasts wallet payment transactions.
func NewWalletOperator ¶
func NewWalletOperator(paySvc *payments.Service, usdfc common.Address, identity walletoperation.ExecutionIdentity, replay WalletReplayClient) WalletOperator
type WalletQuerier ¶
type WalletQuerier interface {
WalletIdentity() walletoperation.ExecutionIdentity
GetWalletInfo(ctx context.Context) (*WalletInfo, error)
}
WalletQuerier provides on-chain wallet state for the admin dashboard.
func NewWalletQuerier ¶
func NewWalletQuerier(paySvc *payments.Service, address common.Address, c chain.Chain, addrs sdk.ResolvedAddresses) WalletQuerier
NewWalletQuerier creates a WalletQuerier backed by synapse-go payments.Service.
type WalletReplayClient ¶
type WalletReplayClient interface {
ChainID(context.Context) (*big.Int, error)
TransactionReceipt(context.Context, common.Hash) (*ethtypes.Receipt, error)
TransactionByHash(context.Context, common.Hash) (*ethtypes.Transaction, bool, error)
HeaderByNumber(context.Context, *big.Int) (*ethtypes.Header, error)
NonceAt(context.Context, common.Address, *big.Int) (uint64, error)
PendingNonceAt(context.Context, common.Address) (uint64, error)
SendTransaction(context.Context, *ethtypes.Transaction) error
}
WalletReplayClient observes and sends the exact transaction retained by the ledger.
type WalletSubmission ¶
type WalletSubmission struct {
TxHash string
SignedTransaction []byte
// NotSent reports SDK proof that this invocation did not send a transaction.
NotSent bool
}
WalletSubmission identifies one signed transaction, including when sending fails.
func WalletSubmissionFromWriteResult ¶
func WalletSubmissionFromWriteResult(res *sdktypes.WriteResult, err error, action string) (WalletSubmission, error)
WalletSubmissionFromWriteResult retains broadcast evidence and its error chain while keeping signed transaction bytes out of error messages.
Source Files
¶
- approved_providers.go
- cleanup_chain.go
- client.go
- commit_nonce.go
- config.go
- epochs.go
- interfaces.go
- pdp_status.go
- pdp_upload_probe.go
- provider_inventory.go
- provider_response.go
- readiness.go
- removal_chain.go
- removal_provider.go
- storage_client.go
- storage_errors.go
- store_session.go
- terminate.go
- wallet.go
- wallet_operator.go
- wallet_replay.go