Umesh Krishnaswamy | b56bb29 | 2013-02-12 20:28:27 -0800 | [diff] [blame] | 1 | package net.floodlightcontroller.mastership; |
| 2 | |
| 3 | import net.floodlightcontroller.core.module.IFloodlightService; |
| 4 | |
| 5 | public interface IMastershipService extends IFloodlightService { |
| 6 | |
Jonathan Hart | bd181b6 | 2013-02-17 16:05:38 -0800 | [diff] [blame] | 7 | // Callback for all mastership changes. |
| 8 | // Change callback is called when mastership is acquired or released |
| 9 | public interface MastershipCallback { |
| 10 | public void changeCallback(long dpid, boolean isMaster); |
| 11 | } |
| 12 | |
Umesh Krishnaswamy | b56bb29 | 2013-02-12 20:28:27 -0800 | [diff] [blame] | 13 | // Acquire mastership for a switch. |
Jonathan Hart | c6eee9e | 2013-02-18 14:58:27 -0800 | [diff] [blame^] | 14 | public void acquireMastership(long dpid, MastershipCallback cb) throws Exception; |
Umesh Krishnaswamy | b56bb29 | 2013-02-12 20:28:27 -0800 | [diff] [blame] | 15 | |
| 16 | // Release mastership for a switch |
| 17 | public void releaseMastership(long dpid); |
| 18 | |
| 19 | // Check if I am the master of a switch. This is a nonblocking call that checks if the caller is a |
| 20 | public boolean amMaster(long dpid); |
| 21 | |
| 22 | // Set/Get mastership identifier. |
| 23 | // This is typically a unique identifier of the controller that does not change across restarts |
| 24 | public void setMastershipId (String id); |
| 25 | public String getMastershipId (); |
| 26 | |
| 27 | } |