public interface MastershipStore extends Store<MastershipEvent,MastershipStoreDelegate>
Modifier and Type | Method and Description |
---|---|
Set<DeviceId> |
getDevices(NodeId nodeId)
Returns the devices that a controller instance is master of.
|
NodeId |
getMaster(DeviceId deviceId)
Returns the master for a device.
|
MastershipInfo |
getMastership(DeviceId deviceId)
Returns the mastership info for the given device.
|
RoleInfo |
getNodes(DeviceId deviceId)
Returns the master and backup nodes for a device.
|
MastershipRole |
getRole(NodeId nodeId,
DeviceId deviceId)
Returns the role of a device for a specific controller instance.
|
MastershipTerm |
getTermFor(DeviceId deviceId)
Returns the current master and number of past mastership hand-offs
(terms) for a device.
|
void |
relinquishAllRole(NodeId nodeId)
Removes all the roles for the specified controller instance.
|
CompletableFuture<MastershipEvent> |
relinquishRole(NodeId nodeId,
DeviceId deviceId)
Allows a controller instance to give up its current role for a device.
|
CompletableFuture<MastershipRole> |
requestRole(DeviceId deviceId)
Requests role of the local node for the specified device.
|
CompletableFuture<MastershipEvent> |
setMaster(NodeId nodeId,
DeviceId deviceId)
Sets a device's role for a specified controller instance.
|
CompletableFuture<MastershipEvent> |
setStandby(NodeId nodeId,
DeviceId deviceId)
Sets a controller instance's mastership role to STANDBY for a device.
|
hasDelegate, setDelegate, unsetDelegate
CompletableFuture<MastershipRole> requestRole(DeviceId deviceId)
deviceId
- device identifierMastershipRole getRole(NodeId nodeId, DeviceId deviceId)
nodeId
- the instance identifierdeviceId
- the device identifiersNodeId getMaster(DeviceId deviceId)
deviceId
- the device identifierRoleInfo getNodes(DeviceId deviceId)
deviceId
- the device identifierSet<DeviceId> getDevices(NodeId nodeId)
nodeId
- the instance identifierCompletableFuture<MastershipEvent> setMaster(NodeId nodeId, DeviceId deviceId)
nodeId
- controller instance identifierdeviceId
- device identifierMastershipTerm getTermFor(DeviceId deviceId)
deviceId
- the device identifierMastershipInfo getMastership(DeviceId deviceId)
deviceId
- the device for which to return the mastership infoCompletableFuture<MastershipEvent> setStandby(NodeId nodeId, DeviceId deviceId)
nodeId
- the controller instance identifierdeviceId
- device to revoke mastership role forCompletableFuture<MastershipEvent> relinquishRole(NodeId nodeId, DeviceId deviceId)
nodeId
- the controller instance identifierdeviceId
- device to revoke mastership role forvoid relinquishAllRole(NodeId nodeId)
nodeId
- the controller instance identifier