Documentation ¶
Index ¶
- func RegisterOffersStrategy(strategyName string, factory ManageOffersFactory)
- type ManageOffersFactory
- type OfferingStrategy
- type Supplier
- func (s *Supplier) AvailableResources() types.Resources
- func (s *Supplier) DebugSizeBytes() int
- func (s *Supplier) FindOffers(ctx context.Context, targetResources resources.Resources) []types.AvailableOffer
- func (s *Supplier) IsWorking() bool
- func (s *Supplier) MaximumResources() types.Resources
- func (s *Supplier) NumActiveOffers() int
- func (s *Supplier) ObtainResources(offerID int64, resourcesNecessary resources.Resources, numContainersToRun int) bool
- func (s *Supplier) RefreshOffer(fromTrader *types.Node, refreshOffer *types.Offer) bool
- func (s *Supplier) ReturnResources(releasedResources resources.Resources, numContainersStopped int)
- func (s *Supplier) Start()
- func (s *Supplier) Stop()
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(node common.Node, config *configuration.Configuration) (OfferingStrategy, error)
ManageOffersFactory represents a method that creates a new offers manager.
type OfferingStrategy ¶
type OfferingStrategy 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 KAGETAKA's nodes. Init(supp *Supplier, resourcesMap *resources.Mapping, overlay overlay.Overlay, remoteClient external.Kagetaka) // 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(ctx context.Context, targetResources resources.Resources) []types.AvailableOffer // CreateOffer creates a new offer in the system given the current local's available resources. UpdateOffers(ctx context.Context, availableResources, usedResources resources.Resources) }
OfferingStrategy 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(node common.Node, config *configuration.Configuration) OfferingStrategy
CreateOffersStrategy is used to obtain an offers manager based on the configurations.
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(node nodeCommon.Node, config *configuration.Configuration, overlay overlay.Overlay, client external.Kagetaka, resourcesMap *resources.Mapping, maxResources resources.Resources) *Supplier
NewSupplier creates a new supplier component, that manages the local resources.
func (*Supplier) AvailableResources ¶
Simulation
func (*Supplier) DebugSizeBytes ¶
func (*Supplier) FindOffers ¶
func (s *Supplier) FindOffers(ctx context.Context, targetResources resources.Resources) []types.AvailableOffer
Find a list active Offers that best suit the target resources given.
func (*Supplier) MaximumResources ¶
Simulation
func (*Supplier) ObtainResources ¶
func (s *Supplier) ObtainResources(offerID int64, resourcesNecessary resources.Resources, numContainersToRun int) 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 ¶
Tries refresh an offer. Called when a refresh message was received.
func (*Supplier) ReturnResources ¶
Release resources of an used offer into the supplier again in order to offer them again into the system.