Documentation ¶
Index ¶
- Variables
- type AuctionFilters
- type BidParams
- type CommChannel
- type Config
- type Libp2pPubsub
- func (ps *Libp2pPubsub) Close() error
- func (ps *Libp2pPubsub) ID() core.ID
- func (ps *Libp2pPubsub) Info() (*peer.Info, error)
- func (ps *Libp2pPubsub) PublishBid(ctx context.Context, topicName string, bid *pb.Bid) ([]byte, error)
- func (ps *Libp2pPubsub) PublishBidbotEvent(ctx context.Context, event *pb.BidbotEvent)
- func (ps *Libp2pPubsub) Subscribe(bootstrap bool, h MessageHandler) error
- type MessageHandler
- type MinMaxFilter
- type Service
- func (s *Service) AuctionsHandler(from core.ID, a *pb.Auction) error
- func (s *Service) Close() error
- func (s *Service) GetBid(id auction.BidID) (*bidstore.Bid, error)
- func (s *Service) ListBids(query bidstore.Query) ([]*bidstore.Bid, error)
- func (s *Service) PeerInfo() (*peer.Info, error)
- func (s *Service) ProposalsHandler(prop *pb.WinningBidProposal) error
- func (s *Service) SetPaused(paused bool)
- func (s *Service) Subscribe(bootstrap bool) error
- func (s *Service) WinsHandler(wb *pb.WinningBid) error
- func (s *Service) WriteDataURI(payloadCid, uri string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ( // BidsExpiration is the duration to wait for a proposal CID after // which bidbot will consider itself not winning in an auction, so the // resources can be freed up. BidsExpiration = 10 * time.Minute )
Functions ¶
This section is empty.
Types ¶
type AuctionFilters ¶
type AuctionFilters struct { // DealDuration sets the min and max deal duration to bid on. DealDuration MinMaxFilter // DealSize sets the min and max deal size to bid on. DealSize MinMaxFilter }
AuctionFilters specifies filters used when selecting auctions to bid on.
func (*AuctionFilters) Validate ¶
func (f *AuctionFilters) Validate() error
Validate ensures AuctionFilters are valid.
type BidParams ¶
type BidParams struct { // StorageProviderID is your Filecoin StorageProvider ID used to make deals. StorageProviderID string // WalletAddrSig is a signature from your owner Lotus wallet address used to authenticate bids. WalletAddrSig []byte // AskPrice in attoFIL per GiB per epoch. AskPrice int64 // VerifiedAskPrice in attoFIL per GiB per epoch. VerifiedAskPrice int64 // FastRetrieval is whether or not you're offering fast retrieval for the deal data. FastRetrieval bool // DealStartWindow is the number of epochs after which won deals must start be on-chain. DealStartWindow uint64 // DealDataDirectory is the directory to which deal data will be written. DealDataDirectory string // DealDataFetchAttempts is the number of times fetching deal data cid will be attempted. DealDataFetchAttempts uint32 // DealDataFetchTimeout is the timeout fetching deal data cid. DealDataFetchTimeout time.Duration // DiscardOrphanDealsAfter is the time after which deals with no progress will be removed. DiscardOrphanDealsAfter time.Duration }
BidParams defines how bids are made.
type CommChannel ¶ added in v0.1.2
type CommChannel interface { Subscribe(bootstrap bool, eh MessageHandler) error Close() error ID() core.ID Info() (*peer.Info, error) PublishBid(ctx context.Context, topicName string, bid *pb.Bid) ([]byte, error) PublishBidbotEvent(ctx context.Context, event *pb.BidbotEvent) }
CommChannel represents the communication channel with auctioneer.
type Config ¶
type Config struct { Peer peer.Config BidParams BidParams AuctionFilters AuctionFilters BytesLimiter limiter.Limiter ConcurrentImports int BoostDownload bool SealingSectorsLimit int PricingRules pricing.PricingRules PricingRulesStrict bool }
Config defines params for Service configuration.
type Libp2pPubsub ¶ added in v0.1.2
type Libp2pPubsub struct {
// contains filtered or unexported fields
}
Libp2pPubsub communicates with auctioneer via libp2p pubsub.
func NewLibp2pPubsub ¶ added in v0.1.2
NewLibp2pPubsub creates a communication channel backed by libp2p pubsub.
func (*Libp2pPubsub) Close ¶ added in v0.1.2
func (ps *Libp2pPubsub) Close() error
Close closes the communication channel.
func (*Libp2pPubsub) ID ¶ added in v0.1.2
func (ps *Libp2pPubsub) ID() core.ID
ID returns the peer ID of the channel.
func (*Libp2pPubsub) Info ¶ added in v0.1.2
func (ps *Libp2pPubsub) Info() (*peer.Info, error)
Info returns the peer Info of the channel.
func (*Libp2pPubsub) PublishBid ¶ added in v0.1.2
func (ps *Libp2pPubsub) PublishBid(ctx context.Context, topicName string, bid *pb.Bid) ([]byte, error)
PublishBid publishes the bid to the given topic name.
func (*Libp2pPubsub) PublishBidbotEvent ¶ added in v0.1.2
func (ps *Libp2pPubsub) PublishBidbotEvent(ctx context.Context, event *pb.BidbotEvent)
PublishBidbotEvent publishes the given event.
func (*Libp2pPubsub) Subscribe ¶ added in v0.1.2
func (ps *Libp2pPubsub) Subscribe(bootstrap bool, h MessageHandler) error
Subscribe subcribes several topics published by autioneer and forwards the messages to the handler.
type MessageHandler ¶ added in v0.1.2
type MessageHandler interface { AuctionsHandler(core.ID, *pb.Auction) error WinsHandler(*pb.WinningBid) error ProposalsHandler(*pb.WinningBidProposal) error }
MessageHandler handles messages from auctioneer.
type MinMaxFilter ¶
MinMaxFilter is used to specify a range for an auction filter.
func (*MinMaxFilter) Validate ¶
func (f *MinMaxFilter) Validate() error
Validate ensures the filter is a valid min max window.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a miner service that subscribes to auctions.
func New ¶
func New( conf Config, store txndswrap.TxnDatastore, lc lotusclient.LotusClient, fc filclient.FilClient, ) (*Service, error)
New returns a new Service.
func (*Service) AuctionsHandler ¶ added in v0.1.2
AuctionsHandler implements MessageHandler.
func (*Service) ProposalsHandler ¶ added in v0.1.2
func (s *Service) ProposalsHandler(prop *pb.WinningBidProposal) error
ProposalsHandler implements MessageHandler.
func (*Service) SetPaused ¶ added in v0.1.4
SetPaused sets the service state to pause bidding or not.
func (*Service) Subscribe ¶
Subscribe to the deal auction feed. Upon success, it reports basic bidbot information to auctioneer after some delay. If bootstrap is true, the peer will dial the configured bootstrap addresses before joining the deal auction feed.
func (*Service) WinsHandler ¶ added in v0.1.2
func (s *Service) WinsHandler(wb *pb.WinningBid) error
WinsHandler implements MessageHandler.