Page MenuHomeClusterLabs Projects
Diviner Tech Docs DrydockAlmanacServiceHostBlueprintImplementation

final class DrydockAlmanacServiceHostBlueprintImplementation
Phorge Technical Documentation (Drydock)

This class is not documented.

Tasks

Lease Acquisition

Resource Allocation

Resource Interfaces

No methods for this task.

Logging

No methods for this task.

Other Methods

Methods

public function getType()

This method is not documented.
Return
wild

public function isEnabled()

This method is not documented.
Return
wild

public function getBlueprintName()

This method is not documented.
Return
wild

public function getDescription()

This method is not documented.
Return
wild

public function getBlueprintIcon()

This method is not documented.
Return
wild

public function getFieldSpecifications()
Inherited

This method is not documented.
Return
wild

protected function getCustomFieldSpecifications()

This method is not documented.
Return
wild

public function getViewer()
Inherited

This method is not documented.
Return
wild

public function canAcquireLeaseOnResource($blueprint, $resource, $lease)

DrydockBlueprintImplementation

Enforce basic checks on lease/resource compatibility. Allows resources to reject leases if they are incompatible, even if the resource types match.

For example, if a resource represents a 32-bit host, this method might reject leases that need a 64-bit host. The blueprint might also reject a resource if the lease needs 8GB of RAM and the resource only has 6GB free.

This method should not acquire locks or expect anything to be locked. This is a coarse compatibility check between a lease and a resource.

DrydockAlmanacServiceHostBlueprintImplementation
This method is not documented.
Parameters
DrydockBlueprint$blueprintConcrete blueprint to allocate for.
DrydockResource$resourceCandidate resource to allocate the lease on.
DrydockLease$leasePending lease that wants to allocate here.
Return
boolTrue if the resource and lease are compatible.

public function acquireLease($blueprint, $resource, $lease)

DrydockBlueprintImplementation

Acquire a lease. Allows resources to perform setup as leases are brought online.

If acquisition fails, throw an exception.

DrydockAlmanacServiceHostBlueprintImplementation
This method is not documented.
Parameters
DrydockBlueprint$blueprintBlueprint which built the resource.
DrydockResource$resourceResource to acquire a lease on.
DrydockLease$leaseRequested lease.
Return
void

public function activateLease($blueprint, $resource, $lease)
Inherited

This method is not documented.
Parameters
DrydockBlueprint$blueprint
DrydockResource$resource
DrydockLease$lease
Return
void

public function didReleaseLease($blueprint, $resource, $lease)

DrydockBlueprintImplementation

React to a lease being released.

This callback is primarily useful for automatically releasing resources once all leases are released.

DrydockAlmanacServiceHostBlueprintImplementation
This method is not documented.
Parameters
DrydockBlueprint$blueprintBlueprint which built the resource.
DrydockResource$resourceResource a lease was released on.
DrydockLease$leaseRecently released lease.
Return
void

public function destroyLease($blueprint, $resource, $lease)

DrydockBlueprintImplementation

Destroy any temporary data associated with a lease.

If a lease creates temporary state while held, destroy it here.

DrydockAlmanacServiceHostBlueprintImplementation
This method is not documented.
Parameters
DrydockBlueprint$blueprintBlueprint which built the resource.
DrydockResource$resourceResource the lease is acquired on.
DrydockLease$leaseThe lease being destroyed.
Return
void

public function shouldAllocateSupplementalResource($blueprint, $resource, $lease)

DrydockBlueprintImplementation

Return true to try to allocate a new resource and expand the resource pool instead of permitting an otherwise valid acquisition on an existing resource.

This allows the blueprint to provide a soft hint about when the resource pool should grow.

Returning "true" in all cases generally makes sense when a blueprint controls a fixed pool of resources, like a particular number of physical hosts: you want to put all the hosts in service, so whenever it is possible to allocate a new host you want to do this.

Returning "false" in all cases generally make sense when a blueprint has a flexible pool of expensive resources and you want to pack leases onto them as tightly as possible.

DrydockAlmanacServiceHostBlueprintImplementation
This method is not documented.
Parameters
DrydockBlueprint$blueprintThe blueprint for an existing resource being acquired.
DrydockResource$resourceThe resource being acquired, which we may want to build a supplemental resource for.
DrydockLease$leaseThe current lease performing acquisition.
Return
boolTrue to prefer allocating a supplemental resource.
DrydockBlueprintImplementation

Enforce fundamental implementation/lease checks. Allows implementations to reject a lease which no concrete blueprint can ever satisfy.

For example, if a lease only builds ARM hosts and the lease needs a PowerPC host, it may be rejected here.

This is the earliest rejection phase, and followed by canEverAllocateResourceForLease().

This method should not actually check if a resource can be allocated right now, or even if a blueprint which can allocate a suitable resource really exists, only if some blueprint may conceivably exist which could plausibly be able to build a suitable resource.

DrydockAlmanacServiceHostBlueprintImplementation
This method is not documented.
Parameters
DrydockLease$leaseRequested lease.
Return
boolTrue if some concrete blueprint of this implementation's type might ever be able to build a resource for the lease.

public function canEverAllocateResourceForLease($blueprint, $lease)

DrydockBlueprintImplementation

Enforce basic blueprint/lease checks. Allows blueprints to reject a lease which they can not build a resource for.

This is the second rejection phase. It follows canAnyBlueprintEverAllocateResourceForLease() and is followed by canAllocateResourceForLease().

This method should not check if a resource can be built right now, only if the blueprint as configured may, at some time, be able to build a suitable resource.

DrydockAlmanacServiceHostBlueprintImplementation
This method is not documented.
Parameters
DrydockBlueprint$blueprintBlueprint which may be asked to allocate a resource.
DrydockLease$leaseRequested lease.
Return
boolTrue if this blueprint can eventually build a suitable resource for the lease, as currently configured.

public function canAllocateResourceForLease($blueprint, $lease)

DrydockBlueprintImplementation

Enforce basic availability limits. Allows blueprints to reject resource allocation if they are currently overallocated.

This method should perform basic capacity/limit checks. For example, if it has a limit of 6 resources and currently has 6 resources allocated, it might reject new leases.

This method should not acquire locks or expect locks to be acquired. This is a coarse check to determine if the operation is likely to succeed right now without needing to acquire locks.

It is expected that this method will sometimes return true (indicating that a resource can be allocated) but find that another allocator has eaten up free capacity by the time it actually tries to build a resource. This is normal and the allocator will recover from it.

DrydockAlmanacServiceHostBlueprintImplementation
This method is not documented.
Parameters
DrydockBlueprint$blueprintThe blueprint which may be asked to allocate a resource.
DrydockLease$leaseRequested lease.
Return
boolTrue if this blueprint appears likely to be able to allocate a suitable resource.

public function allocateResource($blueprint, $lease)

DrydockBlueprintImplementation

Allocate a suitable resource for a lease.

This method MUST acquire, hold, and manage locks to prevent multiple allocations from racing. World state is not locked before this method is called. Blueprints are entirely responsible for any lock handling they need to perform.

DrydockAlmanacServiceHostBlueprintImplementation
This method is not documented.
Parameters
DrydockBlueprint$blueprintThe blueprint which should allocate a resource.
DrydockLease$leaseRequested lease.
Return
DrydockResourceAllocated resource.

public function activateResource($blueprint, $resource)
Inherited

This method is not documented.
Parameters
DrydockBlueprint$blueprint
DrydockResource$resource
Return
wild

public function destroyResource($blueprint, $resource)

DrydockBlueprintImplementation

Destroy any temporary data associated with a resource.

If a resource creates temporary state when allocated, destroy that state here. For example, you might shut down a virtual host or destroy a working copy on disk.

DrydockAlmanacServiceHostBlueprintImplementation
This method is not documented.
Parameters
DrydockBlueprint$blueprintBlueprint which built the resource.
DrydockResource$resourceResource being destroyed.
Return
void

public function getResourceName($blueprint, $resource)

DrydockBlueprintImplementation

Get a human readable name for a resource.

DrydockAlmanacServiceHostBlueprintImplementation
This method is not documented.
Parameters
DrydockBlueprint$blueprintBlueprint which built the resource.
DrydockResource$resourceResource to get the name of.
Return
stringHuman-readable resource name.

public function getInterface($blueprint, $resource, $lease, $type)

This method is not documented.
Parameters
DrydockBlueprint$blueprint
DrydockResource$resource
DrydockLease$lease
$type
Return
wild

public static function getAllBlueprintImplementations()
Inherited

This method is not documented.
Return
wild

public static function getAllForAllocatingLease($lease)
Inherited

DrydockBlueprintImplementation

Get all the DrydockBlueprintImplementations which can possibly build a resource to satisfy a lease.

This method returns blueprints which might, at some time, be able to build a resource which can satisfy the lease. They may not be able to build that resource right now.

Parameters
DrydockLease$leaseRequested lease.
Return
list<DrydockBlueprintImplementation>List of qualifying blueprint implementations.

public static function getNamedImplementation($class)
Inherited

This method is not documented.
Parameters
$class
Return
wild

protected function newResourceTemplate($blueprint)
Inherited

This method is not documented.
Parameters
DrydockBlueprint$blueprint
Return
wild

protected function newLease($blueprint)
Inherited

This method is not documented.
Parameters
DrydockBlueprint$blueprint
Return
wild

protected function requireActiveLease($lease)
Inherited

This method is not documented.
Parameters
DrydockLease$lease
Return
wild

protected function shouldUseConcurrentResourceLimit()
Inherited

DrydockBlueprintImplementation

Does this implementation use concurrent resource limits?

Implementations can override this method to opt into standard limit behavior, which provides a simple concurrent resource limit.

Return
boolTrue to use limits.

protected function getConcurrentResourceLimit($blueprint)
Inherited

DrydockBlueprintImplementation

Get the effective concurrent resource limit for this blueprint.

Parameters
DrydockBlueprint$blueprintBlueprint to get the limit for.
Return
int|nullLimit, or `null` for no limit.

protected function getConcurrentResourceLimitSlotLock($blueprint)
Inherited

This method is not documented.
Parameters
DrydockBlueprint$blueprint
Return
wild

protected function shouldLimitAllocatingPoolSize($blueprint)
Inherited

DrydockBlueprintImplementation

Apply standard limits on resource allocation rate.

Parameters
DrydockBlueprint$blueprintThe blueprint requesting an allocation.
Return
boolTrue if further allocations should be limited.

private function loadServices($blueprint)

This method is not documented.
Parameters
DrydockBlueprint$blueprint
Return
wild

private function getActiveBindings($services)

This method is not documented.
Parameters
array$services
Return
wild

private function loadFreeBindings($blueprint)

This method is not documented.
Parameters
DrydockBlueprint$blueprint
Return
wild

private function getAlmanacServiceTypes()

This method is not documented.
Return
wild

private function loadBindingForResource($resource)

This method is not documented.
Parameters
DrydockResource$resource
Return
wild