BUG-7594: Rework sal-remoterpc-connector messages
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / main / java / org / opendaylight / controller / remote / rpc / registry / gossip / GossipEnvelope.java
1 /*
2  * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.remote.rpc.registry.gossip;
9
10 import akka.actor.Address;
11 import com.google.common.base.Preconditions;
12 import com.google.common.collect.ImmutableMap;
13 import java.io.Serializable;
14 import java.util.Map;
15
16 final class GossipEnvelope implements Serializable {
17     private static final long serialVersionUID = 1L;
18
19     private final Map<Address, Bucket<?>> buckets;
20     private final Address from;
21     private final Address to;
22
23     GossipEnvelope(final Address from, final Address to, final Map<Address, ? extends Bucket<?>> buckets) {
24         this.to = Preconditions.checkNotNull(to);
25         this.buckets = ImmutableMap.copyOf(buckets);
26         this.from = from;
27     }
28
29     Map<Address, Bucket<?>> buckets() {
30         return buckets;
31     }
32
33     Address from() {
34         return from;
35     }
36
37     Address to() {
38         return to;
39     }
40 }