Package org.onosproject.mastership
Interface MastershipService
- 
- All Superinterfaces:
 ListenerService<MastershipEvent,MastershipListener>
public interface MastershipService extends ListenerService<MastershipEvent,MastershipListener>
Service responsible for determining the controller instance mastership of a device in a clustered environment. This is the central authority for determining mastership, but is not responsible for actually applying it to the devices; this falls on the device service. 
- 
- 
Field Summary
Fields Modifier and Type Field Description static longTIMEOUT_MILLIS 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description java.util.Set<DeviceId>getDevicesOf(NodeId nodeId)Deprecated.1.6.0 Goldeneye release.MastershipRolegetLocalRole(DeviceId deviceId)Returns the role of the local node for the specified device, without triggering master selection.NodeIdgetMasterFor(DeviceId deviceId)Returns the current master for a given device.MastershipInfogetMastershipFor(DeviceId deviceId)Returns the mastership info for the given device.RoleInfogetNodesFor(DeviceId deviceId)Returns controllers connected to a given device, in order of preference.default booleanisLocalMaster(DeviceId deviceId)Returns true if the local controller is the Master for the specified deviceId.java.util.concurrent.CompletableFuture<java.lang.Void>relinquishMastership(DeviceId deviceId)Abandons mastership of the specified device on the local node thus forcing selection of a new master.default voidrelinquishMastershipSync(DeviceId deviceId)Synchronous version of relinquishMastership.java.util.concurrent.CompletableFuture<MastershipRole>requestRoleFor(DeviceId deviceId)Returns the mastership status of the local controller for a given device forcing master selection if necessary.default MastershipRolerequestRoleForSync(DeviceId deviceId)Synchronous version of requestRoleFor.- 
Methods inherited from interface org.onosproject.event.ListenerService
addListener, removeListener 
 - 
 
 - 
 
- 
- 
Field Detail
- 
TIMEOUT_MILLIS
static final long TIMEOUT_MILLIS
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
getLocalRole
MastershipRole getLocalRole(DeviceId deviceId)
Returns the role of the local node for the specified device, without triggering master selection.- Parameters:
 deviceId- the identifier of the device- Returns:
 - role of the current node
 
 
- 
isLocalMaster
default boolean isLocalMaster(DeviceId deviceId)
Returns true if the local controller is the Master for the specified deviceId.- Parameters:
 deviceId- the identifier of the device- Returns:
 - true if local node is master; false otherwise
 
 
- 
requestRoleFor
java.util.concurrent.CompletableFuture<MastershipRole> requestRoleFor(DeviceId deviceId)
Returns the mastership status of the local controller for a given device forcing master selection if necessary.- Parameters:
 deviceId- the identifier of the device- Returns:
 - future object of this controller instance role
 
 
- 
requestRoleForSync
default MastershipRole requestRoleForSync(DeviceId deviceId)
Synchronous version of requestRoleFor. Returns the mastership status of the local controller for a given device forcing master selection if necessary.- Parameters:
 deviceId- the identifier of the device- Returns:
 - the role of this controller instance
 
 
- 
relinquishMastership
java.util.concurrent.CompletableFuture<java.lang.Void> relinquishMastership(DeviceId deviceId)
Abandons mastership of the specified device on the local node thus forcing selection of a new master. If the local node is not a master for this device, no master selection will occur.- Parameters:
 deviceId- the identifier of the device- Returns:
 - future that is completed when relinquish is complete
 
 
- 
relinquishMastershipSync
default void relinquishMastershipSync(DeviceId deviceId)
Synchronous version of relinquishMastership. Abandons mastership of the specified device on the local node thus forcing selection of a new master. If the local node is not a master for this device, no master selection will occur.- Parameters:
 deviceId- the identifier of the device
 
- 
getMasterFor
NodeId getMasterFor(DeviceId deviceId)
Returns the current master for a given device.- Parameters:
 deviceId- the identifier of the device- Returns:
 - the ID of the master controller for the device
 
 
- 
getNodesFor
RoleInfo getNodesFor(DeviceId deviceId)
Returns controllers connected to a given device, in order of preference. The first entry in the list is the current master.- Parameters:
 deviceId- the identifier of the device- Returns:
 - a list of controller IDs
 
 
- 
getMastershipFor
MastershipInfo getMastershipFor(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
 
 
- 
getDevicesOf
@Deprecated java.util.Set<DeviceId> getDevicesOf(NodeId nodeId)
Deprecated.1.6.0 Goldeneye release.Returns the devices for which a controller is master.Returned Set may contain DeviceId which no longer exist in the system.
- Parameters:
 nodeId- the ID of the controller- Returns:
 - a set of device IDs
 
 
 - 
 
 -