salesman

package
v0.4.28 Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger        zap.SugaredLogger
	Storage       *state.Storage
	Resources     *resource.Scheduler
	Hardware      *hardware.Hardware
	Eth           blockchain.API
	CGroupManager cgroups.CGroupManager
	Matcher       matcher.Matcher
	Ethkey        *ecdsa.PrivateKey
	Config        YAMLConfig
}

type DealDestroyer added in v0.4.13

type DealDestroyer interface {
	CancelDealTasks(ctx context.Context, dealID *sonm.BigInt) error
}

type Option

type Option func(*options)

func WithCGroupManager

func WithCGroupManager(cGroupManager cgroups.CGroupManager) Option

func WithConfig

func WithConfig(config *YAMLConfig) Option

func WithDealDestroyer added in v0.4.13

func WithDealDestroyer(destroyer DealDestroyer) Option

func WithEth

func WithEth(eth blockchain.API) Option

func WithEthkey

func WithEthkey(ethkey *ecdsa.PrivateKey) Option

func WithHardware

func WithHardware(hardware *hardware.Hardware) Option

func WithLogger

func WithLogger(log *zap.SugaredLogger) Option

func WithMatcher

func WithMatcher(matcher matcher.Matcher) Option

func WithNetworkConfig added in v0.4.21

func WithNetworkConfig(cfg network.NetworkConfig) Option

func WithResources

func WithResources(resources *resource.Scheduler) Option

func WithStorage

func WithStorage(storage *state.Storage) Option

type Salesman

type Salesman struct {
	// contains filtered or unexported fields
}

func NewSalesman

func NewSalesman(ctx context.Context, opts ...Option) (*Salesman, error)

func (*Salesman) AskPlan

func (m *Salesman) AskPlan(planID string) (*sonm.AskPlan, error)

func (*Salesman) AskPlanByDeal

func (m *Salesman) AskPlanByDeal(dealID *sonm.BigInt) (*sonm.AskPlan, error)

func (*Salesman) AskPlans

func (m *Salesman) AskPlans() map[string]*sonm.AskPlan

func (*Salesman) CGroup

func (m *Salesman) CGroup(planID string) (cgroups.CGroup, error)

func (*Salesman) Close

func (m *Salesman) Close() error

func (*Salesman) CreateAskPlan

func (m *Salesman) CreateAskPlan(askPlan *sonm.AskPlan) (string, error)

func (*Salesman) Deal

func (m *Salesman) Deal(dealID *sonm.BigInt) (*sonm.Deal, error)

func (*Salesman) DebugDump

func (m *Salesman) DebugDump() *sonm.SalesmanData

func (*Salesman) Network added in v0.4.9

func (m *Salesman) Network(planID string) (*network.Network, error)

func (*Salesman) NextMaintenance

func (m *Salesman) NextMaintenance() time.Time

func (*Salesman) PurgeAskPlans added in v0.4.13

func (m *Salesman) PurgeAskPlans(ctx context.Context) (*sonm.ErrorByStringID, error)

func (*Salesman) RemoveAskPlan

func (m *Salesman) RemoveAskPlan(ctx context.Context, planID string) error

func (*Salesman) Run

func (m *Salesman) Run(ctx context.Context)

func (*Salesman) ScheduleMaintenance

func (m *Salesman) ScheduleMaintenance(timePoint time.Time) error

func (Salesman) Validate

func (m Salesman) Validate() error

type YAMLConfig

type YAMLConfig struct {
	RegularBillPeriod       time.Duration `yaml:"regular_deal_bill_period" default:"24h"`
	SpotBillPeriod          time.Duration `yaml:"spot_deal_bill_period" default:"1h"`
	SyncStepTimeout         time.Duration `yaml:"sync_step_timeout" default:"5m"`
	SyncInterval            time.Duration `yaml:"sync_interval" default:"10s"`
	MatcherRetryInterval    time.Duration `yaml:"matcher_retry_interval" default:"10s"`
	DealCancellationTimeout time.Duration `yaml:"deal_cancellation_timeout" default:"3m"`
}

Jump to

Keyboard shortcuts

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