Documentation
¶
Index ¶
- func NewClient(ctx context.Context, cfg ClientConfig) (*sdk.Client, error)
- type AddPiecesStatusInput
- type CleanupContext
- type ClientConfig
- type DataSetCreationStatusInput
- type PDPStatusChecker
- type PDPStatusCheckerOptions
- type PDPStatusResult
- type PDPStatusState
- type PaymentAccountInfo
- type ReadinessCheck
- type ReadinessChecker
- type ReadinessCheckerOption
- type ReadinessClient
- type ReadinessClientFactory
- type ReadinessConfig
- type ReadinessMode
- type ReadinessResult
- type ReadinessStatus
- type StorageClient
- type StorageServiceAdapter
- func (s *StorageServiceAdapter) CreateCleanupContext(ctx context.Context, opts *storage.CreateContextOptions) (CleanupContext, error)
- func (s *StorageServiceAdapter) CreateContext(ctx context.Context, opts *storage.CreateContextOptions) (UploadContext, error)
- func (s *StorageServiceAdapter) CreateContexts(ctx context.Context, opts *storage.CreateContextsOptions) ([]UploadContext, error)
- func (s *StorageServiceAdapter) Download(ctx context.Context, pieceCID cid.Cid, opts *storage.DownloadOptions) (io.ReadCloser, error)
- type UploadContext
- type WalletInfo
- type WalletOperator
- type WalletQuerier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddPiecesStatusInput ¶
type CleanupContext ¶
type CleanupContext interface {
DeletePieceByID(context.Context, sdktypes.BigInt) (*sdktypes.WriteResult, error)
PieceStatus(context.Context, cid.Cid) (*storage.PieceStatus, error)
}
CleanupContext abstracts the SDK operations needed to remove PDP pieces.
type ClientConfig ¶
type ClientConfig struct {
PrivateKey string
RPCURL string
Source string
WithCDN bool
AllowPrivateNetworks bool
Logger *slog.Logger
}
ClientConfig contains SynapS3 runtime settings forwarded into synapse-go.
type PDPStatusChecker ¶
type PDPStatusChecker struct {
// contains filtered or unexported fields
}
func NewPDPStatusChecker ¶
func NewPDPStatusChecker(opts PDPStatusCheckerOptions) *PDPStatusChecker
func (*PDPStatusChecker) CheckAddPiecesStatus ¶
func (c *PDPStatusChecker) CheckAddPiecesStatus(ctx context.Context, input AddPiecesStatusInput) PDPStatusResult
func (*PDPStatusChecker) CheckDataSetCreationStatus ¶
func (c *PDPStatusChecker) CheckDataSetCreationStatus(ctx context.Context, input DataSetCreationStatusInput) PDPStatusResult
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 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 ReadinessCheck ¶
type ReadinessCheck struct {
ID string `json:"id"`
Status ReadinessStatus `json:"status"`
Message string `json:"message"`
Action string `json:"action,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 {
Address() common.Address
Chain() chain.Chain
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
Source string
WithCDN bool
AllowPrivateNetworks bool
DefaultCopies 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"`
}
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 StorageClient ¶
type StorageClient interface {
Download(ctx context.Context, pieceCID cid.Cid, opts *storage.DownloadOptions) (io.ReadCloser, error)
CreateContexts(ctx context.Context, opts *storage.CreateContextsOptions) ([]UploadContext, error)
CreateContext(ctx context.Context, opts *storage.CreateContextOptions) (UploadContext, error)
CreateCleanupContext(ctx context.Context, opts *storage.CreateContextOptions) (CleanupContext, 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 storage service to SynapS3's testable staged storage interface. It exists because Go does not allow []*storage.Context to satisfy []UploadContext directly.
func AdaptStorageService ¶
func AdaptStorageService(service *storage.Service) *StorageServiceAdapter
func (*StorageServiceAdapter) CreateCleanupContext ¶
func (s *StorageServiceAdapter) CreateCleanupContext(ctx context.Context, opts *storage.CreateContextOptions) (CleanupContext, error)
func (*StorageServiceAdapter) CreateContext ¶
func (s *StorageServiceAdapter) CreateContext(ctx context.Context, opts *storage.CreateContextOptions) (UploadContext, error)
func (*StorageServiceAdapter) CreateContexts ¶
func (s *StorageServiceAdapter) CreateContexts(ctx context.Context, opts *storage.CreateContextsOptions) ([]UploadContext, error)
func (*StorageServiceAdapter) Download ¶
func (s *StorageServiceAdapter) Download(ctx context.Context, pieceCID cid.Cid, opts *storage.DownloadOptions) (io.ReadCloser, error)
type UploadContext ¶
type UploadContext interface {
ProviderID() sdktypes.BigInt
DataSetID() *sdktypes.BigInt
PieceURL(cid.Cid) string
ServiceURL() string
CreateDataSet(context.Context, *storage.CreateDataSetOptions) (*storage.CreateDataSetResult, error)
WaitForDataSetCreated(context.Context, storage.CreateDataSetSubmission) (*storage.CreateDataSetResult, error)
Store(context.Context, io.Reader, *storage.StoreOptions) (*storage.StoreResult, error)
PresignForCommit(context.Context, []storage.PieceInput) ([]byte, error)
Pull(context.Context, storage.PullRequest) (*storage.PullResult, error)
Commit(context.Context, storage.CommitRequest) (*storage.CommitResult, error)
}
UploadContext abstracts one provider-scoped SDK storage context.
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 {
FundUSDFC(ctx context.Context, amount *big.Int) (string, error)
WithdrawUSDFC(ctx context.Context, amount *big.Int) (string, error)
}
WalletOperator broadcasts wallet payment transactions.
func NewWalletOperator ¶
func NewWalletOperator(paySvc *payments.Service, c chain.Chain) WalletOperator
type WalletQuerier ¶
type WalletQuerier interface {
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) WalletQuerier
NewWalletQuerier creates a WalletQuerier backed by synapse-go payments.Service.