blob: 132f27a01fa8b854dc3366d877158c5504a9fc53 [file] [log] [blame]
Yuta HIGUCHIc057c632014-10-06 18:38:14 -07001package org.onlab.onos.store.common.impl;
Yuta HIGUCHI533ec322014-09-30 13:29:52 -07002
Yuta HIGUCHI533ec322014-09-30 13:29:52 -07003import java.util.Map;
4
5import org.onlab.onos.cluster.NodeId;
6import org.onlab.onos.store.Timestamp;
7
8import com.google.common.collect.ImmutableMap;
9
10/**
11 * Anti-Entropy advertisement message.
Yuta HIGUCHIeeb75a02014-09-30 15:58:08 -070012 * <p>
13 * Message to advertise the information this node holds.
Yuta HIGUCHI533ec322014-09-30 13:29:52 -070014 *
15 * @param <ID> ID type
16 */
Madan Jampani890bc352014-10-01 22:35:29 -070017public class AntiEntropyAdvertisement<ID> {
Yuta HIGUCHI533ec322014-09-30 13:29:52 -070018
19 private final NodeId sender;
20 private final ImmutableMap<ID, Timestamp> advertisement;
21
22 /**
23 * Creates anti-entropy advertisement message.
24 *
25 * @param sender sender of this message
26 * @param advertisement timestamp information of the data sender holds
27 */
28 public AntiEntropyAdvertisement(NodeId sender, Map<ID, Timestamp> advertisement) {
Yuta HIGUCHI533ec322014-09-30 13:29:52 -070029 this.sender = sender;
30 this.advertisement = ImmutableMap.copyOf(advertisement);
31 }
32
33 public NodeId sender() {
34 return sender;
35 }
36
37 public ImmutableMap<ID, Timestamp> advertisement() {
38 return advertisement;
39 }
40
41 // Default constructor for serializer
42 protected AntiEntropyAdvertisement() {
Yuta HIGUCHI533ec322014-09-30 13:29:52 -070043 this.sender = null;
44 this.advertisement = null;
45 }
46}