Documentation ¶
Index ¶
- Variables
- func CloudUnitsFromResourceUnits(rsu workloads.RSU) (cu float64, su float64, ipu float64)
- type NaivePlanner
- func (p *NaivePlanner) AddUsedCapacity(w workloads.Workloader) error
- func (p *NaivePlanner) HasCapacity(w workloads.Workloader, seconds uint) (bool, error)
- func (p *NaivePlanner) IsAllowed(w workloads.Workloader) (bool, error)
- func (p *NaivePlanner) PoolByID(id int64) (types.Pool, error)
- func (p *NaivePlanner) PoolsForOwner(owner int64) ([]types.Pool, error)
- func (p *NaivePlanner) RemoveUsedCapacity(w workloads.Workloader) error
- func (p *NaivePlanner) Reserve(reservation types.Reservation, currencies []string) (escrowtypes.CustomerCapacityEscrowInformation, error)
- func (p *NaivePlanner) Run(ctx context.Context)
- type Planner
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTransparantCapacityExtension indicates a capacity reservation, which is // really an extension of a previous reservation, will not change the capacity // pool in a meaningful, observable way. ErrTransparantCapacityExtension = errors.New("this capacity reservation has no observable results") )
Functions ¶
Types ¶
type NaivePlanner ¶
type NaivePlanner struct {
// contains filtered or unexported fields
}
NaivePlanner simply allows all capacity purchases, and allows all workloads to use a pool, as long as they both have the same owner.
func NewNaivePlanner ¶
func NewNaivePlanner(escrow escrow.Escrow, db *mongo.Database) *NaivePlanner
NewNaivePlanner creates a new NaivePlanner, using the provided escrow and database connection
func (*NaivePlanner) AddUsedCapacity ¶
func (p *NaivePlanner) AddUsedCapacity(w workloads.Workloader) error
AddUsedCapacity implements Planner
func (*NaivePlanner) HasCapacity ¶
func (p *NaivePlanner) HasCapacity(w workloads.Workloader, seconds uint) (bool, error)
HasCapacity implements Planner
func (*NaivePlanner) IsAllowed ¶
func (p *NaivePlanner) IsAllowed(w workloads.Workloader) (bool, error)
IsAllowed implements Planner
func (*NaivePlanner) PoolByID ¶
func (p *NaivePlanner) PoolByID(id int64) (types.Pool, error)
PoolByID implements Planner
func (*NaivePlanner) PoolsForOwner ¶
func (p *NaivePlanner) PoolsForOwner(owner int64) ([]types.Pool, error)
PoolsForOwner implements Planner
func (*NaivePlanner) RemoveUsedCapacity ¶
func (p *NaivePlanner) RemoveUsedCapacity(w workloads.Workloader) error
RemoveUsedCapacity implements Planner
func (*NaivePlanner) Reserve ¶
func (p *NaivePlanner) Reserve(reservation types.Reservation, currencies []string) (escrowtypes.CustomerCapacityEscrowInformation, error)
Reserve implements Planner
type Planner ¶
type Planner interface { // Run the planner Run(ctx context.Context) // Reserve some capacity Reserve(reservation types.Reservation, currencies []string) (escrowtypes.CustomerCapacityEscrowInformation, error) // IsAllowed checks if the pool with the given id is owned by the given // customer, and can deploy on the given node. IsAllowed(w workloads.Workloader) (bool, error) // HasCapacity checks if the workload could be provisioned with its attached // pool as it is right now. HasCapacity(w workloads.Workloader, seconds uint) (bool, error) // AddUsedCapacity adds a deployed workload to the pool. If the workload // is already in the pool (based on ID), nothing happens. AddUsedCapacity(w workloads.Workloader) error // RemoveUsedCapacity removes a deployed workoad from the pool. If the workload // is not in the pool (based on ID), nothing happends. RemoveUsedCapacity(w workloads.Workloader) error // PoolByID returns the pool with the given ID PoolByID(id int64) (types.Pool, error) // PoolsForOwner returns all pools for a given owner PoolsForOwner(owner int64) ([]types.Pool, error) }
Planner for capacity. This is the highest level manager that decides if and how capacity can be used. It is also responsible for managing payment for capacity.
Click to show internal directories.
Click to hide internal directories.