Documentation ¶
Index ¶
- Variables
- type Broker
- func (b *Broker) BatchAuctioned(ctx context.Context, opID msgbroker.OperationID, au broker.ClosedAuction) (err error)
- func (b *Broker) BatchFinalizedDeal(ctx context.Context, opID msgbroker.OperationID, fad broker.FinalizedDeal) (err error)
- func (b *Broker) Close() error
- func (b *Broker) Create(ctx context.Context, dataCid cid.Cid, origin string) (broker.StorageRequest, error)
- func (b *Broker) CreateNewBatch(ctx context.Context, batchID broker.BatchID, batchCid cid.Cid, batchSize int64, ...) (broker.BatchID, error)
- func (b *Broker) CreatePrepared(ctx context.Context, payloadCid cid.Cid, pc broker.PreparedCAR, ...) (sr broker.StorageRequest, err error)
- func (b *Broker) GetBatch(ctx context.Context, id broker.BatchID) (broker.Batch, error)
- func (b *Broker) GetStorageRequestInfo(ctx context.Context, srID broker.StorageRequestID) (broker.StorageRequestInfo, error)
- func (b *Broker) NewBatchPrepared(ctx context.Context, batchID broker.BatchID, dpr broker.DataPreparationResult) (err error)
- type Option
- func WithAuctionMaxRetries(max int) Option
- func WithDealDuration(duration uint64) Option
- func WithDealReplication(repFactor uint32) Option
- func WithDefaultBatchDeadline(duration time.Duration) Option
- func WithDefaultWalletAddress(walletAddress address.Address) Option
- func WithExportPinCountFrequency(freq time.Duration) Option
- func WithProposalStartOffset(duration time.Duration) Option
- func WithUnpinnerFrequency(freq time.Duration) Option
- func WithUnpinnerRetryDelay(delay time.Duration) Option
- func WithVerifiedDeals(verifiedDeals bool) Option
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned when the storage request doesn't exist. ErrNotFound = errors.New("storage request not found") // ErrInvalidCid is returned when the Cid is undefined. ErrInvalidCid = errors.New("the cid can't be undefined") // ErrEmptyGroup is returned when an empty batch group // is received. ErrEmptyGroup = errors.New("the batch group is empty") // ErrOperationIDExists indicates that the opeation already exists, // which basically means the function being called with the same data again. ErrOperationIDExists = errors.New("operation-id already exists") )
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker creates and tracks request to store Cids in the Filecoin network.
func New ¶
func New( postgresURI string, ipfsClient *httpapi.HttpApi, mb msgbroker.MsgBroker, opts ...Option, ) (*Broker, error)
New creates a new Broker.
func (*Broker) BatchAuctioned ¶
func (b *Broker) BatchAuctioned(ctx context.Context, opID msgbroker.OperationID, au broker.ClosedAuction) (err error)
BatchAuctioned is called by the Auctioneer with the result of the Batch auction.
func (*Broker) BatchFinalizedDeal ¶
func (b *Broker) BatchFinalizedDeal(ctx context.Context, opID msgbroker.OperationID, fad broker.FinalizedDeal) (err error)
BatchFinalizedDeal report a deal that reached final status in the Filecoin network.
func (*Broker) Create ¶
func (b *Broker) Create(ctx context.Context, dataCid cid.Cid, origin string) (broker.StorageRequest, error)
Create creates a new StorageRequest with the provided Cid and Metadata configuration.
func (*Broker) CreateNewBatch ¶
func (b *Broker) CreateNewBatch( ctx context.Context, batchID broker.BatchID, batchCid cid.Cid, batchSize int64, brIDs []broker.StorageRequestID, origin string, manifest []byte, carURL *url.URL) (broker.BatchID, error)
CreateNewBatch creates a Batch that contains multiple StorageRequest.
func (*Broker) CreatePrepared ¶
func (b *Broker) CreatePrepared( ctx context.Context, payloadCid cid.Cid, pc broker.PreparedCAR, meta broker.BatchMetadata, rw *broker.RemoteWallet) (sr broker.StorageRequest, err error)
CreatePrepared creates a storage request for prepared data.
func (*Broker) GetBatch ¶
GetBatch gets an existing batch. If the batch doesn't exists, it returns ErrNotFound.
func (*Broker) GetStorageRequestInfo ¶
func (b *Broker) GetStorageRequestInfo( ctx context.Context, srID broker.StorageRequestID) (broker.StorageRequestInfo, error)
GetStorageRequestInfo gets a StorageRequest by id. If doesn't exist, it returns ErrNotFound.
func (*Broker) NewBatchPrepared ¶
func (b *Broker) NewBatchPrepared( ctx context.Context, batchID broker.BatchID, dpr broker.DataPreparationResult, ) (err error)
NewBatchPrepared contains information of a prepared batch.
type Option ¶
type Option func(*config) error
Option provides configuration for Broker.
func WithAuctionMaxRetries ¶
WithAuctionMaxRetries indicates the maximum number of auctions that can be created for a batch.
func WithDealDuration ¶
WithDealDuration configures the default deal duration of new auctions.
func WithDealReplication ¶
WithDealReplication configures the default replication factor of new auctions.
func WithDefaultBatchDeadline ¶
WithDefaultBatchDeadline indicates the default duration a direct auction batch can be re-auctioned before erroring.
func WithDefaultWalletAddress ¶
func WithDefaultWalletAddress(walletAddress address.Address) Option
WithDefaultWalletAddress configures the default wallet address of new auctions.
func WithExportPinCountFrequency ¶
WithExportPinCountFrequency configures the frequency of exporting the pin count metric.
func WithProposalStartOffset ¶
WithProposalStartOffset indicates the default duration for DealStartEpoch from the current epoch if isn't provided by the client in the request.
func WithUnpinnerFrequency ¶
WithUnpinnerFrequency configures the frequency of the GC daemon.
func WithUnpinnerRetryDelay ¶
WithUnpinnerRetryDelay configures the default delay for failed unpin jobs to be retried.
func WithVerifiedDeals ¶
WithVerifiedDeals configures the default deal type in of new auctions.