Documentation
¶
Index ¶
- func RegisterOffersStrategy(strategyName string, factory ManageOffersFactory)
- type ManageOffersFactory
- type OffersManager
- type SmartChordOffersManager
- func (man *SmartChordOffersManager) CreateOffer(newOfferID int64, availableResources resources.Resources) (*supplierOffer, error)
- func (man *SmartChordOffersManager) FindOffers(targetResources resources.Resources) []types.AvailableOffer
- func (man *SmartChordOffersManager) Init(resourcesMap *resources.Mapping, overlay external.Overlay, ...)
- type Supplier
- func (sup *Supplier) AvailableResources() types.Resources
- func (sup *Supplier) FindOffers(targetResources resources.Resources) []types.AvailableOffer
- func (sup *Supplier) MaximumResources() types.Resources
- func (sup *Supplier) ObtainResources(offerID int64, resourcesNecessary resources.Resources) bool
- func (sup *Supplier) RefreshOffer(fromTrader *types.Node, refreshOffer *types.Offer) bool
- func (sup *Supplier) ReturnResources(releasedResources resources.Resources)
- func (sup *Supplier) Start()
- func (sup *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(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
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 ¶
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 ¶
Simulation
func (*Supplier) ObtainResources ¶
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.