Sho SHIMIZU

Rename class by replacing Store with SubStore

Change-Id: I3775d930f593eab983a8da8a4823bae8d45645cb
...@@ -41,11 +41,11 @@ import static org.onosproject.store.resource.impl.ConsistentResourceStore.RETRY_ ...@@ -41,11 +41,11 @@ import static org.onosproject.store.resource.impl.ConsistentResourceStore.RETRY_
41 import static org.onosproject.store.resource.impl.ConsistentResourceStore.SERIALIZER; 41 import static org.onosproject.store.resource.impl.ConsistentResourceStore.SERIALIZER;
42 import static org.onosproject.store.resource.impl.ContinuousResourceAllocation.hasEnoughResource; 42 import static org.onosproject.store.resource.impl.ContinuousResourceAllocation.hasEnoughResource;
43 43
44 -class ConsistentContinuousResourceStore { 44 +class ConsistentContinuousResourceSubStore {
45 private ConsistentMap<ContinuousResourceId, ContinuousResourceAllocation> consumers; 45 private ConsistentMap<ContinuousResourceId, ContinuousResourceAllocation> consumers;
46 private ConsistentMap<DiscreteResourceId, Set<ContinuousResource>> childMap; 46 private ConsistentMap<DiscreteResourceId, Set<ContinuousResource>> childMap;
47 47
48 - ConsistentContinuousResourceStore(StorageService service) { 48 + ConsistentContinuousResourceSubStore(StorageService service) {
49 this.consumers = service.<ContinuousResourceId, ContinuousResourceAllocation>consistentMapBuilder() 49 this.consumers = service.<ContinuousResourceId, ContinuousResourceAllocation>consistentMapBuilder()
50 .withName(MapNames.CONTINUOUS_CONSUMER_MAP) 50 .withName(MapNames.CONTINUOUS_CONSUMER_MAP)
51 .withSerializer(SERIALIZER) 51 .withSerializer(SERIALIZER)
...@@ -59,8 +59,8 @@ class ConsistentContinuousResourceStore { ...@@ -59,8 +59,8 @@ class ConsistentContinuousResourceStore {
59 ConsistentMapException.class, MAX_RETRIES, RETRY_DELAY); 59 ConsistentMapException.class, MAX_RETRIES, RETRY_DELAY);
60 } 60 }
61 61
62 - TransactionalContinuousResourceStore transactional(TransactionContext tx) { 62 + TransactionalContinuousResourceSubStore transactional(TransactionContext tx) {
63 - return new TransactionalContinuousResourceStore(tx); 63 + return new TransactionalContinuousResourceSubStore(tx);
64 } 64 }
65 65
66 // computational complexity: O(n) where n is the number of the existing allocations for the resource 66 // computational complexity: O(n) where n is the number of the existing allocations for the resource
......
...@@ -40,11 +40,11 @@ import static org.onosproject.store.resource.impl.ConsistentResourceStore.MAX_RE ...@@ -40,11 +40,11 @@ import static org.onosproject.store.resource.impl.ConsistentResourceStore.MAX_RE
40 import static org.onosproject.store.resource.impl.ConsistentResourceStore.RETRY_DELAY; 40 import static org.onosproject.store.resource.impl.ConsistentResourceStore.RETRY_DELAY;
41 import static org.onosproject.store.resource.impl.ConsistentResourceStore.SERIALIZER; 41 import static org.onosproject.store.resource.impl.ConsistentResourceStore.SERIALIZER;
42 42
43 -class ConsistentDiscreteResourceStore { 43 +class ConsistentDiscreteResourceSubStore {
44 private ConsistentMap<DiscreteResourceId, ResourceConsumerId> consumers; 44 private ConsistentMap<DiscreteResourceId, ResourceConsumerId> consumers;
45 private ConsistentMap<DiscreteResourceId, Set<DiscreteResource>> childMap; 45 private ConsistentMap<DiscreteResourceId, Set<DiscreteResource>> childMap;
46 46
47 - ConsistentDiscreteResourceStore(StorageService service) { 47 + ConsistentDiscreteResourceSubStore(StorageService service) {
48 this.consumers = service.<DiscreteResourceId, ResourceConsumerId>consistentMapBuilder() 48 this.consumers = service.<DiscreteResourceId, ResourceConsumerId>consistentMapBuilder()
49 .withName(MapNames.DISCRETE_CONSUMER_MAP) 49 .withName(MapNames.DISCRETE_CONSUMER_MAP)
50 .withSerializer(SERIALIZER) 50 .withSerializer(SERIALIZER)
...@@ -58,8 +58,8 @@ class ConsistentDiscreteResourceStore { ...@@ -58,8 +58,8 @@ class ConsistentDiscreteResourceStore {
58 ConsistentMapException.class, MAX_RETRIES, RETRY_DELAY); 58 ConsistentMapException.class, MAX_RETRIES, RETRY_DELAY);
59 } 59 }
60 60
61 - TransactionalDiscreteResourceStore transactional(TransactionContext tx) { 61 + TransactionalDiscreteResourceSubStore transactional(TransactionContext tx) {
62 - return new TransactionalDiscreteResourceStore(tx); 62 + return new TransactionalDiscreteResourceSubStore(tx);
63 } 63 }
64 64
65 // computational complexity: O(1) 65 // computational complexity: O(1)
......
...@@ -80,13 +80,13 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour ...@@ -80,13 +80,13 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
80 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 80 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
81 protected StorageService service; 81 protected StorageService service;
82 82
83 - private ConsistentDiscreteResourceStore discreteStore; 83 + private ConsistentDiscreteResourceSubStore discreteStore;
84 - private ConsistentContinuousResourceStore continuousStore; 84 + private ConsistentContinuousResourceSubStore continuousStore;
85 85
86 @Activate 86 @Activate
87 public void activate() { 87 public void activate() {
88 - discreteStore = new ConsistentDiscreteResourceStore(service); 88 + discreteStore = new ConsistentDiscreteResourceSubStore(service);
89 - continuousStore = new ConsistentContinuousResourceStore(service); 89 + continuousStore = new ConsistentContinuousResourceSubStore(service);
90 90
91 log.info("Started"); 91 log.info("Started");
92 } 92 }
...@@ -120,8 +120,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour ...@@ -120,8 +120,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
120 .filter(x -> x.parent().isPresent()) 120 .filter(x -> x.parent().isPresent())
121 .collect(Collectors.groupingBy(x -> x.parent().get(), LinkedHashMap::new, Collectors.toList())); 121 .collect(Collectors.groupingBy(x -> x.parent().get(), LinkedHashMap::new, Collectors.toList()));
122 122
123 - TransactionalDiscreteResourceStore discreteTxStore = discreteStore.transactional(tx); 123 + TransactionalDiscreteResourceSubStore discreteTxStore = discreteStore.transactional(tx);
124 - TransactionalContinuousResourceStore continuousTxStore = continuousStore.transactional(tx); 124 + TransactionalContinuousResourceSubStore continuousTxStore = continuousStore.transactional(tx);
125 for (Map.Entry<DiscreteResource, List<Resource>> entry : resourceMap.entrySet()) { 125 for (Map.Entry<DiscreteResource, List<Resource>> entry : resourceMap.entrySet()) {
126 DiscreteResourceId parentId = entry.getKey().id(); 126 DiscreteResourceId parentId = entry.getKey().id();
127 if (!discreteTxStore.lookup(parentId).isPresent()) { 127 if (!discreteTxStore.lookup(parentId).isPresent()) {
...@@ -154,8 +154,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour ...@@ -154,8 +154,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
154 TransactionContext tx = service.transactionContextBuilder().build(); 154 TransactionContext tx = service.transactionContextBuilder().build();
155 tx.begin(); 155 tx.begin();
156 156
157 - TransactionalDiscreteResourceStore discreteTxStore = discreteStore.transactional(tx); 157 + TransactionalDiscreteResourceSubStore discreteTxStore = discreteStore.transactional(tx);
158 - TransactionalContinuousResourceStore continuousTxStore = continuousStore.transactional(tx); 158 + TransactionalContinuousResourceSubStore continuousTxStore = continuousStore.transactional(tx);
159 // Look up resources by resource IDs 159 // Look up resources by resource IDs
160 List<Resource> resources = ids.stream() 160 List<Resource> resources = ids.stream()
161 .filter(x -> x.parent().isPresent()) 161 .filter(x -> x.parent().isPresent())
...@@ -205,8 +205,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour ...@@ -205,8 +205,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
205 TransactionContext tx = service.transactionContextBuilder().build(); 205 TransactionContext tx = service.transactionContextBuilder().build();
206 tx.begin(); 206 tx.begin();
207 207
208 - TransactionalDiscreteResourceStore discreteTxStore = discreteStore.transactional(tx); 208 + TransactionalDiscreteResourceSubStore discreteTxStore = discreteStore.transactional(tx);
209 - TransactionalContinuousResourceStore continuousTxStore = continuousStore.transactional(tx); 209 + TransactionalContinuousResourceSubStore continuousTxStore = continuousStore.transactional(tx);
210 for (Resource resource : resources) { 210 for (Resource resource : resources) {
211 if (resource instanceof DiscreteResource) { 211 if (resource instanceof DiscreteResource) {
212 if (!discreteTxStore.allocate(consumer.consumerId(), (DiscreteResource) resource)) { 212 if (!discreteTxStore.allocate(consumer.consumerId(), (DiscreteResource) resource)) {
...@@ -229,8 +229,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour ...@@ -229,8 +229,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
229 TransactionContext tx = service.transactionContextBuilder().build(); 229 TransactionContext tx = service.transactionContextBuilder().build();
230 tx.begin(); 230 tx.begin();
231 231
232 - TransactionalDiscreteResourceStore discreteTxStore = discreteStore.transactional(tx); 232 + TransactionalDiscreteResourceSubStore discreteTxStore = discreteStore.transactional(tx);
233 - TransactionalContinuousResourceStore continuousTxStore = continuousStore.transactional(tx); 233 + TransactionalContinuousResourceSubStore continuousTxStore = continuousStore.transactional(tx);
234 for (ResourceAllocation allocation : allocations) { 234 for (ResourceAllocation allocation : allocations) {
235 Resource resource = allocation.resource(); 235 Resource resource = allocation.resource();
236 ResourceConsumerId consumerId = allocation.consumerId(); 236 ResourceConsumerId consumerId = allocation.consumerId();
...@@ -323,8 +323,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour ...@@ -323,8 +323,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
323 * @return true if the operation succeeds, false otherwise. 323 * @return true if the operation succeeds, false otherwise.
324 */ 324 */
325 // computational complexity: O(n) where n is the number of the specified value 325 // computational complexity: O(n) where n is the number of the specified value
326 - private boolean register(TransactionalDiscreteResourceStore discreteTxStore, 326 + private boolean register(TransactionalDiscreteResourceSubStore discreteTxStore,
327 - TransactionalContinuousResourceStore continuousTxStore, 327 + TransactionalContinuousResourceSubStore continuousTxStore,
328 DiscreteResourceId key, List<Resource> values) { 328 DiscreteResourceId key, List<Resource> values) {
329 // it's assumed that the passed "values" is non-empty 329 // it's assumed that the passed "values" is non-empty
330 330
...@@ -352,8 +352,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour ...@@ -352,8 +352,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
352 * @param values values to be removed 352 * @param values values to be removed
353 * @return true if the operation succeeds, false otherwise 353 * @return true if the operation succeeds, false otherwise
354 */ 354 */
355 - private boolean unregister(TransactionalDiscreteResourceStore discreteTxStore, 355 + private boolean unregister(TransactionalDiscreteResourceSubStore discreteTxStore,
356 - TransactionalContinuousResourceStore continuousTxStore, 356 + TransactionalContinuousResourceSubStore continuousTxStore,
357 DiscreteResourceId key, List<Resource> values) { 357 DiscreteResourceId key, List<Resource> values) {
358 // it's assumed that the passed "values" is non-empty 358 // it's assumed that the passed "values" is non-empty
359 359
......
...@@ -37,12 +37,12 @@ import static com.google.common.base.Preconditions.checkArgument; ...@@ -37,12 +37,12 @@ import static com.google.common.base.Preconditions.checkArgument;
37 import static org.onosproject.store.resource.impl.ConsistentResourceStore.SERIALIZER; 37 import static org.onosproject.store.resource.impl.ConsistentResourceStore.SERIALIZER;
38 import static org.onosproject.store.resource.impl.ContinuousResourceAllocation.hasEnoughResource; 38 import static org.onosproject.store.resource.impl.ContinuousResourceAllocation.hasEnoughResource;
39 39
40 -class TransactionalContinuousResourceStore { 40 +class TransactionalContinuousResourceSubStore {
41 private final Logger log = LoggerFactory.getLogger(getClass()); 41 private final Logger log = LoggerFactory.getLogger(getClass());
42 private final TransactionalMap<DiscreteResourceId, Set<ContinuousResource>> childMap; 42 private final TransactionalMap<DiscreteResourceId, Set<ContinuousResource>> childMap;
43 private final TransactionalMap<ContinuousResourceId, ContinuousResourceAllocation> consumers; 43 private final TransactionalMap<ContinuousResourceId, ContinuousResourceAllocation> consumers;
44 44
45 - TransactionalContinuousResourceStore(TransactionContext tx) { 45 + TransactionalContinuousResourceSubStore(TransactionContext tx) {
46 this.childMap = tx.getTransactionalMap(MapNames.CONTINUOUS_CHILD_MAP, SERIALIZER); 46 this.childMap = tx.getTransactionalMap(MapNames.CONTINUOUS_CHILD_MAP, SERIALIZER);
47 this.consumers = tx.getTransactionalMap(MapNames.CONTINUOUS_CONSUMER_MAP, SERIALIZER); 47 this.consumers = tx.getTransactionalMap(MapNames.CONTINUOUS_CONSUMER_MAP, SERIALIZER);
48 } 48 }
......
...@@ -33,12 +33,12 @@ import java.util.Set; ...@@ -33,12 +33,12 @@ import java.util.Set;
33 33
34 import static org.onosproject.store.resource.impl.ConsistentResourceStore.SERIALIZER; 34 import static org.onosproject.store.resource.impl.ConsistentResourceStore.SERIALIZER;
35 35
36 -class TransactionalDiscreteResourceStore { 36 +class TransactionalDiscreteResourceSubStore {
37 private final Logger log = LoggerFactory.getLogger(getClass()); 37 private final Logger log = LoggerFactory.getLogger(getClass());
38 private final TransactionalMap<DiscreteResourceId, Set<DiscreteResource>> childMap; 38 private final TransactionalMap<DiscreteResourceId, Set<DiscreteResource>> childMap;
39 private final TransactionalMap<DiscreteResourceId, ResourceConsumerId> consumers; 39 private final TransactionalMap<DiscreteResourceId, ResourceConsumerId> consumers;
40 40
41 - TransactionalDiscreteResourceStore(TransactionContext tx) { 41 + TransactionalDiscreteResourceSubStore(TransactionContext tx) {
42 this.childMap = tx.getTransactionalMap(MapNames.DISCRETE_CHILD_MAP, SERIALIZER); 42 this.childMap = tx.getTransactionalMap(MapNames.DISCRETE_CHILD_MAP, SERIALIZER);
43 this.consumers = tx.getTransactionalMap(MapNames.DISCRETE_CONSUMER_MAP, SERIALIZER); 43 this.consumers = tx.getTransactionalMap(MapNames.DISCRETE_CONSUMER_MAP, SERIALIZER);
44 } 44 }
......