commit | 9cc4a241cf33fde2fad75b5b0658696ff993c6a2 | [log] [tgz] |
---|---|---|
author | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Thu May 26 12:55:35 2016 -0700 |
committer | Gerrit Code Review <gerrit@onlab.us> | Tue Jun 14 21:17:09 2016 +0000 |
tree | 5b7f19bf26627576ba64568cf8ef04d6f9058f83 | |
parent | b5c236e2eb464a178c08462d7d9c971bb42a9795 [diff] [blame] |
Make resource retrieval more efficient when specifing resource type This resolves ONOS-4666 Change-Id: I9d09b60531ca48b36fc20f43498cda62f1badb8b
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java index 69645b1..0ecc108 100644 --- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java +++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java
@@ -296,6 +296,17 @@ .build(); } + @Override + public <T> Set<Resource> getChildResources(DiscreteResourceId parent, Class<T> cls) { + checkNotNull(parent); + checkNotNull(cls); + + return ImmutableSet.<Resource>builder() + .addAll(discreteStore.getChildResources(parent, cls)) + .addAll(continuousStore.getChildResources(parent, cls)) + .build(); + } + // computational complexity: O(n) where n is the number of the children of the parent @Override public <T> Collection<Resource> getAllocatedResources(DiscreteResourceId parent, Class<T> cls) {