Committed by
Ray Milkey
Remove deprecated and unused APIs from IntentStore.
IntentStore#createIntent(Intent) and IntentStore#removeIntent(Intent) have been superseded by IntentStore#batchWrite(BatchWrite) Change-Id: I0f1c1b8fdc645435a9925bae9370d75965618c7c
Showing
4 changed files
with
14 additions
and
108 deletions
... | @@ -26,27 +26,6 @@ import java.util.List; | ... | @@ -26,27 +26,6 @@ import java.util.List; |
26 | public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { | 26 | public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { |
27 | 27 | ||
28 | /** | 28 | /** |
29 | - * Submits a new intent into the store. If the returned event is not | ||
30 | - * null, the manager is expected to dispatch the event and then to kick | ||
31 | - * off intent compilation process. Otherwise, another node has been elected | ||
32 | - * to perform the compilation process and the node will learn about | ||
33 | - * the submittal and results of the intent compilation via the delegate | ||
34 | - * mechanism. | ||
35 | - * | ||
36 | - * @param intent intent to be submitted | ||
37 | - */ | ||
38 | - @Deprecated | ||
39 | - void createIntent(Intent intent); | ||
40 | - | ||
41 | - /** | ||
42 | - * Removes the specified intent from the inventory. | ||
43 | - * | ||
44 | - * @param intentId intent identification | ||
45 | - */ | ||
46 | - @Deprecated | ||
47 | - void removeIntent(IntentId intentId); | ||
48 | - | ||
49 | - /** | ||
50 | * Returns the number of intents in the store. | 29 | * Returns the number of intents in the store. |
51 | * | 30 | * |
52 | * @return the number of intents in the store | 31 | * @return the number of intents in the store | ... | ... |
... | @@ -22,7 +22,6 @@ import com.google.common.cache.CacheBuilder; | ... | @@ -22,7 +22,6 @@ import com.google.common.cache.CacheBuilder; |
22 | import com.google.common.cache.CacheLoader; | 22 | import com.google.common.cache.CacheLoader; |
23 | import com.google.common.cache.LoadingCache; | 23 | import com.google.common.cache.LoadingCache; |
24 | import com.google.common.collect.ImmutableSet; | 24 | import com.google.common.collect.ImmutableSet; |
25 | - | ||
26 | import com.google.common.collect.Lists; | 25 | import com.google.common.collect.Lists; |
27 | import org.apache.felix.scr.annotations.Activate; | 26 | import org.apache.felix.scr.annotations.Activate; |
28 | import org.apache.felix.scr.annotations.Component; | 27 | import org.apache.felix.scr.annotations.Component; |
... | @@ -31,15 +30,16 @@ import org.apache.felix.scr.annotations.Reference; | ... | @@ -31,15 +30,16 @@ import org.apache.felix.scr.annotations.Reference; |
31 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 30 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
32 | import org.apache.felix.scr.annotations.Service; | 31 | import org.apache.felix.scr.annotations.Service; |
33 | import org.onlab.metrics.MetricsService; | 32 | import org.onlab.metrics.MetricsService; |
33 | +import org.onlab.util.KryoNamespace; | ||
34 | import org.onosproject.core.MetricsHelper; | 34 | import org.onosproject.core.MetricsHelper; |
35 | import org.onosproject.net.intent.BatchWrite; | 35 | import org.onosproject.net.intent.BatchWrite; |
36 | +import org.onosproject.net.intent.BatchWrite.Operation; | ||
36 | import org.onosproject.net.intent.Intent; | 37 | import org.onosproject.net.intent.Intent; |
37 | import org.onosproject.net.intent.IntentEvent; | 38 | import org.onosproject.net.intent.IntentEvent; |
38 | import org.onosproject.net.intent.IntentId; | 39 | import org.onosproject.net.intent.IntentId; |
39 | import org.onosproject.net.intent.IntentState; | 40 | import org.onosproject.net.intent.IntentState; |
40 | import org.onosproject.net.intent.IntentStore; | 41 | import org.onosproject.net.intent.IntentStore; |
41 | import org.onosproject.net.intent.IntentStoreDelegate; | 42 | import org.onosproject.net.intent.IntentStoreDelegate; |
42 | -import org.onosproject.net.intent.BatchWrite.Operation; | ||
43 | import org.onosproject.store.AbstractStore; | 43 | import org.onosproject.store.AbstractStore; |
44 | import org.onosproject.store.serializers.KryoNamespaces; | 44 | import org.onosproject.store.serializers.KryoNamespaces; |
45 | import org.onosproject.store.serializers.KryoSerializer; | 45 | import org.onosproject.store.serializers.KryoSerializer; |
... | @@ -50,7 +50,6 @@ import org.onosproject.store.service.BatchWriteResult; | ... | @@ -50,7 +50,6 @@ import org.onosproject.store.service.BatchWriteResult; |
50 | import org.onosproject.store.service.DatabaseAdminService; | 50 | import org.onosproject.store.service.DatabaseAdminService; |
51 | import org.onosproject.store.service.DatabaseService; | 51 | import org.onosproject.store.service.DatabaseService; |
52 | import org.onosproject.store.service.impl.CMap; | 52 | import org.onosproject.store.service.impl.CMap; |
53 | -import org.onlab.util.KryoNamespace; | ||
54 | import org.slf4j.Logger; | 53 | import org.slf4j.Logger; |
55 | 54 | ||
56 | import java.util.ArrayList; | 55 | import java.util.ArrayList; |
... | @@ -63,10 +62,13 @@ import java.util.Set; | ... | @@ -63,10 +62,13 @@ import java.util.Set; |
63 | import java.util.concurrent.ConcurrentHashMap; | 62 | import java.util.concurrent.ConcurrentHashMap; |
64 | 63 | ||
65 | import static com.google.common.base.Preconditions.checkArgument; | 64 | import static com.google.common.base.Preconditions.checkArgument; |
66 | -import static com.google.common.base.Preconditions.checkState; | 65 | +import static org.onlab.metrics.MetricsUtil.startTimer; |
67 | -import static org.onosproject.net.intent.IntentState.*; | 66 | +import static org.onlab.metrics.MetricsUtil.stopTimer; |
67 | +import static org.onosproject.net.intent.IntentState.FAILED; | ||
68 | +import static org.onosproject.net.intent.IntentState.INSTALLED; | ||
69 | +import static org.onosproject.net.intent.IntentState.INSTALL_REQ; | ||
70 | +import static org.onosproject.net.intent.IntentState.WITHDRAWN; | ||
68 | import static org.slf4j.LoggerFactory.getLogger; | 71 | import static org.slf4j.LoggerFactory.getLogger; |
69 | -import static org.onlab.metrics.MetricsUtil.*; | ||
70 | 72 | ||
71 | @Component(immediate = true, enabled = false) | 73 | @Component(immediate = true, enabled = false) |
72 | @Service | 74 | @Service |
... | @@ -114,8 +116,6 @@ public class DistributedIntentStore | ... | @@ -114,8 +116,6 @@ public class DistributedIntentStore |
114 | // TODO make this configurable | 116 | // TODO make this configurable |
115 | private boolean onlyLogTransitionError = true; | 117 | private boolean onlyLogTransitionError = true; |
116 | 118 | ||
117 | - private Timer createIntentTimer; | ||
118 | - private Timer removeIntentTimer; | ||
119 | private Timer setInstallableIntentsTimer; | 119 | private Timer setInstallableIntentsTimer; |
120 | private Timer getInstallableIntentsTimer; | 120 | private Timer getInstallableIntentsTimer; |
121 | private Timer removeInstalledIntentsTimer; | 121 | private Timer removeInstalledIntentsTimer; |
... | @@ -132,8 +132,6 @@ public class DistributedIntentStore | ... | @@ -132,8 +132,6 @@ public class DistributedIntentStore |
132 | 132 | ||
133 | @Activate | 133 | @Activate |
134 | public void activate() { | 134 | public void activate() { |
135 | - createIntentTimer = createResponseTimer("createIntent"); | ||
136 | - removeIntentTimer = createResponseTimer("removeIntent"); | ||
137 | setInstallableIntentsTimer = createResponseTimer("setInstallableIntents"); | 135 | setInstallableIntentsTimer = createResponseTimer("setInstallableIntents"); |
138 | getInstallableIntentsTimer = createResponseTimer("getInstallableIntents"); | 136 | getInstallableIntentsTimer = createResponseTimer("getInstallableIntents"); |
139 | removeInstalledIntentsTimer = createResponseTimer("removeInstalledIntents"); | 137 | removeInstalledIntentsTimer = createResponseTimer("removeInstalledIntents"); |
... | @@ -190,38 +188,6 @@ public class DistributedIntentStore | ... | @@ -190,38 +188,6 @@ public class DistributedIntentStore |
190 | } | 188 | } |
191 | 189 | ||
192 | @Override | 190 | @Override |
193 | - public void createIntent(Intent intent) { | ||
194 | - Context timer = startTimer(createIntentTimer); | ||
195 | - try { | ||
196 | - boolean absent = intents.putIfAbsent(intent.id(), intent); | ||
197 | - if (!absent) { | ||
198 | - // duplicate, ignore | ||
199 | - return; | ||
200 | - } else { | ||
201 | - this.setState(intent, IntentState.INSTALL_REQ); | ||
202 | - return; | ||
203 | - } | ||
204 | - } finally { | ||
205 | - stopTimer(timer); | ||
206 | - } | ||
207 | - } | ||
208 | - | ||
209 | - @Override | ||
210 | - public void removeIntent(IntentId intentId) { | ||
211 | - Context timer = startTimer(removeIntentTimer); | ||
212 | - checkState(getIntentState(intentId) == WITHDRAWN, | ||
213 | - "Intent state for {} is not WITHDRAWN.", intentId); | ||
214 | - try { | ||
215 | - intents.remove(intentId); | ||
216 | - states.remove(intentId); | ||
217 | - transientStates.remove(intentId); | ||
218 | - installable.remove(intentId); | ||
219 | - } finally { | ||
220 | - stopTimer(timer); | ||
221 | - } | ||
222 | - } | ||
223 | - | ||
224 | - @Override | ||
225 | public long getIntentCount() { | 191 | public long getIntentCount() { |
226 | Context timer = startTimer(getIntentCountTimer); | 192 | Context timer = startTimer(getIntentCountTimer); |
227 | try { | 193 | try { | ... | ... |
... | @@ -28,7 +28,6 @@ import com.hazelcast.core.EntryEvent; | ... | @@ -28,7 +28,6 @@ import com.hazelcast.core.EntryEvent; |
28 | import com.hazelcast.core.EntryListener; | 28 | import com.hazelcast.core.EntryListener; |
29 | import com.hazelcast.core.IMap; | 29 | import com.hazelcast.core.IMap; |
30 | import com.hazelcast.core.Member; | 30 | import com.hazelcast.core.Member; |
31 | - | ||
32 | import org.apache.commons.lang3.tuple.Pair; | 31 | import org.apache.commons.lang3.tuple.Pair; |
33 | import org.apache.felix.scr.annotations.Activate; | 32 | import org.apache.felix.scr.annotations.Activate; |
34 | import org.apache.felix.scr.annotations.Component; | 33 | import org.apache.felix.scr.annotations.Component; |
... | @@ -37,20 +36,20 @@ import org.apache.felix.scr.annotations.Reference; | ... | @@ -37,20 +36,20 @@ import org.apache.felix.scr.annotations.Reference; |
37 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 36 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
38 | import org.apache.felix.scr.annotations.Service; | 37 | import org.apache.felix.scr.annotations.Service; |
39 | import org.onlab.metrics.MetricsService; | 38 | import org.onlab.metrics.MetricsService; |
39 | +import org.onlab.util.KryoNamespace; | ||
40 | import org.onosproject.core.MetricsHelper; | 40 | import org.onosproject.core.MetricsHelper; |
41 | import org.onosproject.net.intent.BatchWrite; | 41 | import org.onosproject.net.intent.BatchWrite; |
42 | +import org.onosproject.net.intent.BatchWrite.Operation; | ||
42 | import org.onosproject.net.intent.Intent; | 43 | import org.onosproject.net.intent.Intent; |
43 | import org.onosproject.net.intent.IntentEvent; | 44 | import org.onosproject.net.intent.IntentEvent; |
44 | import org.onosproject.net.intent.IntentId; | 45 | import org.onosproject.net.intent.IntentId; |
45 | import org.onosproject.net.intent.IntentState; | 46 | import org.onosproject.net.intent.IntentState; |
46 | import org.onosproject.net.intent.IntentStore; | 47 | import org.onosproject.net.intent.IntentStore; |
47 | -import org.onosproject.net.intent.BatchWrite.Operation; | ||
48 | import org.onosproject.net.intent.IntentStoreDelegate; | 48 | import org.onosproject.net.intent.IntentStoreDelegate; |
49 | import org.onosproject.store.hz.AbstractHazelcastStore; | 49 | import org.onosproject.store.hz.AbstractHazelcastStore; |
50 | import org.onosproject.store.hz.SMap; | 50 | import org.onosproject.store.hz.SMap; |
51 | import org.onosproject.store.serializers.KryoNamespaces; | 51 | import org.onosproject.store.serializers.KryoNamespaces; |
52 | import org.onosproject.store.serializers.KryoSerializer; | 52 | import org.onosproject.store.serializers.KryoSerializer; |
53 | -import org.onlab.util.KryoNamespace; | ||
54 | import org.slf4j.Logger; | 53 | import org.slf4j.Logger; |
55 | 54 | ||
56 | import java.util.ArrayList; | 55 | import java.util.ArrayList; |
... | @@ -64,10 +63,10 @@ import java.util.concurrent.ExecutionException; | ... | @@ -64,10 +63,10 @@ import java.util.concurrent.ExecutionException; |
64 | import java.util.concurrent.Future; | 63 | import java.util.concurrent.Future; |
65 | 64 | ||
66 | import static com.google.common.base.Preconditions.checkArgument; | 65 | import static com.google.common.base.Preconditions.checkArgument; |
67 | -import static com.google.common.base.Preconditions.checkState; | 66 | +import static org.onlab.metrics.MetricsUtil.startTimer; |
67 | +import static org.onlab.metrics.MetricsUtil.stopTimer; | ||
68 | import static org.onosproject.net.intent.IntentState.*; | 68 | import static org.onosproject.net.intent.IntentState.*; |
69 | import static org.slf4j.LoggerFactory.getLogger; | 69 | import static org.slf4j.LoggerFactory.getLogger; |
70 | -import static org.onlab.metrics.MetricsUtil.*; | ||
71 | 70 | ||
72 | @Component(immediate = true, enabled = true) | 71 | @Component(immediate = true, enabled = true) |
73 | @Service | 72 | @Service |
... | @@ -102,8 +101,6 @@ public class HazelcastIntentStore | ... | @@ -102,8 +101,6 @@ public class HazelcastIntentStore |
102 | 101 | ||
103 | private boolean onlyLogTransitionError = true; | 102 | private boolean onlyLogTransitionError = true; |
104 | 103 | ||
105 | - private Timer createIntentTimer; | ||
106 | - private Timer removeIntentTimer; | ||
107 | private Timer setInstallableIntentsTimer; | 104 | private Timer setInstallableIntentsTimer; |
108 | private Timer getInstallableIntentsTimer; | 105 | private Timer getInstallableIntentsTimer; |
109 | private Timer removeInstalledIntentsTimer; | 106 | private Timer removeInstalledIntentsTimer; |
... | @@ -131,8 +128,6 @@ public class HazelcastIntentStore | ... | @@ -131,8 +128,6 @@ public class HazelcastIntentStore |
131 | public void activate() { | 128 | public void activate() { |
132 | localIntents = new ConcurrentHashMap<>(); | 129 | localIntents = new ConcurrentHashMap<>(); |
133 | 130 | ||
134 | - createIntentTimer = createResponseTimer("createIntent"); | ||
135 | - removeIntentTimer = createResponseTimer("removeIntent"); | ||
136 | setInstallableIntentsTimer = createResponseTimer("setInstallableIntents"); | 131 | setInstallableIntentsTimer = createResponseTimer("setInstallableIntents"); |
137 | getInstallableIntentsTimer = createResponseTimer("getInstallableIntents"); | 132 | getInstallableIntentsTimer = createResponseTimer("getInstallableIntents"); |
138 | removeInstalledIntentsTimer = createResponseTimer("removeInstalledIntents"); | 133 | removeInstalledIntentsTimer = createResponseTimer("removeInstalledIntents"); |
... | @@ -200,38 +195,6 @@ public class HazelcastIntentStore | ... | @@ -200,38 +195,6 @@ public class HazelcastIntentStore |
200 | } | 195 | } |
201 | 196 | ||
202 | @Override | 197 | @Override |
203 | - public void createIntent(Intent intent) { | ||
204 | - Context timer = startTimer(createIntentTimer); | ||
205 | - try { | ||
206 | - Intent existing = intents.putIfAbsent(intent.id(), intent); | ||
207 | - if (existing != null) { | ||
208 | - // duplicate, ignore | ||
209 | - return; | ||
210 | - } else { | ||
211 | - this.setState(intent, IntentState.INSTALL_REQ); | ||
212 | - return; | ||
213 | - } | ||
214 | - } finally { | ||
215 | - stopTimer(timer); | ||
216 | - } | ||
217 | - } | ||
218 | - | ||
219 | - @Override | ||
220 | - public void removeIntent(IntentId intentId) { | ||
221 | - Context timer = startTimer(removeIntentTimer); | ||
222 | - checkState(getIntentState(intentId) == WITHDRAWN, | ||
223 | - "Intent state for {} is not WITHDRAWN.", intentId); | ||
224 | - try { | ||
225 | - intents.remove(intentId); | ||
226 | - installable.remove(intentId); | ||
227 | - states.remove(intentId); | ||
228 | - transientStates.remove(intentId); | ||
229 | - } finally { | ||
230 | - stopTimer(timer); | ||
231 | - } | ||
232 | - } | ||
233 | - | ||
234 | - @Override | ||
235 | public long getIntentCount() { | 198 | public long getIntentCount() { |
236 | Context timer = startTimer(getIntentCountTimer); | 199 | Context timer = startTimer(getIntentCountTimer); |
237 | try { | 200 | try { | ... | ... |
... | @@ -65,8 +65,7 @@ public class SimpleIntentStore | ... | @@ -65,8 +65,7 @@ public class SimpleIntentStore |
65 | log.info("Stopped"); | 65 | log.info("Stopped"); |
66 | } | 66 | } |
67 | 67 | ||
68 | - @Override | 68 | + private void createIntent(Intent intent) { |
69 | - public void createIntent(Intent intent) { | ||
70 | if (intents.containsKey(intent.id())) { | 69 | if (intents.containsKey(intent.id())) { |
71 | return; | 70 | return; |
72 | } | 71 | } |
... | @@ -74,8 +73,7 @@ public class SimpleIntentStore | ... | @@ -74,8 +73,7 @@ public class SimpleIntentStore |
74 | this.setState(intent, IntentState.INSTALL_REQ); | 73 | this.setState(intent, IntentState.INSTALL_REQ); |
75 | } | 74 | } |
76 | 75 | ||
77 | - @Override | 76 | + private void removeIntent(IntentId intentId) { |
78 | - public void removeIntent(IntentId intentId) { | ||
79 | checkState(getIntentState(intentId) == WITHDRAWN, | 77 | checkState(getIntentState(intentId) == WITHDRAWN, |
80 | "Intent state for {} is not WITHDRAWN.", intentId); | 78 | "Intent state for {} is not WITHDRAWN.", intentId); |
81 | intents.remove(intentId); | 79 | intents.remove(intentId); | ... | ... |
-
Please register or login to post a comment