blob: c3563a445734e9ede15822e12d6b2063aa402d3f [file] [log] [blame]
Ilayda Ozdemir4c5947c2020-05-05 13:14:32 +00001/*
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 */
16package org.opencord.igmpproxy;
17
Ilayda Ozdemir0872abd2020-06-03 20:20:20 +030018import org.onosproject.cluster.Leadership;
19import org.onosproject.cluster.NodeId;
Ilayda Ozdemir4c5947c2020-05-05 13:14:32 +000020import org.onosproject.net.DeviceId;
21
22/**
23 * Leadership control service.
24 */
25public 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 Ozdemir0872abd2020-06-03 20:20:20 +030033
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 Ozdemir4c5947c2020-05-05 13:14:32 +000063}