Package me.ahoo.cosid.mongo
Class MongoMachineCollection
java.lang.Object
me.ahoo.cosid.mongo.MongoMachineCollection
- All Implemented Interfaces:
MachineCollection
-
Field Summary
Fields inherited from interface me.ahoo.cosid.mongo.MachineCollection
COLLECTION_NAME
-
Constructor Summary
ConstructorDescriptionMongoMachineCollection
(com.mongodb.client.MongoCollection<org.bson.Document> machineCollection) -
Method Summary
Modifier and TypeMethodDescriptiondistribute
(String namespace, int machineBit, InstanceId instanceId) distributeByRevert
(String namespace, InstanceId instanceId, Duration safeGuardDuration) distributeBySelf
(String namespace, InstanceId instanceId, Duration safeGuardDuration) void
guard
(String namespace, InstanceId instanceId, MachineState machineState, Duration safeGuardDuration) int
nextMachineId
(String namespace) void
revert
(String namespace, InstanceId instanceId, MachineState machineState)
-
Constructor Details
-
MongoMachineCollection
public MongoMachineCollection(com.mongodb.client.MongoCollection<org.bson.Document> machineCollection)
-
-
Method Details
-
nextMachineId
- Specified by:
nextMachineId
in interfaceMachineCollection
-
distribute
- Specified by:
distribute
in interfaceMachineCollection
-
distributeByRevert
public MachineState distributeByRevert(String namespace, InstanceId instanceId, Duration safeGuardDuration) - Specified by:
distributeByRevert
in interfaceMachineCollection
-
distributeBySelf
public MachineState distributeBySelf(String namespace, InstanceId instanceId, Duration safeGuardDuration) - Specified by:
distributeBySelf
in interfaceMachineCollection
-
revert
public void revert(String namespace, InstanceId instanceId, MachineState machineState) throws MachineIdLostException - Specified by:
revert
in interfaceMachineCollection
- Throws:
MachineIdLostException
-
guard
public void guard(String namespace, InstanceId instanceId, MachineState machineState, Duration safeGuardDuration) throws MachineIdLostException - Specified by:
guard
in interfaceMachineCollection
- Throws:
MachineIdLostException
-