service

package
v0.1.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2022 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

func (*BidParams) Validate

func (p *BidParams) Validate() error

Validate ensures BidParams are valid.

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
	ChunkedDownload     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

func NewLibp2pPubsub(ctx context.Context, conf peer.Config) (*Libp2pPubsub, error)

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(context.Context, *pb.WinningBid) error
	ProposalsHandler(context.Context, *pb.WinningBidProposal) error
}

MessageHandler handles messages from auctioneer.

type MinMaxFilter

type MinMaxFilter struct {
	Min uint64
	Max uint64
}

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

New returns a new Service.

func (*Service) AuctionsHandler added in v0.1.2

func (s *Service) AuctionsHandler(from core.ID, a *pb.Auction) error

AuctionsHandler implements MessageHandler.

func (*Service) Close

func (s *Service) Close() error

Close the service.

func (*Service) GetBid

func (s *Service) GetBid(ctx context.Context, id auction.BidID) (*bidstore.Bid, error)

GetBid gets the bid with specific ID.

func (*Service) ListBids

func (s *Service) ListBids(query bidstore.Query) ([]*bidstore.Bid, error)

ListBids lists bids by applying a store.Query.

func (*Service) PeerInfo

func (s *Service) PeerInfo() (*peer.Info, error)

PeerInfo returns the public information of the market peer.

func (*Service) ProposalsHandler added in v0.1.2

func (s *Service) ProposalsHandler(ctx context.Context, prop *pb.WinningBidProposal) error

ProposalsHandler implements MessageHandler.

func (*Service) SetPaused added in v0.1.4

func (s *Service) SetPaused(paused bool)

SetPaused sets the service state to pause bidding or not.

func (*Service) Subscribe

func (s *Service) Subscribe(bootstrap bool) error

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(ctx context.Context, wb *pb.WinningBid) error

WinsHandler implements MessageHandler.

func (*Service) WriteDataURI

func (s *Service) WriteDataURI(payloadCid, uri string) (string, error)

WriteDataURI writes a data uri resource to the configured deal data directory.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL