blob: b4becfa6f6cc27265e11ecf26503295fd4459ba7 [file] [log] [blame]
Umesh Krishnaswamyb56bb292013-02-12 20:28:27 -08001package net.floodlightcontroller.mastership;
2
3public interface IMastershipHelper {
4
5 // Callback for all mastership changes.
6 // Change callback is called when mastership is acquired or released
7 public interface MastershipCallback {
8 public void changeCallback(long dpid);
9 }
10
11 // Set/get mastership identifier. This is used to set the unique identifier of the controller that is asking for mastership.
12 // It needs to be set first before any mastership call can be made
13 public void setMastershipId (String id);
14 public String getMastershipId ();
15
16 // Request mastership for a switch. Our request for mastership remains in a queue. If we win mastership, the callback
17 // is called. This call is non-blocking and can be called from the packet processing context as well.
18 public void requestMastership(long dpid, MastershipCallback cb);
19
20 // Release mastership for a switch. If we are the master, then the mastership will be released and given to the next
21 // controller who had requested mastership. If we are not the master our request for mastership will be
22 // removed from the queue.
23 public void releaseMastership(long dpid);
24
25 // Check if I am the master of a switch and return true if I am the master.
26 public boolean amMaster(long dpid);
27}