Documentation
¶
Index ¶
- Constants
- Variables
- func AuctionToPbSummary(a *auctioneer.Auction) *pb.AuctionSummary
- func PublishMsgAuctionBidReceived(ctx context.Context, mb MsgBroker, a *pb.AuctionSummary, b *auctioneer.Bid) error
- func PublishMsgAuctionClosed(ctx context.Context, mb MsgBroker, au broker.ClosedAuction) error
- func PublishMsgAuctionProposalCidDelivered(ctx context.Context, mb MsgBroker, auctionID auction.ID, bidderID peer.ID, ...) error
- func PublishMsgAuctionStarted(ctx context.Context, mb MsgBroker, a *pb.AuctionSummary) error
- func PublishMsgAuctionWinnerAcked(ctx context.Context, mb MsgBroker, a *pb.AuctionSummary, b *auctioneer.Bid) error
- func PublishMsgAuctionWinnerSelected(ctx context.Context, mb MsgBroker, a *pb.AuctionSummary, b *auctioneer.Bid) error
- func PublishMsgBoostDealProposalAccepted(ctx context.Context, mb MsgBroker, sdID broker.BatchID, auctionID auction.ID, ...) error
- func PublishMsgDealProposalAccepted(ctx context.Context, mb MsgBroker, sdID broker.BatchID, auctionID auction.ID, ...) error
- func PublishMsgFinalizedDeal(ctx context.Context, mb MsgBroker, fd broker.FinalizedDeal) error
- func PublishMsgNewBatchCreated(ctx context.Context, mb MsgBroker, batchID broker.BatchID, batchCid cid.Cid, ...) error
- func PublishMsgNewBatchPrepared(ctx context.Context, mb MsgBroker, baID broker.BatchID, pieceCid cid.Cid, ...) error
- func PublishMsgReadyToAuction(ctx context.Context, mb MsgBroker, id auction.ID, BatchID broker.BatchID, ...) error
- func PublishMsgReadyToBatch(ctx context.Context, mb MsgBroker, dataCids []ReadyToBatchData) error
- func PublishMsgReadyToCreateDeals(ctx context.Context, mb MsgBroker, ads dealer.AuctionDeals) error
- func RegisterHandlers(mb MsgBroker, s interface{}, opts ...Option) error
- type AuctionClosedListener
- type AuctionEventsListener
- type BoostDealProposalAcceptedListener
- type DealProposalAcceptedListener
- type FinalizedDealListener
- type MsgBroker
- type NewBatchCreatedListener
- type NewBatchPreparedListener
- type OperationID
- type Option
- type ReadyToAuctionListener
- type ReadyToBatchData
- type ReadyToBatchListener
- type ReadyToCreateDealsListener
- type RegisterHandlerConfig
- type TopicHandler
- type TopicName
Constants ¶
const ( // NewBatchCreatedTopic is the topic name for new-batch-created messages. NewBatchCreatedTopic TopicName = "new-batch-created" // NewBatchPreparedTopic is the topic name for new-batch-prepared messages. NewBatchPreparedTopic = "new-batch-prepared" // ReadyToBatchTopic is the topic name for ready-to-batch messages. ReadyToBatchTopic = "ready-to-batch" // ReadyToCreateDealsTopic is the topic name for ready-to-create-deals messages. ReadyToCreateDealsTopic = "ready-to-create-deals" // FinalizedDealTopic is the topic name for finalized-deal messages. FinalizedDealTopic = "finalized-deal" // DealProposalAcceptedTopic is the topic name for deal-proposal-accepted messages. DealProposalAcceptedTopic = "deal-proposal-accepted" // BoostDealProposalAcceptedTopic is the topic name for boost-deal-proposal-accepted messages. BoostDealProposalAcceptedTopic = "boost-deal-proposal-accepted" // ReadyToAuctionTopic is the topic name for ready-to-auction messages. ReadyToAuctionTopic = "ready-to-auction" // AuctionClosedTopic is the topic name for auction-closed messages. AuctionClosedTopic = "auction-closed" // AuctionStartedTopic is the topic name for auction-started messages. AuctionStartedTopic = "auction-started" // AuctionBidReceivedTopic is the topic name for auction-bid-received messages. AuctionBidReceivedTopic = "auction-bid-received" // AuctionWinnerSelectedTopic is the topic name for auction-winner-selected messages. AuctionWinnerSelectedTopic = "auction-winner-selected" // AuctionWinnerAckedTopic is the topic name for auction-winner-acked messages. AuctionWinnerAckedTopic = "auction-winner-acked" // AuctionProposalCidDeliveredTopic is the topic name for auction-proposal-cid-delivered messages. AuctionProposalCidDeliveredTopic = "auction-proposal-cid-delivered" )
Variables ¶
var DefaultRegisterHandlerConfig = RegisterHandlerConfig{ AckDeadline: time.Second * 10, }
DefaultRegisterHandlerConfig is the default configuration for topic subscriptions.
Functions ¶
func AuctionToPbSummary ¶
func AuctionToPbSummary(a *auctioneer.Auction) *pb.AuctionSummary
AuctionToPbSummary converts auctioneer.Auction to pb.
func PublishMsgAuctionBidReceived ¶
func PublishMsgAuctionBidReceived(ctx context.Context, mb MsgBroker, a *pb.AuctionSummary, b *auctioneer.Bid) error
PublishMsgAuctionBidReceived .
func PublishMsgAuctionClosed ¶
PublishMsgAuctionClosed publishes a message to the auction-closed topic.
func PublishMsgAuctionProposalCidDelivered ¶
func PublishMsgAuctionProposalCidDelivered(ctx context.Context, mb MsgBroker, auctionID auction.ID, bidderID peer.ID, bidID auction.BidID, proposalCid cid.Cid, errorCause string) error
PublishMsgAuctionProposalCidDelivered .
func PublishMsgAuctionStarted ¶
PublishMsgAuctionStarted .
func PublishMsgAuctionWinnerAcked ¶
func PublishMsgAuctionWinnerAcked(ctx context.Context, mb MsgBroker, a *pb.AuctionSummary, b *auctioneer.Bid) error
PublishMsgAuctionWinnerAcked .
func PublishMsgAuctionWinnerSelected ¶
func PublishMsgAuctionWinnerSelected(ctx context.Context, mb MsgBroker, a *pb.AuctionSummary, b *auctioneer.Bid) error
PublishMsgAuctionWinnerSelected .
func PublishMsgBoostDealProposalAccepted ¶
func PublishMsgBoostDealProposalAccepted( ctx context.Context, mb MsgBroker, sdID broker.BatchID, auctionID auction.ID, bidID auction.BidID, storageProviderID string, dealUID string) error
PublishMsgBoostDealProposalAccepted publishes a message to the deal-proposal-accepted topic.
func PublishMsgDealProposalAccepted ¶
func PublishMsgDealProposalAccepted( ctx context.Context, mb MsgBroker, sdID broker.BatchID, auctionID auction.ID, bidID auction.BidID, storageProviderID string, propCid cid.Cid) error
PublishMsgDealProposalAccepted publishes a message to the deal-proposal-accepted topic.
func PublishMsgFinalizedDeal ¶
PublishMsgFinalizedDeal publishes a message to the finalized-deal topic.
func PublishMsgNewBatchCreated ¶
func PublishMsgNewBatchCreated( ctx context.Context, mb MsgBroker, batchID broker.BatchID, batchCid cid.Cid, batchSize int64, srIDs []broker.StorageRequestID, origin string, manifest []byte, carURL string) error
PublishMsgNewBatchCreated publishes a message to the new-batch-created topic.
func PublishMsgNewBatchPrepared ¶
func PublishMsgNewBatchPrepared( ctx context.Context, mb MsgBroker, baID broker.BatchID, pieceCid cid.Cid, pieceSize uint64) error
PublishMsgNewBatchPrepared publishes a message to the new-batch-prepared topic.
func PublishMsgReadyToAuction ¶
func PublishMsgReadyToAuction( ctx context.Context, mb MsgBroker, id auction.ID, BatchID broker.BatchID, payloadCid cid.Cid, dealSize uint64, dealDuration, dealReplication int, dealVerified bool, excludedStorageProviders []string, filEpochDeadline uint64, sources auction.Sources, clientAddress string, providers []address.Address) error
PublishMsgReadyToAuction publishes a message to the ready-to-auction topic.
func PublishMsgReadyToBatch ¶
func PublishMsgReadyToBatch(ctx context.Context, mb MsgBroker, dataCids []ReadyToBatchData) error
PublishMsgReadyToBatch publishes a message to the ready-to-batch topic.
func PublishMsgReadyToCreateDeals ¶
func PublishMsgReadyToCreateDeals( ctx context.Context, mb MsgBroker, ads dealer.AuctionDeals) error
PublishMsgReadyToCreateDeals publishes a message to the ready-to-create-deals topic.
func RegisterHandlers ¶
RegisterHandlers automatically calls mb.RegisterTopicHandler in the methods that s might satisfy on known XXXListener interfaces. This allows to automatically wire s to receive messages from topics of implemented handlers.
Types ¶
type AuctionClosedListener ¶
type AuctionClosedListener interface {
OnAuctionClosed(context.Context, OperationID, broker.ClosedAuction) error
}
AuctionClosedListener is a handler for auction-closed topic.
type AuctionEventsListener ¶
type AuctionEventsListener interface { OnAuctionStarted(context.Context, time.Time, *pb.AuctionSummary) OnAuctionBidReceived(context.Context, time.Time, *pb.AuctionSummary, *auctioneer.Bid) OnAuctionWinnerSelected(context.Context, time.Time, *pb.AuctionSummary, *auctioneer.Bid) OnAuctionWinnerAcked(context.Context, time.Time, *pb.AuctionSummary, *auctioneer.Bid) OnAuctionProposalCidDelivered(ctx context.Context, ts time.Time, auctionID, bidderID, bidID, proposalCid, errorCause string) AuctionClosedListener }
AuctionEventsListener is a handler for auction events related topics. Note that the methods do not return error, since the caller can do nothing if something happens on the consuming side.
type BoostDealProposalAcceptedListener ¶
type BoostDealProposalAcceptedListener interface {
OnBoostDealProposalAccepted(context.Context, auction.ID, auction.BidID, string) error
}
BoostDealProposalAcceptedListener is a handler for boost-deal-proposal-accepted topic.
type DealProposalAcceptedListener ¶
type DealProposalAcceptedListener interface {
OnDealProposalAccepted(context.Context, auction.ID, auction.BidID, cid.Cid) error
}
DealProposalAcceptedListener is a handler for deal-proposal-accepted topic.
type FinalizedDealListener ¶
type FinalizedDealListener interface {
OnFinalizedDeal(context.Context, OperationID, broker.FinalizedDeal) error
}
FinalizedDealListener is a handler for finalized-deal topic.
type MsgBroker ¶
type MsgBroker interface { // RegisterTopicHandler registers a handler to a topic, with a defined // subscription defined by the underlying implementation. Is highly recommended // to register handlers in a type-safe way using RegisterHandlers(). RegisterTopicHandler(topic TopicName, handler TopicHandler, opts ...Option) error // PublishMsg publishes a message to the desired topic. PublishMsg(ctx context.Context, topicName TopicName, data []byte) error }
MsgBroker is a message-broker for async message communication.
type NewBatchCreatedListener ¶
type NewBatchCreatedListener interface { OnNewBatchCreated( context.Context, broker.BatchID, cid.Cid, int64, []broker.StorageRequestID, string, []byte, *url.URL) error }
NewBatchCreatedListener is a handler for new-batch-created topic.
type NewBatchPreparedListener ¶
type NewBatchPreparedListener interface {
OnNewBatchPrepared(context.Context, broker.BatchID, broker.DataPreparationResult) error
}
NewBatchPreparedListener is a handler for new-batch-prepared topic.
type Option ¶
type Option func(*RegisterHandlerConfig) error
Option applies a configuration on RegisterHandlerConfig.
func WithACKDeadline ¶
WithACKDeadline configures the deadline for the message broker subscription. The duration can't be greater than 10min.
type ReadyToAuctionListener ¶
type ReadyToAuctionListener interface { OnReadyToAuction( ctx context.Context, id auction.ID, BatchID broker.BatchID, payloadCid cid.Cid, dealSize uint64, dealDuration uint64, dealReplication uint32, dealVerified bool, excludedStorageProviders []string, filEpochDeadline uint64, sources auction.Sources, clientAddress string, providers []string, ) error }
ReadyToAuctionListener is a handler for finalized-deal topic.
type ReadyToBatchData ¶
type ReadyToBatchData struct { StorageRequestID broker.StorageRequestID DataCid cid.Cid Origin string }
ReadyToBatchData contains storage request data information to be batched.
type ReadyToBatchListener ¶
type ReadyToBatchListener interface {
OnReadyToBatch(context.Context, OperationID, []ReadyToBatchData) error
}
ReadyToBatchListener is a handler for ready-to-batch topic.
type ReadyToCreateDealsListener ¶
type ReadyToCreateDealsListener interface {
OnReadyToCreateDeals(context.Context, dealer.AuctionDeals) error
}
ReadyToCreateDealsListener is a handler for ready-to-create-deals topic.
type RegisterHandlerConfig ¶
RegisterHandlerConfig contains configuration for topic subscriptions.
func ApplyRegisterHandlerOptions ¶
func ApplyRegisterHandlerOptions(opts ...Option) (RegisterHandlerConfig, error)
ApplyRegisterHandlerOptions applies a list of Option to the default configuration.
type TopicHandler ¶
TopicHandler is function that processes a received message. If no error is returned, the message will be automatically acked. If an error is returned, the message will be automatically nacked.