blob: 7cba127d56c433a8d91aed2bc85e5c189752c9a7 [file] [log] [blame]
Yuta HIGUCHIb25f4da2014-10-16 15:09:26 -07001package org.onlab.onos.store.flow;
2
3import static com.google.common.base.Preconditions.checkNotNull;
4
5import org.onlab.onos.event.AbstractEvent;
6import org.onlab.onos.net.DeviceId;
7
8/**
9 * Describes a device replicainfo event.
10 */
11public class ReplicaInfoEvent extends AbstractEvent<ReplicaInfoEvent.Type, DeviceId> {
12
13 private final ReplicaInfo replicaInfo;
14
15 /**
16 * Types of Replica info event.
17 */
18 public enum Type {
19 /**
20 * Event to notify that master placement should be changed.
21 */
22 MASTER_CHANGED,
23 //
24 // BACKUPS_CHANGED?
25 }
26
27
28 /**
29 * Creates an event of a given type and for the specified device,
30 * and replica info.
31 *
32 * @param type replicainfo event type
33 * @param device event device subject
34 * @param replicaInfo replicainfo
35 */
36 public ReplicaInfoEvent(Type type, DeviceId device, ReplicaInfo replicaInfo) {
37 super(type, device);
38 this.replicaInfo = checkNotNull(replicaInfo);
39 }
40
41 /**
42 * Returns the current replica information for the subject.
43 *
44 * @return replica information for the subject
45 */
46 public ReplicaInfo replicaInfo() {
47 return replicaInfo;
48 };
49}