Refactor change: Moved all distributed primitive implementation classes into ono…
…s-core-primitives bundle Change-Id: Icd5dbd4133cb2f21bd403bcd598e6012813e6bfd
Showing
63 changed files
with
198 additions
and
201 deletions
| ... | @@ -13,14 +13,12 @@ | ... | @@ -13,14 +13,12 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.impl; | 16 | +package org.onosproject.store; |
| 17 | 17 | ||
| 18 | import static com.google.common.base.Preconditions.checkArgument; | 18 | import static com.google.common.base.Preconditions.checkArgument; |
| 19 | 19 | ||
| 20 | import java.util.Objects; | 20 | import java.util.Objects; |
| 21 | 21 | ||
| 22 | -import org.onosproject.store.Timestamp; | ||
| 23 | - | ||
| 24 | import com.google.common.base.MoreObjects; | 22 | import com.google.common.base.MoreObjects; |
| 25 | import com.google.common.collect.ComparisonChain; | 23 | import com.google.common.collect.ComparisonChain; |
| 26 | 24 | ... | ... |
core/store/dist/src/main/java/org/onosproject/store/consistent/impl/package-info.java
deleted
100644 → 0
| 1 | -/* | ||
| 2 | - * Copyright 2015 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 | - */ | ||
| 16 | - | ||
| 17 | -/** | ||
| 18 | - * Implementation of partitioned and distributed store facility capable of | ||
| 19 | - * providing consistent update semantics. | ||
| 20 | - */ | ||
| 21 | -package org.onosproject.store.consistent.impl; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -23,8 +23,8 @@ import org.apache.felix.scr.annotations.Deactivate; | ... | @@ -23,8 +23,8 @@ import org.apache.felix.scr.annotations.Deactivate; |
| 23 | import org.apache.felix.scr.annotations.Reference; | 23 | import org.apache.felix.scr.annotations.Reference; |
| 24 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 24 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 25 | import org.apache.felix.scr.annotations.Service; | 25 | import org.apache.felix.scr.annotations.Service; |
| 26 | +import org.onosproject.store.LogicalTimestamp; | ||
| 26 | import org.onosproject.store.Timestamp; | 27 | import org.onosproject.store.Timestamp; |
| 27 | -import org.onosproject.store.impl.LogicalTimestamp; | ||
| 28 | import org.onosproject.store.service.AtomicCounter; | 28 | import org.onosproject.store.service.AtomicCounter; |
| 29 | import org.onosproject.store.service.LogicalClockService; | 29 | import org.onosproject.store.service.LogicalClockService; |
| 30 | import org.onosproject.store.service.StorageService; | 30 | import org.onosproject.store.service.StorageService; | ... | ... |
| 1 | -/* | ||
| 2 | - * Copyright 2015 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 | - */ | ||
| 16 | - | ||
| 17 | -/** | ||
| 18 | - * Distributed map with eventually-consistent update semantics and gossip | ||
| 19 | - * based anti-entropy mechanism. | ||
| 20 | - */ | ||
| 21 | -package org.onosproject.store.ecmap; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -27,6 +27,7 @@ import org.junit.Ignore; | ... | @@ -27,6 +27,7 @@ import org.junit.Ignore; |
| 27 | import org.junit.Test; | 27 | import org.junit.Test; |
| 28 | import org.onlab.packet.ChassisId; | 28 | import org.onlab.packet.ChassisId; |
| 29 | import org.onlab.packet.IpAddress; | 29 | import org.onlab.packet.IpAddress; |
| 30 | +import org.onlab.util.KryoNamespace; | ||
| 30 | import org.onosproject.cluster.ClusterService; | 31 | import org.onosproject.cluster.ClusterService; |
| 31 | import org.onosproject.cluster.ControllerNode; | 32 | import org.onosproject.cluster.ControllerNode; |
| 32 | import org.onosproject.cluster.DefaultControllerNode; | 33 | import org.onosproject.cluster.DefaultControllerNode; |
| ... | @@ -56,9 +57,10 @@ import org.onosproject.store.cluster.messaging.ClusterCommunicationService; | ... | @@ -56,9 +57,10 @@ import org.onosproject.store.cluster.messaging.ClusterCommunicationService; |
| 56 | import org.onosproject.store.cluster.messaging.ClusterMessage; | 57 | import org.onosproject.store.cluster.messaging.ClusterMessage; |
| 57 | import org.onosproject.store.cluster.messaging.ClusterMessageHandler; | 58 | import org.onosproject.store.cluster.messaging.ClusterMessageHandler; |
| 58 | import org.onosproject.store.cluster.messaging.MessageSubject; | 59 | import org.onosproject.store.cluster.messaging.MessageSubject; |
| 59 | -import org.onosproject.store.consistent.impl.DatabaseManager; | ||
| 60 | import org.onosproject.store.impl.MastershipBasedTimestamp; | 60 | import org.onosproject.store.impl.MastershipBasedTimestamp; |
| 61 | - | 61 | +import org.onosproject.store.service.EventuallyConsistentMap; |
| 62 | +import org.onosproject.store.service.EventuallyConsistentMapBuilder; | ||
| 63 | +import org.onosproject.store.service.StorageService; | ||
| 62 | import java.io.IOException; | 64 | import java.io.IOException; |
| 63 | import java.util.Arrays; | 65 | import java.util.Arrays; |
| 64 | import java.util.Collections; | 66 | import java.util.Collections; |
| ... | @@ -71,6 +73,7 @@ import java.util.concurrent.CountDownLatch; | ... | @@ -71,6 +73,7 @@ import java.util.concurrent.CountDownLatch; |
| 71 | import java.util.concurrent.ExecutorService; | 73 | import java.util.concurrent.ExecutorService; |
| 72 | import java.util.concurrent.TimeUnit; | 74 | import java.util.concurrent.TimeUnit; |
| 73 | import java.util.concurrent.atomic.AtomicLong; | 75 | import java.util.concurrent.atomic.AtomicLong; |
| 76 | +import java.util.function.BiFunction; | ||
| 74 | import java.util.function.Function; | 77 | import java.util.function.Function; |
| 75 | 78 | ||
| 76 | import static java.util.Arrays.asList; | 79 | import static java.util.Arrays.asList; |
| ... | @@ -132,7 +135,9 @@ public class GossipDeviceStoreTest { | ... | @@ -132,7 +135,9 @@ public class GossipDeviceStoreTest { |
| 132 | new DefaultControllerNode(NID2, IpAddress.valueOf("127.0.0.2")); | 135 | new DefaultControllerNode(NID2, IpAddress.valueOf("127.0.0.2")); |
| 133 | private static final List<SparseAnnotations> NO_ANNOTATION = Collections.<SparseAnnotations>emptyList(); | 136 | private static final List<SparseAnnotations> NO_ANNOTATION = Collections.<SparseAnnotations>emptyList(); |
| 134 | 137 | ||
| 135 | - | 138 | + EventuallyConsistentMapBuilder ecMapBuilder; |
| 139 | + EventuallyConsistentMap ecMap; | ||
| 140 | + StorageService testStorageService; | ||
| 136 | private TestGossipDeviceStore testGossipDeviceStore; | 141 | private TestGossipDeviceStore testGossipDeviceStore; |
| 137 | private GossipDeviceStore gossipDeviceStore; | 142 | private GossipDeviceStore gossipDeviceStore; |
| 138 | private DeviceStore deviceStore; | 143 | private DeviceStore deviceStore; |
| ... | @@ -161,9 +166,21 @@ public class GossipDeviceStoreTest { | ... | @@ -161,9 +166,21 @@ public class GossipDeviceStoreTest { |
| 161 | testGossipDeviceStore = new TestGossipDeviceStore(deviceClockService, clusterService, clusterCommunicator); | 166 | testGossipDeviceStore = new TestGossipDeviceStore(deviceClockService, clusterService, clusterCommunicator); |
| 162 | testGossipDeviceStore.mastershipService = new TestMastershipService(); | 167 | testGossipDeviceStore.mastershipService = new TestMastershipService(); |
| 163 | 168 | ||
| 164 | - TestDatabaseManager testDatabaseManager = new TestDatabaseManager(); | 169 | + ecMapBuilder = createNiceMock(EventuallyConsistentMapBuilder.class); |
| 165 | - testDatabaseManager.init(clusterService, clusterCommunicator); | 170 | + expect(ecMapBuilder.withName(anyObject(String.class))).andReturn(ecMapBuilder).anyTimes(); |
| 166 | - testGossipDeviceStore.storageService = testDatabaseManager; | 171 | + expect(ecMapBuilder.withSerializer(anyObject(KryoNamespace.Builder.class))).andReturn(ecMapBuilder).anyTimes(); |
| 172 | + expect(ecMapBuilder.withAntiEntropyPeriod(5, TimeUnit.SECONDS)).andReturn(ecMapBuilder).anyTimes(); | ||
| 173 | + expect(ecMapBuilder.withTimestampProvider(anyObject(BiFunction.class))).andReturn(ecMapBuilder).anyTimes(); | ||
| 174 | + expect(ecMapBuilder.withTombstonesDisabled()).andReturn(ecMapBuilder).anyTimes(); | ||
| 175 | + | ||
| 176 | + ecMap = createNiceMock(EventuallyConsistentMap.class); | ||
| 177 | + expect(ecMapBuilder.build()).andReturn(ecMap).anyTimes(); | ||
| 178 | + testStorageService = createNiceMock(StorageService.class); | ||
| 179 | + expect(testStorageService.eventuallyConsistentMapBuilder()).andReturn(ecMapBuilder).anyTimes(); | ||
| 180 | + | ||
| 181 | + replay(testStorageService, ecMapBuilder, ecMap); | ||
| 182 | + | ||
| 183 | + testGossipDeviceStore.storageService = testStorageService; | ||
| 167 | testGossipDeviceStore.deviceClockService = deviceClockService; | 184 | testGossipDeviceStore.deviceClockService = deviceClockService; |
| 168 | 185 | ||
| 169 | gossipDeviceStore = testGossipDeviceStore; | 186 | gossipDeviceStore = testGossipDeviceStore; |
| ... | @@ -897,12 +914,4 @@ public class GossipDeviceStoreTest { | ... | @@ -897,12 +914,4 @@ public class GossipDeviceStoreTest { |
| 897 | return DID1.equals(deviceId) || DID2.equals(deviceId); | 914 | return DID1.equals(deviceId) || DID2.equals(deviceId); |
| 898 | } | 915 | } |
| 899 | } | 916 | } |
| 900 | - | ||
| 901 | - private class TestDatabaseManager extends DatabaseManager { | ||
| 902 | - void init(ClusterService clusterService, | ||
| 903 | - ClusterCommunicationService clusterCommunicator) { | ||
| 904 | - this.clusterService = clusterService; | ||
| 905 | - this.clusterCommunicator = clusterCommunicator; | ||
| 906 | - } | ||
| 907 | - } | ||
| 908 | } | 917 | } | ... | ... |
| ... | @@ -38,6 +38,36 @@ | ... | @@ -38,6 +38,36 @@ |
| 38 | <artifactId>onos-api</artifactId> | 38 | <artifactId>onos-api</artifactId> |
| 39 | </dependency> | 39 | </dependency> |
| 40 | 40 | ||
| 41 | + <dependency> | ||
| 42 | + <groupId>org.onosproject</groupId> | ||
| 43 | + <artifactId>onos-core-common</artifactId> | ||
| 44 | + <version>${project.version}</version> | ||
| 45 | + </dependency> | ||
| 46 | + | ||
| 47 | + <dependency> | ||
| 48 | + <groupId>org.onosproject</groupId> | ||
| 49 | + <artifactId>onos-core-serializers</artifactId> | ||
| 50 | + <version>${project.version}</version> | ||
| 51 | + </dependency> | ||
| 52 | + | ||
| 53 | + <dependency> | ||
| 54 | + <groupId>org.mapdb</groupId> | ||
| 55 | + <artifactId>mapdb</artifactId> | ||
| 56 | + <version>1.0.8</version> | ||
| 57 | + </dependency> | ||
| 58 | + | ||
| 59 | + <dependency> | ||
| 60 | + <groupId>org.easymock</groupId> | ||
| 61 | + <artifactId>easymock</artifactId> | ||
| 62 | + <scope>test</scope> | ||
| 63 | + </dependency> | ||
| 64 | + <dependency> | ||
| 65 | + <groupId>org.onosproject</groupId> | ||
| 66 | + <artifactId>onos-api</artifactId> | ||
| 67 | + <classifier>tests</classifier> | ||
| 68 | + <scope>test</scope> | ||
| 69 | + </dependency> | ||
| 70 | + | ||
| 41 | <!-- for shaded atomix/copycat --> | 71 | <!-- for shaded atomix/copycat --> |
| 42 | <dependency> | 72 | <dependency> |
| 43 | <groupId>org.onosproject</groupId> | 73 | <groupId>org.onosproject</groupId> | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.ecmap; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import com.google.common.base.MoreObjects; | 18 | import com.google.common.base.MoreObjects; |
| 19 | import com.google.common.collect.ImmutableMap; | 19 | import com.google.common.collect.ImmutableMap; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import java.util.concurrent.CompletableFuture; | 18 | import java.util.concurrent.CompletableFuture; |
| 19 | 19 | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 19 | 19 | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import java.util.Collection; | 18 | import java.util.Collection; |
| 19 | import java.util.Map; | 19 | import java.util.Map; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import java.net.URI; | 18 | import java.net.URI; |
| 19 | import java.nio.ByteBuffer; | 19 | import java.nio.ByteBuffer; | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | import java.util.function.Consumer; | 20 | import java.util.function.Consumer; | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import com.typesafe.config.ConfigValueFactory; | 19 | import com.typesafe.config.ConfigValueFactory; |
| 20 | import net.kuujo.copycat.cluster.ClusterConfig; | 20 | import net.kuujo.copycat.cluster.ClusterConfig; | ... | ... |
| ... | @@ -14,16 +14,23 @@ | ... | @@ -14,16 +14,23 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | -import com.google.common.collect.ArrayListMultimap; | 19 | +import static org.onosproject.app.ApplicationEvent.Type.APP_DEACTIVATED; |
| 20 | -import com.google.common.collect.ImmutableList; | 20 | +import static org.onosproject.app.ApplicationEvent.Type.APP_UNINSTALLED; |
| 21 | -import com.google.common.collect.Lists; | 21 | +import static org.slf4j.LoggerFactory.getLogger; |
| 22 | -import com.google.common.collect.Maps; | 22 | + |
| 23 | -import com.google.common.collect.Multimap; | 23 | +import java.util.Collection; |
| 24 | -import com.google.common.collect.Multimaps; | 24 | +import java.util.List; |
| 25 | -import com.google.common.collect.Sets; | 25 | +import java.util.Map; |
| 26 | -import com.google.common.util.concurrent.Futures; | 26 | +import java.util.Set; |
| 27 | +import java.util.concurrent.CompletableFuture; | ||
| 28 | +import java.util.concurrent.ExecutionException; | ||
| 29 | +import java.util.concurrent.Executors; | ||
| 30 | +import java.util.concurrent.TimeUnit; | ||
| 31 | +import java.util.concurrent.TimeoutException; | ||
| 32 | +import java.util.function.Function; | ||
| 33 | +import java.util.stream.Collectors; | ||
| 27 | 34 | ||
| 28 | import net.kuujo.copycat.CopycatConfig; | 35 | import net.kuujo.copycat.CopycatConfig; |
| 29 | import net.kuujo.copycat.cluster.ClusterConfig; | 36 | import net.kuujo.copycat.cluster.ClusterConfig; |
| ... | @@ -58,37 +65,29 @@ import org.onosproject.core.ApplicationId; | ... | @@ -58,37 +65,29 @@ import org.onosproject.core.ApplicationId; |
| 58 | import org.onosproject.core.IdGenerator; | 65 | import org.onosproject.core.IdGenerator; |
| 59 | import org.onosproject.persistence.PersistenceService; | 66 | import org.onosproject.persistence.PersistenceService; |
| 60 | import org.onosproject.store.cluster.messaging.ClusterCommunicationService; | 67 | import org.onosproject.store.cluster.messaging.ClusterCommunicationService; |
| 61 | -import org.onosproject.store.ecmap.EventuallyConsistentMapBuilderImpl; | ||
| 62 | import org.onosproject.store.service.AtomicCounterBuilder; | 68 | import org.onosproject.store.service.AtomicCounterBuilder; |
| 63 | import org.onosproject.store.service.AtomicValueBuilder; | 69 | import org.onosproject.store.service.AtomicValueBuilder; |
| 64 | import org.onosproject.store.service.ConsistentMapBuilder; | 70 | import org.onosproject.store.service.ConsistentMapBuilder; |
| 65 | import org.onosproject.store.service.ConsistentMapException; | 71 | import org.onosproject.store.service.ConsistentMapException; |
| 66 | import org.onosproject.store.service.DistributedQueueBuilder; | 72 | import org.onosproject.store.service.DistributedQueueBuilder; |
| 73 | +import org.onosproject.store.service.DistributedSetBuilder; | ||
| 67 | import org.onosproject.store.service.EventuallyConsistentMapBuilder; | 74 | import org.onosproject.store.service.EventuallyConsistentMapBuilder; |
| 68 | import org.onosproject.store.service.MapInfo; | 75 | import org.onosproject.store.service.MapInfo; |
| 69 | import org.onosproject.store.service.PartitionInfo; | 76 | import org.onosproject.store.service.PartitionInfo; |
| 70 | -import org.onosproject.store.service.DistributedSetBuilder; | ||
| 71 | import org.onosproject.store.service.StorageAdminService; | 77 | import org.onosproject.store.service.StorageAdminService; |
| 72 | import org.onosproject.store.service.StorageService; | 78 | import org.onosproject.store.service.StorageService; |
| 73 | import org.onosproject.store.service.Transaction; | 79 | import org.onosproject.store.service.Transaction; |
| 74 | import org.onosproject.store.service.TransactionContextBuilder; | 80 | import org.onosproject.store.service.TransactionContextBuilder; |
| 75 | import org.slf4j.Logger; | 81 | import org.slf4j.Logger; |
| 76 | 82 | ||
| 77 | -import java.util.Collection; | 83 | +import com.google.common.collect.ArrayListMultimap; |
| 78 | -import java.util.List; | 84 | +import com.google.common.collect.ImmutableList; |
| 79 | -import java.util.Map; | 85 | +import com.google.common.collect.Lists; |
| 80 | -import java.util.Set; | 86 | +import com.google.common.collect.Maps; |
| 81 | -import java.util.concurrent.CompletableFuture; | 87 | +import com.google.common.collect.Multimap; |
| 82 | -import java.util.concurrent.ExecutionException; | 88 | +import com.google.common.collect.Multimaps; |
| 83 | -import java.util.concurrent.Executors; | 89 | +import com.google.common.collect.Sets; |
| 84 | -import java.util.concurrent.TimeUnit; | 90 | +import com.google.common.util.concurrent.Futures; |
| 85 | -import java.util.concurrent.TimeoutException; | ||
| 86 | -import java.util.function.Function; | ||
| 87 | -import java.util.stream.Collectors; | ||
| 88 | - | ||
| 89 | -import static org.slf4j.LoggerFactory.getLogger; | ||
| 90 | -import static org.onosproject.app.ApplicationEvent.Type.APP_UNINSTALLED; | ||
| 91 | -import static org.onosproject.app.ApplicationEvent.Type.APP_DEACTIVATED; | ||
| 92 | 91 | ||
| 93 | /** | 92 | /** |
| 94 | * Database manager. | 93 | * Database manager. | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import static com.google.common.base.Preconditions.checkState; | 19 | import static com.google.common.base.Preconditions.checkState; |
| 20 | 20 | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import org.onlab.util.Match; | 19 | import org.onlab.util.Match; |
| 20 | import org.onosproject.store.service.Transaction; | 20 | import org.onosproject.store.service.Transaction; | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import java.nio.ByteBuffer; | 19 | import java.nio.ByteBuffer; |
| 20 | 20 | ||
| ... | @@ -76,7 +76,7 @@ public class DatabaseSerializer extends SerializerConfig { | ... | @@ -76,7 +76,7 @@ public class DatabaseSerializer extends SerializerConfig { |
| 76 | .register(Result.Status.class) | 76 | .register(Result.Status.class) |
| 77 | .register(DefaultTransaction.class) | 77 | .register(DefaultTransaction.class) |
| 78 | .register(Transaction.State.class) | 78 | .register(Transaction.State.class) |
| 79 | - .register(org.onosproject.store.consistent.impl.CommitResponse.class) | 79 | + .register(org.onosproject.store.primitives.impl.CommitResponse.class) |
| 80 | .register(Match.class) | 80 | .register(Match.class) |
| 81 | .register(NodeId.class) | 81 | .register(NodeId.class) |
| 82 | .build(); | 82 | .build(); | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import net.kuujo.copycat.state.Command; | 19 | import net.kuujo.copycat.state.Command; |
| 20 | import net.kuujo.copycat.state.Initializer; | 20 | import net.kuujo.copycat.state.Initializer; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import org.onosproject.store.service.AsyncAtomicCounter; | 18 | import org.onosproject.store.service.AsyncAtomicCounter; |
| 19 | 19 | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import org.onosproject.store.service.AsyncAtomicValue; | 18 | import org.onosproject.store.service.AsyncAtomicValue; |
| 19 | import org.onosproject.store.service.AsyncConsistentMap; | 19 | import org.onosproject.store.service.AsyncConsistentMap; | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import com.google.common.cache.CacheBuilder; | 19 | import com.google.common.cache.CacheBuilder; |
| 20 | import com.google.common.cache.CacheLoader; | 20 | import com.google.common.cache.CacheLoader; |
| ... | @@ -50,8 +50,8 @@ import java.util.function.Predicate; | ... | @@ -50,8 +50,8 @@ import java.util.function.Predicate; |
| 50 | import java.util.stream.Collectors; | 50 | import java.util.stream.Collectors; |
| 51 | 51 | ||
| 52 | import static com.google.common.base.Preconditions.checkNotNull; | 52 | import static com.google.common.base.Preconditions.checkNotNull; |
| 53 | -import static org.onosproject.store.consistent.impl.StateMachineUpdate.Target.MAP_UPDATE; | 53 | +import static org.onosproject.store.primitives.impl.StateMachineUpdate.Target.MAP_UPDATE; |
| 54 | -import static org.onosproject.store.consistent.impl.StateMachineUpdate.Target.TX_COMMIT; | 54 | +import static org.onosproject.store.primitives.impl.StateMachineUpdate.Target.TX_COMMIT; |
| 55 | import static org.slf4j.LoggerFactory.getLogger; | 55 | import static org.slf4j.LoggerFactory.getLogger; |
| 56 | 56 | ||
| 57 | /** | 57 | /** | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import java.util.Collection; | 18 | import java.util.Collection; |
| 19 | import java.util.Map; | 19 | import java.util.Map; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import org.onosproject.store.service.AsyncAtomicCounter; | 18 | import org.onosproject.store.service.AsyncAtomicCounter; |
| 19 | import org.onosproject.store.service.AtomicCounter; | 19 | import org.onosproject.store.service.AtomicCounter; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import org.onosproject.store.service.AsyncAtomicCounter; | 18 | import org.onosproject.store.service.AsyncAtomicCounter; |
| 19 | import org.onosproject.store.service.AtomicCounter; | 19 | import org.onosproject.store.service.AtomicCounter; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import java.util.concurrent.CompletableFuture; | 18 | import java.util.concurrent.CompletableFuture; |
| 19 | import java.util.concurrent.TimeUnit; | 19 | import java.util.concurrent.TimeUnit; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import org.onosproject.store.serializers.KryoNamespaces; | 18 | import org.onosproject.store.serializers.KryoNamespaces; |
| 19 | import org.onosproject.store.service.AsyncAtomicValue; | 19 | import org.onosproject.store.service.AsyncAtomicValue; | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import java.util.Collection; | 19 | import java.util.Collection; |
| 20 | import java.util.Map; | 20 | import java.util.Map; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import org.onosproject.core.ApplicationId; | 18 | import org.onosproject.core.ApplicationId; |
| 19 | import org.onosproject.store.service.AsyncConsistentMap; | 19 | import org.onosproject.store.service.AsyncConsistentMap; | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import com.google.common.collect.Sets; | 19 | import com.google.common.collect.Sets; |
| 20 | 20 | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import com.google.common.base.Objects; | 19 | import com.google.common.base.Objects; |
| 20 | import com.google.common.collect.ImmutableList; | 20 | import com.google.common.collect.ImmutableList; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import com.google.common.collect.Sets; | 18 | import com.google.common.collect.Sets; |
| 19 | import com.google.common.util.concurrent.Futures; | 19 | import com.google.common.util.concurrent.Futures; |
| ... | @@ -28,7 +28,7 @@ import java.util.Set; | ... | @@ -28,7 +28,7 @@ import java.util.Set; |
| 28 | import java.util.concurrent.CompletableFuture; | 28 | import java.util.concurrent.CompletableFuture; |
| 29 | 29 | ||
| 30 | import static com.google.common.base.Preconditions.checkNotNull; | 30 | import static com.google.common.base.Preconditions.checkNotNull; |
| 31 | -import static org.onosproject.store.consistent.impl.StateMachineUpdate.Target.QUEUE_PUSH; | 31 | +import static org.onosproject.store.primitives.impl.StateMachineUpdate.Target.QUEUE_PUSH; |
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | * DistributedQueue implementation that provides FIFO ordering semantics. | 34 | * DistributedQueue implementation that provides FIFO ordering semantics. | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import org.onosproject.store.service.DistributedQueue; | 18 | import org.onosproject.store.service.DistributedQueue; |
| 19 | import org.onosproject.store.service.DistributedQueueBuilder; | 19 | import org.onosproject.store.service.DistributedQueueBuilder; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import org.onosproject.store.service.AsyncDistributedSet; | 18 | import org.onosproject.store.service.AsyncDistributedSet; |
| 19 | import org.onosproject.store.service.ConsistentMapException; | 19 | import org.onosproject.store.service.ConsistentMapException; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import org.onosproject.core.ApplicationId; | 18 | import org.onosproject.core.ApplicationId; |
| 19 | import org.onosproject.store.service.AsyncDistributedSet; | 19 | import org.onosproject.store.service.AsyncDistributedSet; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import java.util.List; | 18 | import java.util.List; |
| 19 | 19 | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import java.util.List; | 19 | import java.util.List; |
| 20 | import java.util.Map; | 20 | import java.util.Map; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import org.onosproject.store.service.TransactionContext; | 18 | import org.onosproject.store.service.TransactionContext; |
| 19 | import org.onosproject.store.service.TransactionContextBuilder; | 19 | import org.onosproject.store.service.TransactionContextBuilder; | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import java.util.List; | 19 | import java.util.List; |
| 20 | import java.util.Map; | 20 | import java.util.Map; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | import org.onosproject.store.service.Serializer; | 19 | import org.onosproject.store.service.Serializer; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import com.google.common.collect.ImmutableList; | 18 | import com.google.common.collect.ImmutableList; |
| 19 | import com.google.common.collect.ImmutableMap; | 19 | import com.google.common.collect.ImmutableMap; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.ecmap; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import org.onlab.util.KryoNamespace; | 18 | import org.onlab.util.KryoNamespace; |
| 19 | import org.onosproject.cluster.ClusterService; | 19 | import org.onosproject.cluster.ClusterService; | ... | ... |
| ... | @@ -13,14 +13,33 @@ | ... | @@ -13,14 +13,33 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.ecmap; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | + | ||
| 18 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
| 19 | +import static com.google.common.base.Preconditions.checkState; | ||
| 20 | +import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | ||
| 21 | +import static org.onlab.util.BoundedThreadPool.newFixedThreadPool; | ||
| 22 | +import static org.onlab.util.Tools.groupedThreads; | ||
| 23 | +import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.PUT; | ||
| 24 | +import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.REMOVE; | ||
| 25 | + | ||
| 26 | +import java.util.Collection; | ||
| 27 | +import java.util.Collections; | ||
| 28 | +import java.util.List; | ||
| 29 | +import java.util.Map; | ||
| 30 | +import java.util.Objects; | ||
| 31 | +import java.util.Optional; | ||
| 32 | +import java.util.Set; | ||
| 33 | +import java.util.Timer; | ||
| 34 | +import java.util.concurrent.ExecutorService; | ||
| 35 | +import java.util.concurrent.Executors; | ||
| 36 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 37 | +import java.util.concurrent.TimeUnit; | ||
| 38 | +import java.util.concurrent.atomic.AtomicBoolean; | ||
| 39 | +import java.util.concurrent.atomic.AtomicReference; | ||
| 40 | +import java.util.function.BiFunction; | ||
| 41 | +import java.util.stream.Collectors; | ||
| 17 | 42 | ||
| 18 | -import com.google.common.collect.Collections2; | ||
| 19 | -import com.google.common.collect.ImmutableList; | ||
| 20 | -import com.google.common.collect.ImmutableMap; | ||
| 21 | -import com.google.common.collect.Lists; | ||
| 22 | -import com.google.common.collect.Maps; | ||
| 23 | -import com.google.common.collect.Sets; | ||
| 24 | import org.apache.commons.lang3.tuple.Pair; | 43 | import org.apache.commons.lang3.tuple.Pair; |
| 25 | import org.onlab.util.AbstractAccumulator; | 44 | import org.onlab.util.AbstractAccumulator; |
| 26 | import org.onlab.util.KryoNamespace; | 45 | import org.onlab.util.KryoNamespace; |
| ... | @@ -29,10 +48,10 @@ import org.onosproject.cluster.ClusterService; | ... | @@ -29,10 +48,10 @@ import org.onosproject.cluster.ClusterService; |
| 29 | import org.onosproject.cluster.ControllerNode; | 48 | import org.onosproject.cluster.ControllerNode; |
| 30 | import org.onosproject.cluster.NodeId; | 49 | import org.onosproject.cluster.NodeId; |
| 31 | import org.onosproject.persistence.PersistenceService; | 50 | import org.onosproject.persistence.PersistenceService; |
| 51 | +import org.onosproject.store.LogicalTimestamp; | ||
| 32 | import org.onosproject.store.Timestamp; | 52 | import org.onosproject.store.Timestamp; |
| 33 | import org.onosproject.store.cluster.messaging.ClusterCommunicationService; | 53 | import org.onosproject.store.cluster.messaging.ClusterCommunicationService; |
| 34 | import org.onosproject.store.cluster.messaging.MessageSubject; | 54 | import org.onosproject.store.cluster.messaging.MessageSubject; |
| 35 | -import org.onosproject.store.impl.LogicalTimestamp; | ||
| 36 | import org.onosproject.store.serializers.KryoNamespaces; | 55 | import org.onosproject.store.serializers.KryoNamespaces; |
| 37 | import org.onosproject.store.serializers.KryoSerializer; | 56 | import org.onosproject.store.serializers.KryoSerializer; |
| 38 | import org.onosproject.store.service.EventuallyConsistentMap; | 57 | import org.onosproject.store.service.EventuallyConsistentMap; |
| ... | @@ -43,30 +62,12 @@ import org.onosproject.store.service.WallClockTimestamp; | ... | @@ -43,30 +62,12 @@ import org.onosproject.store.service.WallClockTimestamp; |
| 43 | import org.slf4j.Logger; | 62 | import org.slf4j.Logger; |
| 44 | import org.slf4j.LoggerFactory; | 63 | import org.slf4j.LoggerFactory; |
| 45 | 64 | ||
| 46 | -import java.util.Collection; | 65 | +import com.google.common.collect.Collections2; |
| 47 | -import java.util.Collections; | 66 | +import com.google.common.collect.ImmutableList; |
| 48 | -import java.util.List; | 67 | +import com.google.common.collect.ImmutableMap; |
| 49 | -import java.util.Map; | 68 | +import com.google.common.collect.Lists; |
| 50 | -import java.util.Objects; | 69 | +import com.google.common.collect.Maps; |
| 51 | -import java.util.Optional; | 70 | +import com.google.common.collect.Sets; |
| 52 | -import java.util.Set; | ||
| 53 | -import java.util.Timer; | ||
| 54 | -import java.util.concurrent.ExecutorService; | ||
| 55 | -import java.util.concurrent.Executors; | ||
| 56 | -import java.util.concurrent.ScheduledExecutorService; | ||
| 57 | -import java.util.concurrent.TimeUnit; | ||
| 58 | -import java.util.concurrent.atomic.AtomicBoolean; | ||
| 59 | -import java.util.concurrent.atomic.AtomicReference; | ||
| 60 | -import java.util.function.BiFunction; | ||
| 61 | -import java.util.stream.Collectors; | ||
| 62 | - | ||
| 63 | -import static com.google.common.base.Preconditions.checkNotNull; | ||
| 64 | -import static com.google.common.base.Preconditions.checkState; | ||
| 65 | -import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | ||
| 66 | -import static org.onlab.util.BoundedThreadPool.newFixedThreadPool; | ||
| 67 | -import static org.onlab.util.Tools.groupedThreads; | ||
| 68 | -import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.PUT; | ||
| 69 | -import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.REMOVE; | ||
| 70 | 71 | ||
| 71 | /** | 72 | /** |
| 72 | * Distributed Map implementation which uses optimistic replication and gossip | 73 | * Distributed Map implementation which uses optimistic replication and gossip | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.ecmap; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import org.mapdb.DB; | 19 | import org.mapdb.DB; |
| 20 | import org.mapdb.DBMaker; | 20 | import org.mapdb.DBMaker; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.ecmap; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import org.onosproject.store.Timestamp; | 18 | import org.onosproject.store.Timestamp; |
| 19 | 19 | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import java.util.Arrays; | 18 | import java.util.Arrays; |
| 19 | import java.util.Collection; | 19 | import java.util.Collection; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import com.codahale.metrics.Counter; | 18 | import com.codahale.metrics.Counter; |
| 19 | import com.codahale.metrics.Timer; | 19 | import com.codahale.metrics.Timer; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import static org.slf4j.LoggerFactory.getLogger; | 18 | import static org.slf4j.LoggerFactory.getLogger; |
| 19 | 19 | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import com.google.common.collect.ImmutableList; | 19 | import com.google.common.collect.ImmutableList; |
| 20 | import com.google.common.collect.Lists; | 20 | import com.google.common.collect.Lists; | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| 20 | * Partitioner is responsible for mapping keys to individual database partitions. | 20 | * Partitioner is responsible for mapping keys to individual database partitions. | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 19 | 19 | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import java.util.List; | 19 | import java.util.List; |
| 20 | 20 | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.store.consistent.impl; | 17 | +package org.onosproject.store.primitives.impl; |
| 18 | 18 | ||
| 19 | import java.util.List; | 19 | import java.util.List; |
| 20 | 20 | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 19 | 19 | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
| 19 | 19 | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.ecmap; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
| 19 | 19 | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import java.util.function.Function; | 18 | import java.util.function.Function; |
| 19 | 19 | ... | ... |
| 1 | /* | 1 | /* |
| 2 | - * Copyright 2016 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
| 3 | * | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
| ... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| 18 | - * Implementation for distributed state management primitives. | 18 | + * Implementation of partitioned and distributed store facility capable of |
| 19 | + * providing consistent update semantics. | ||
| 19 | */ | 20 | */ |
| 20 | package org.onosproject.store.primitives.impl; | 21 | package org.onosproject.store.primitives.impl; |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -13,12 +13,13 @@ | ... | @@ -13,12 +13,13 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import static java.util.Collections.unmodifiableCollection; | 18 | import static java.util.Collections.unmodifiableCollection; |
| 19 | import static java.util.Collections.unmodifiableSet; | 19 | import static java.util.Collections.unmodifiableSet; |
| 20 | import static org.hamcrest.Matchers.is; | 20 | import static org.hamcrest.Matchers.is; |
| 21 | -import static org.junit.Assert.*; | 21 | +import static org.junit.Assert.assertEquals; |
| 22 | +import static org.junit.Assert.assertThat; | ||
| 22 | 23 | ||
| 23 | import java.util.Collection; | 24 | import java.util.Collection; |
| 24 | import java.util.Map; | 25 | import java.util.Map; |
| ... | @@ -29,6 +30,10 @@ import java.util.concurrent.CompletableFuture; | ... | @@ -29,6 +30,10 @@ import java.util.concurrent.CompletableFuture; |
| 29 | import java.util.concurrent.ConcurrentHashMap; | 30 | import java.util.concurrent.ConcurrentHashMap; |
| 30 | import java.util.function.Consumer; | 31 | import java.util.function.Consumer; |
| 31 | 32 | ||
| 33 | +import net.kuujo.copycat.Task; | ||
| 34 | +import net.kuujo.copycat.cluster.Cluster; | ||
| 35 | +import net.kuujo.copycat.resource.ResourceState; | ||
| 36 | + | ||
| 32 | import org.junit.After; | 37 | import org.junit.After; |
| 33 | import org.junit.Before; | 38 | import org.junit.Before; |
| 34 | import org.junit.Test; | 39 | import org.junit.Test; |
| ... | @@ -44,10 +49,6 @@ import com.google.common.collect.ImmutableMap; | ... | @@ -44,10 +49,6 @@ import com.google.common.collect.ImmutableMap; |
| 44 | import com.google.common.collect.ImmutableSet; | 49 | import com.google.common.collect.ImmutableSet; |
| 45 | import com.google.common.collect.Maps; | 50 | import com.google.common.collect.Maps; |
| 46 | 51 | ||
| 47 | -import net.kuujo.copycat.Task; | ||
| 48 | -import net.kuujo.copycat.cluster.Cluster; | ||
| 49 | -import net.kuujo.copycat.resource.ResourceState; | ||
| 50 | - | ||
| 51 | /** | 52 | /** |
| 52 | * | 53 | * |
| 53 | */ | 54 | */ | ... | ... |
| ... | @@ -13,7 +13,22 @@ | ... | @@ -13,7 +13,22 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.ecmap; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | + | ||
| 18 | +import static com.google.common.base.Preconditions.checkArgument; | ||
| 19 | +import static junit.framework.TestCase.assertFalse; | ||
| 20 | +import static org.easymock.EasyMock.anyObject; | ||
| 21 | +import static org.easymock.EasyMock.createMock; | ||
| 22 | +import static org.easymock.EasyMock.eq; | ||
| 23 | +import static org.easymock.EasyMock.expect; | ||
| 24 | +import static org.easymock.EasyMock.expectLastCall; | ||
| 25 | +import static org.easymock.EasyMock.replay; | ||
| 26 | +import static org.easymock.EasyMock.reset; | ||
| 27 | +import static org.easymock.EasyMock.verify; | ||
| 28 | +import static org.junit.Assert.assertEquals; | ||
| 29 | +import static org.junit.Assert.assertNull; | ||
| 30 | +import static org.junit.Assert.assertTrue; | ||
| 31 | +import static org.junit.Assert.fail; | ||
| 17 | 32 | ||
| 18 | import java.util.ArrayList; | 33 | import java.util.ArrayList; |
| 19 | import java.util.Collection; | 34 | import java.util.Collection; |
| ... | @@ -43,11 +58,11 @@ import org.onosproject.cluster.DefaultControllerNode; | ... | @@ -43,11 +58,11 @@ import org.onosproject.cluster.DefaultControllerNode; |
| 43 | import org.onosproject.cluster.NodeId; | 58 | import org.onosproject.cluster.NodeId; |
| 44 | import org.onosproject.event.AbstractEvent; | 59 | import org.onosproject.event.AbstractEvent; |
| 45 | import org.onosproject.persistence.PersistenceService; | 60 | import org.onosproject.persistence.PersistenceService; |
| 61 | +import org.onosproject.store.LogicalTimestamp; | ||
| 46 | import org.onosproject.store.Timestamp; | 62 | import org.onosproject.store.Timestamp; |
| 47 | import org.onosproject.store.cluster.messaging.ClusterCommunicationService; | 63 | import org.onosproject.store.cluster.messaging.ClusterCommunicationService; |
| 48 | import org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter; | 64 | import org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter; |
| 49 | import org.onosproject.store.cluster.messaging.MessageSubject; | 65 | import org.onosproject.store.cluster.messaging.MessageSubject; |
| 50 | -import org.onosproject.store.impl.LogicalTimestamp; | ||
| 51 | import org.onosproject.store.persistence.TestPersistenceService; | 66 | import org.onosproject.store.persistence.TestPersistenceService; |
| 52 | import org.onosproject.store.serializers.KryoNamespaces; | 67 | import org.onosproject.store.serializers.KryoNamespaces; |
| 53 | import org.onosproject.store.serializers.KryoSerializer; | 68 | import org.onosproject.store.serializers.KryoSerializer; |
| ... | @@ -61,21 +76,6 @@ import com.google.common.collect.ImmutableList; | ... | @@ -61,21 +76,6 @@ import com.google.common.collect.ImmutableList; |
| 61 | import com.google.common.collect.ImmutableSet; | 76 | import com.google.common.collect.ImmutableSet; |
| 62 | import com.google.common.util.concurrent.MoreExecutors; | 77 | import com.google.common.util.concurrent.MoreExecutors; |
| 63 | 78 | ||
| 64 | -import static com.google.common.base.Preconditions.checkArgument; | ||
| 65 | -import static junit.framework.TestCase.assertFalse; | ||
| 66 | -import static org.easymock.EasyMock.anyObject; | ||
| 67 | -import static org.easymock.EasyMock.createMock; | ||
| 68 | -import static org.easymock.EasyMock.eq; | ||
| 69 | -import static org.easymock.EasyMock.expect; | ||
| 70 | -import static org.easymock.EasyMock.expectLastCall; | ||
| 71 | -import static org.easymock.EasyMock.replay; | ||
| 72 | -import static org.easymock.EasyMock.reset; | ||
| 73 | -import static org.easymock.EasyMock.verify; | ||
| 74 | -import static org.junit.Assert.assertEquals; | ||
| 75 | -import static org.junit.Assert.assertNull; | ||
| 76 | -import static org.junit.Assert.assertTrue; | ||
| 77 | -import static org.junit.Assert.fail; | ||
| 78 | - | ||
| 79 | /** | 79 | /** |
| 80 | * Unit tests for EventuallyConsistentMapImpl. | 80 | * Unit tests for EventuallyConsistentMapImpl. |
| 81 | */ | 81 | */ | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.ecmap; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import static org.junit.Assert.assertEquals; | 18 | import static org.junit.Assert.assertEquals; |
| 19 | import static org.junit.Assert.assertFalse; | 19 | import static org.junit.Assert.assertFalse; |
| ... | @@ -21,9 +21,9 @@ import static org.junit.Assert.assertNull; | ... | @@ -21,9 +21,9 @@ import static org.junit.Assert.assertNull; |
| 21 | import static org.junit.Assert.assertTrue; | 21 | import static org.junit.Assert.assertTrue; |
| 22 | 22 | ||
| 23 | import org.junit.Test; | 23 | import org.junit.Test; |
| 24 | +import org.onosproject.store.LogicalTimestamp; | ||
| 24 | import org.onosproject.store.Timestamp; | 25 | import org.onosproject.store.Timestamp; |
| 25 | -import org.onosproject.store.ecmap.MapValue.Digest; | 26 | +import org.onosproject.store.primitives.impl.MapValue.Digest; |
| 26 | -import org.onosproject.store.impl.LogicalTimestamp; | ||
| 27 | 27 | ||
| 28 | /** | 28 | /** |
| 29 | * Unit tests for MapValue. | 29 | * Unit tests for MapValue. | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import static junit.framework.TestCase.assertEquals; | 18 | import static junit.framework.TestCase.assertEquals; |
| 19 | import static junit.framework.TestCase.assertFalse; | 19 | import static junit.framework.TestCase.assertFalse; | ... | ... |
| ... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.store.consistent.impl; | 16 | +package org.onosproject.store.primitives.impl; |
| 17 | 17 | ||
| 18 | import static junit.framework.TestCase.assertEquals; | 18 | import static junit.framework.TestCase.assertEquals; |
| 19 | import static junit.framework.TestCase.assertNull; | 19 | import static junit.framework.TestCase.assertNull; | ... | ... |
-
Please register or login to post a comment