Package org.onosproject.mastership
Interface MastershipStore
-
- All Superinterfaces:
Store<MastershipEvent,MastershipStoreDelegate>
public interface MastershipStore extends Store<MastershipEvent,MastershipStoreDelegate>
Manages inventory of mastership roles for devices, across controller instances; not intended for direct use.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.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.java.util.concurrent.CompletableFuture<MastershipEvent>
relinquishRole(NodeId nodeId, DeviceId deviceId)
Allows a controller instance to give up its current role for a device.java.util.concurrent.CompletableFuture<MastershipRole>
requestRole(DeviceId deviceId)
Requests role of the local node for the specified device.java.util.concurrent.CompletableFuture<MastershipEvent>
setMaster(NodeId nodeId, DeviceId deviceId)
Sets a device's role for a specified controller instance.java.util.concurrent.CompletableFuture<MastershipEvent>
setStandby(NodeId nodeId, DeviceId deviceId)
Sets a controller instance's mastership role to STANDBY for a device.-
Methods inherited from interface org.onosproject.store.Store
hasDelegate, setDelegate, unsetDelegate
-
-
-
-
Method Detail
-
requestRole
java.util.concurrent.CompletableFuture<MastershipRole> requestRole(DeviceId deviceId)
Requests role of the local node for the specified device.- Parameters:
deviceId
- device identifier- Returns:
- established or newly negotiated mastership role
-
getRole
MastershipRole getRole(NodeId nodeId, DeviceId deviceId)
Returns the role of a device for a specific controller instance.- Parameters:
nodeId
- the instance identifierdeviceId
- the device identifiers- Returns:
- the role
-
getMaster
NodeId getMaster(DeviceId deviceId)
Returns the master for a device.- Parameters:
deviceId
- the device identifier- Returns:
- the instance identifier of the master
-
getNodes
RoleInfo getNodes(DeviceId deviceId)
Returns the master and backup nodes for a device.- Parameters:
deviceId
- the device identifier- Returns:
- a RoleInfo containing controller IDs
-
getDevices
java.util.Set<DeviceId> getDevices(NodeId nodeId)
Returns the devices that a controller instance is master of.- Parameters:
nodeId
- the instance identifier- Returns:
- a set of device identifiers
-
setMaster
java.util.concurrent.CompletableFuture<MastershipEvent> setMaster(NodeId nodeId, DeviceId deviceId)
Sets a device's role for a specified controller instance.- Parameters:
nodeId
- controller instance identifierdeviceId
- device identifier- Returns:
- a mastership event
-
getTermFor
MastershipTerm getTermFor(DeviceId deviceId)
Returns the current master and number of past mastership hand-offs (terms) for a device.- Parameters:
deviceId
- the device identifier- Returns:
- the current master's ID and the term value for device, or null
-
getMastership
MastershipInfo getMastership(DeviceId deviceId)
Returns the mastership info for the given device.- Parameters:
deviceId
- the device for which to return the mastership info- Returns:
- the mastership info for the given device
-
setStandby
java.util.concurrent.CompletableFuture<MastershipEvent> setStandby(NodeId nodeId, DeviceId deviceId)
Sets a controller instance's mastership role to STANDBY for a device. If the role is MASTER, another controller instance will be selected as a candidate master.- Parameters:
nodeId
- the controller instance identifierdeviceId
- device to revoke mastership role for- Returns:
- a mastership event
-
relinquishRole
java.util.concurrent.CompletableFuture<MastershipEvent> relinquishRole(NodeId nodeId, DeviceId deviceId)
Allows a controller instance to give up its current role for a device. If the role is MASTER, another controller instance will be selected as a candidate master.- Parameters:
nodeId
- the controller instance identifierdeviceId
- device to revoke mastership role for- Returns:
- a mastership event
-
relinquishAllRole
void relinquishAllRole(NodeId nodeId)
Removes all the roles for the specified controller instance. If the role was MASTER, another controller instance will be selected as a candidate master.- Parameters:
nodeId
- the controller instance identifier
-
-