salesman

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2018 License: Apache-2.0 Imports: 19 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 Option

type Option func(*options)

func WithCGroupManager

func WithCGroupManager(cGroupManager cgroups.CGroupManager) Option

func WithConfig

func WithConfig(config *YAMLConfig) 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 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(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()

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) NextMaintenance

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

func (*Salesman) RemoveAskPlan

func (m *Salesman) RemoveAskPlan(planID string) error

func (*Salesman) Run

func (m *Salesman) Run(ctx context.Context) <-chan *sonm.Deal

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:"2m"`
	SyncInterval         time.Duration `yaml:"sync_interval" default:"10s"`
	MatcherRetryInterval time.Duration `yaml:"matcher_retry_interval" default:"10s"`
}

Jump to

Keyboard shortcuts

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