blob: c285ebac6d43840ba74a934a44b2504378ac1e2b [file] [log] [blame]
Pavlin Radoslavova6b754c2014-11-18 13:55:37 -08001/*
2 * Copyright 2014 Open Networking Laboratory
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.onlab.onos.cluster;
17
18import org.onlab.onos.event.AbstractEvent;
19
20/**
21 * Describes leadership-related event.
22 */
23public class LeadershipEvent extends AbstractEvent<LeadershipEvent.Type, ControllerNode> {
24
25 /**
26 * Type of leadership-related events.
27 */
28 public enum Type {
29 /**
30 * Signifies that the leader has changed. The event subject is the
31 * new leader.
32 */
33 LEADER_CHANGED
34 }
35
36 /**
37 * Creates an event of a given type and for the specified instance and the
38 * current time.
39 *
40 * @param type leadership event type
41 * @param instance cluster device subject
42 */
43 public LeadershipEvent(Type type, ControllerNode instance) {
44 super(type, instance);
45 }
46
47 /**
48 * Creates an event of a given type and for the specified device and time.
49 *
50 * @param type device event type
51 * @param instance event device subject
52 * @param time occurrence time
53 */
54 public LeadershipEvent(Type type, ControllerNode instance, long time) {
55 super(type, instance, time);
56 }
57
58}