supplier

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2018 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterOffersStrategy

func RegisterOffersStrategy(strategyName string, factory ManageOffersFactory)

RegisterOffersStrategy can be used to register a new strategy in order to be available.

Types

type ManageOffersFactory

type ManageOffersFactory func(config *configuration.Configuration) (OffersManager, error)

ManageOffersFactory represents a method that creates a new offers manager.

type OffersManager

type OffersManager interface {
	// Init initializes the offers manager structure with the necessary objects, resourcesMap the GUID<->Resource map,
	// overlay the communication node overlay and the remoteClient that allows to communicate with other CARAVELA's nodes.
	Init(resourcesMap *resources.Mapping, overlay external.Overlay, remoteClient external.Caravela)

	// FindOffers searches in the system (with help of the overlay) for node's that have offers that offer at least the
	// same resources as targetResources.
	FindOffers(targetResources resources.Resources) []types.AvailableOffer

	// CreateOffer creates a new offer in the system given the current local's available resources.
	CreateOffer(newOfferID int64, availableResources resources.Resources) (*supplierOffer, error)
}

OffersManager is an interface that can be implemented in an object in order to perform the actions of managing the resources offering in the system ina different way. This is the fundamental for our initial work, because it is the way to test/compare several approaches.

func CreateOffersStrategy

func CreateOffersStrategy(config *configuration.Configuration) OffersManager

CreateOffersStrategy is used to obtain an offers manager based on the configurations.

type SmartChordOffersManager added in v0.2.0

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

func (*SmartChordOffersManager) CreateOffer added in v0.2.0

func (man *SmartChordOffersManager) CreateOffer(newOfferID int64, availableResources resources.Resources) (*supplierOffer, error)

func (*SmartChordOffersManager) FindOffers added in v0.2.0

func (man *SmartChordOffersManager) FindOffers(targetResources resources.Resources) []types.AvailableOffer

func (*SmartChordOffersManager) Init added in v0.2.0

func (man *SmartChordOffersManager) Init(resourcesMap *resources.Mapping, overlay external.Overlay,
	remoteClient external.Caravela)

type Supplier

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

Supplier handles all the logic of managing the node own resources, advertising them into the system.

func NewSupplier

func NewSupplier(config *configuration.Configuration, overlay external.Overlay, client external.Caravela,
	resourcesMap *resources.Mapping, maxResources resources.Resources) *Supplier

NewSupplier creates a new supplier component, that manages the local resources.

func (*Supplier) AvailableResources

func (sup *Supplier) AvailableResources() types.Resources

Simulation

func (*Supplier) FindOffers

func (sup *Supplier) FindOffers(targetResources resources.Resources) []types.AvailableOffer

Find a list active Offers that best suit the target resources given.

func (*Supplier) MaximumResources

func (sup *Supplier) MaximumResources() types.Resources

Simulation

func (*Supplier) ObtainResources

func (sup *Supplier) ObtainResources(offerID int64, resourcesNecessary resources.Resources) bool

Tries to obtain a subset of the resources represented by the given offer in order to deploy a container. It updates the respective trader that manages the offer.

func (*Supplier) RefreshOffer

func (sup *Supplier) RefreshOffer(fromTrader *types.Node, refreshOffer *types.Offer) bool

Tries refresh an offer. Called when a refresh message was received.

func (*Supplier) ReturnResources

func (sup *Supplier) ReturnResources(releasedResources resources.Resources)

Release resources of an used offer into the supplier again in order to offer them again into the system.

func (*Supplier) Start

func (sup *Supplier) Start()

func (*Supplier) Stop

func (sup *Supplier) Stop()

Jump to

Keyboard shortcuts

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