trader

package
v0.0.0-...-10b4495 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Trader

type Trader struct {
	nodeCommon.NodeComponent // Base component
	// contains filtered or unexported fields
}

Trader is responsible for managing offers from multiple suppliers and negotiate these offers with buyers. The resources combination that the trader can handle is described by its GUID.

func NewTrader

func NewTrader(config *configuration.Configuration, overlay overlay.Overlay, client external.Caravela,
	guid guid.GUID, resourcesMapping *resources.Mapping) *Trader

NewTrader creates a new "virtual" trader.

func (*Trader) AdvertiseNeighborOffer

func (t *Trader) AdvertiseNeighborOffer(fromTrader, traderOffering *types.Node)

Relay the offering advertise for the overlay neighbors if the trader doesn't have any available offers

func (*Trader) CreateOffer

func (t *Trader) CreateOffer(fromSupp *types.Node, newOffer *types.Offer)

Receives a resource offer from other node (supplier) of the system

func (*Trader) DebugSizeBytes

func (t *Trader) DebugSizeBytes() int

func (*Trader) GetOffers

func (t *Trader) GetOffers(ctx context.Context, _ *types.Node, relay bool) []types.AvailableOffer

Returns all the offers that the trader is managing.

func (*Trader) IsWorking

func (t *Trader) IsWorking() bool

func (*Trader) NumActiveOffers

func (t *Trader) NumActiveOffers() int

Simulation

func (*Trader) RefreshOffersSim

func (t *Trader) RefreshOffersSim()

Simulation

func (*Trader) RemoveOffer

func (t *Trader) RemoveOffer(fromSupp *types.Node, offer *types.Offer)

Remove an offer from the offering table.

func (*Trader) SpreadOffersSim

func (t *Trader) SpreadOffersSim()

Simulation

func (*Trader) Start

func (t *Trader) Start()

func (*Trader) Stop

func (t *Trader) Stop()

func (*Trader) UpdateOffer

func (t *Trader) UpdateOffer(fromSupp *types.Node, offer *types.Offer)

Jump to

Keyboard shortcuts

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