Package org.onosproject.intentsync
Class IntentSynchronizer
- java.lang.Object
-
- org.onosproject.intentsync.IntentSynchronizer
-
- All Implemented Interfaces:
IntentSynchronizationAdminService,IntentSynchronizationService
public class IntentSynchronizer extends java.lang.Object implements IntentSynchronizationService, IntentSynchronizationAdminService
Synchronizes intents between an in-memory intent store and the IntentService.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.onosproject.cluster.ClusterServiceclusterServiceprotected org.onosproject.core.CoreServicecoreServiceprotected org.onosproject.net.intent.IntentServiceintentServiceprotected org.onosproject.cluster.LeadershipServiceleadershipService
-
Constructor Summary
Constructors Constructor Description IntentSynchronizer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate()protected java.util.concurrent.ExecutorServicecreateExecutor()Creates an executor that will be used for synchronization tasks.voiddeactivate()voidmodifyPrimary(boolean isPrimary)Changes whether this instance is the primary or not based on the boolean parameter.voidremoveIntents()Withdraws all intents.voidremoveIntentsByAppId(org.onosproject.core.ApplicationId appId)Withdraws intents by app Id.voidsubmit(org.onosproject.net.intent.Intent intent)Submits and intent to the synchronizer.voidwithdraw(org.onosproject.net.intent.Intent intent)Withdraws an intent from the synchronizer.
-
-
-
Field Detail
-
coreService
protected org.onosproject.core.CoreService coreService
-
leadershipService
protected org.onosproject.cluster.LeadershipService leadershipService
-
clusterService
protected org.onosproject.cluster.ClusterService clusterService
-
intentService
protected org.onosproject.net.intent.IntentService intentService
-
-
Method Detail
-
activate
public void activate()
-
deactivate
public void deactivate()
-
createExecutor
protected java.util.concurrent.ExecutorService createExecutor()
Creates an executor that will be used for synchronization tasks.Can be overridden to change the type of executor used.
- Returns:
- executor service
-
removeIntents
public void removeIntents()
Description copied from interface:IntentSynchronizationAdminServiceWithdraws all intents.- Specified by:
removeIntentsin interfaceIntentSynchronizationAdminService
-
removeIntentsByAppId
public void removeIntentsByAppId(org.onosproject.core.ApplicationId appId)
Description copied from interface:IntentSynchronizationServiceWithdraws intents by app Id.- Specified by:
removeIntentsByAppIdin interfaceIntentSynchronizationService- Parameters:
appId- the Id of the application that created the intents to be removed
-
submit
public void submit(org.onosproject.net.intent.Intent intent)
Description copied from interface:IntentSynchronizationServiceSubmits and intent to the synchronizer.The intent will be submitted directly to the IntentService if this node is the leader, otherwise it will be stored in the synchronizer for synchronization if this node becomes the leader.
- Specified by:
submitin interfaceIntentSynchronizationService- Parameters:
intent- intent to submit
-
withdraw
public void withdraw(org.onosproject.net.intent.Intent intent)
Description copied from interface:IntentSynchronizationServiceWithdraws an intent from the synchronizer.The intent will be withdrawn directly from the IntentService if this node is the leader. The intent will be removed from the synchronizer's in-memory storage.
- Specified by:
withdrawin interfaceIntentSynchronizationService- Parameters:
intent- intent to withdraw
-
modifyPrimary
public void modifyPrimary(boolean isPrimary)
Description copied from interface:IntentSynchronizationAdminServiceChanges whether this instance is the primary or not based on the boolean parameter.- Specified by:
modifyPrimaryin interfaceIntentSynchronizationAdminService- Parameters:
isPrimary- true if the instance is primary, false if it is not
-
-