Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Laboratory |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.store.device.impl; |
Yuta HIGUCHI | 9ee60f6 | 2014-10-09 10:00:01 -0700 | [diff] [blame] | 17 | |
| 18 | import static com.google.common.base.Preconditions.checkNotNull; |
| 19 | |
| 20 | import java.util.Map; |
| 21 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 22 | import org.onosproject.cluster.NodeId; |
| 23 | import org.onosproject.net.DeviceId; |
| 24 | import org.onosproject.store.Timestamp; |
Yuta HIGUCHI | 9ee60f6 | 2014-10-09 10:00:01 -0700 | [diff] [blame] | 25 | |
| 26 | |
| 27 | /** |
| 28 | * Device Advertisement message. |
| 29 | */ |
| 30 | public class DeviceAntiEntropyAdvertisement { |
| 31 | |
| 32 | private final NodeId sender; |
| 33 | private final Map<DeviceFragmentId, Timestamp> deviceFingerPrints; |
| 34 | private final Map<PortFragmentId, Timestamp> portFingerPrints; |
| 35 | private final Map<DeviceId, Timestamp> offline; |
| 36 | |
| 37 | |
| 38 | public DeviceAntiEntropyAdvertisement(NodeId sender, |
| 39 | Map<DeviceFragmentId, Timestamp> devices, |
| 40 | Map<PortFragmentId, Timestamp> ports, |
| 41 | Map<DeviceId, Timestamp> offline) { |
| 42 | this.sender = checkNotNull(sender); |
| 43 | this.deviceFingerPrints = checkNotNull(devices); |
| 44 | this.portFingerPrints = checkNotNull(ports); |
| 45 | this.offline = checkNotNull(offline); |
| 46 | } |
| 47 | |
| 48 | public NodeId sender() { |
| 49 | return sender; |
| 50 | } |
| 51 | |
| 52 | public Map<DeviceFragmentId, Timestamp> deviceFingerPrints() { |
| 53 | return deviceFingerPrints; |
| 54 | } |
| 55 | |
| 56 | public Map<PortFragmentId, Timestamp> ports() { |
| 57 | return portFingerPrints; |
| 58 | } |
| 59 | |
| 60 | public Map<DeviceId, Timestamp> offline() { |
| 61 | return offline; |
| 62 | } |
| 63 | |
| 64 | // For serializer |
| 65 | @SuppressWarnings("unused") |
| 66 | private DeviceAntiEntropyAdvertisement() { |
| 67 | this.sender = null; |
| 68 | this.deviceFingerPrints = null; |
| 69 | this.portFingerPrints = null; |
| 70 | this.offline = null; |
| 71 | } |
| 72 | } |