Interface MastershipService

    • 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