Ilayda Ozdemir | 4c5947c | 2020-05-05 13:14:32 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.opencord.igmpproxy; |
| 17 | |
Ilayda Ozdemir | 0872abd | 2020-06-03 20:20:20 +0300 | [diff] [blame^] | 18 | import org.onosproject.cluster.Leadership; |
| 19 | import org.onosproject.cluster.NodeId; |
Ilayda Ozdemir | 4c5947c | 2020-05-05 13:14:32 +0000 | [diff] [blame] | 20 | import org.onosproject.net.DeviceId; |
| 21 | |
| 22 | /** |
| 23 | * Leadership control service. |
| 24 | */ |
| 25 | public interface IgmpLeadershipService { |
| 26 | /** |
| 27 | * Makes leadership control. |
| 28 | * |
| 29 | * @param deviceId received deviceId |
| 30 | * @return if it is leadership of this device, return true |
| 31 | */ |
| 32 | boolean isLocalLeader(DeviceId deviceId); |
Ilayda Ozdemir | 0872abd | 2020-06-03 20:20:20 +0300 | [diff] [blame^] | 33 | |
| 34 | /** |
| 35 | * Gets local node id. |
| 36 | * |
| 37 | * @return node id |
| 38 | */ |
| 39 | NodeId getLocalNodeId(); |
| 40 | |
| 41 | /** |
| 42 | * Gets leader for topic. |
| 43 | * |
| 44 | * @param topic topic name |
| 45 | * @return leader of topic |
| 46 | */ |
| 47 | NodeId getLeader(String topic); |
| 48 | |
| 49 | /** |
| 50 | * Enters a leadership contest. |
| 51 | * |
| 52 | * @param topic leadership topic |
| 53 | * @return {@code Leadership} future |
| 54 | */ |
| 55 | Leadership runForLeadership(String topic); |
| 56 | |
| 57 | /** |
| 58 | * Withdraws from a leadership contest. |
| 59 | * |
| 60 | * @param topic leadership topic |
| 61 | */ |
| 62 | void withdraw(String topic); |
Ilayda Ozdemir | 4c5947c | 2020-05-05 13:14:32 +0000 | [diff] [blame] | 63 | } |