market

package
v0.0.0-...-404dc1e Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Demand

type Demand struct {
	Requirement Requirement
	Bid         float64
	ReturnChan  chan Supply
}

type Market

type Market struct {
	Demands  []Demand
	Supplies []Supply
	Lock     sync.Mutex
	ScoreFn  func(Requirement, float64, Object) float64
	FetchFn  func([]Demand)
	// contains filtered or unexported fields
}

func NewMarket

func NewMarket() *Market

func (*Market) AddDemand

func (m *Market) AddDemand(r Requirement, bid float64, retChan chan Supply)

retChan should be a buffered channel

func (*Market) AddSupply

func (m *Market) AddSupply(supply Supply)

func (*Market) FetcherLoop

func (m *Market) FetcherLoop()

func (*Market) ReturnSupply

func (m *Market) ReturnSupply(s Supply)

func (*Market) SetFetchFunction

func (m *Market) SetFetchFunction(fn func([]Demand)) *Market

func (*Market) SetScoreFunction

func (m *Market) SetScoreFunction(scorer func(Requirement, float64, Object) float64) *Market

type Object

type Object interface{}

type Requirement

type Requirement interface{}

type Supply

type Supply struct {
	Object Object
}

Jump to

Keyboard shortcuts

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