Class EphemeralInstanceAllocator
- java.lang.Object
-
- uk.co.ractf.polaris.controller.instanceallocation.EphemeralInstanceAllocator
-
- All Implemented Interfaces:
InstanceAllocator
public class EphemeralInstanceAllocator extends java.lang.Object implements InstanceAllocator
-
-
Constructor Summary
Constructors Constructor Description EphemeralInstanceAllocator(ClusterState clusterState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description uk.co.ractf.polaris.api.instance.Instance
allocate(uk.co.ractf.polaris.api.instanceallocation.InstanceRequest request)
Allocate anInstance
to a user based on theAllocation
rules defined in theChallenge
, this should return the same instance if called multiple times with the sameInstanceRequest
, unless a call toInstanceAllocator.requestNewAllocation(InstanceRequest)
has been made, in which case the instance returned from here will be avoided where possible.uk.co.ractf.polaris.api.instance.Instance
requestNewAllocation(uk.co.ractf.polaris.api.instanceallocation.InstanceRequest request)
Discard the currentInstance
allocation and get a new one, also add the currentlyInstance
to an avoid list so the instance allocator can avoid allocating that instance to the same user/team again.
-
-
-
Constructor Detail
-
EphemeralInstanceAllocator
public EphemeralInstanceAllocator(ClusterState clusterState)
-
-
Method Detail
-
allocate
public uk.co.ractf.polaris.api.instance.Instance allocate(uk.co.ractf.polaris.api.instanceallocation.InstanceRequest request)
Description copied from interface:InstanceAllocator
Allocate anInstance
to a user based on theAllocation
rules defined in theChallenge
, this should return the same instance if called multiple times with the sameInstanceRequest
, unless a call toInstanceAllocator.requestNewAllocation(InstanceRequest)
has been made, in which case the instance returned from here will be avoided where possible.- Specified by:
allocate
in interfaceInstanceAllocator
- Parameters:
request
- the instance request- Returns:
- the allocated instance
-
requestNewAllocation
public uk.co.ractf.polaris.api.instance.Instance requestNewAllocation(uk.co.ractf.polaris.api.instanceallocation.InstanceRequest request)
Description copied from interface:InstanceAllocator
Discard the currentInstance
allocation and get a new one, also add the currentlyInstance
to an avoid list so the instance allocator can avoid allocating that instance to the same user/team again.- Specified by:
requestNewAllocation
in interfaceInstanceAllocator
- Parameters:
request
- the instance request to ge- Returns:
- a new instance for the user/team
-
-