mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-22 21:01:00 +02:00
Chaning IntentStore.isMaster to take a key
Change-Id: I2d04a6aa7418e06137b0688bcb4e3af060a02b63
This commit is contained in:
parent
7e6cfe305e
commit
be28a87c0e
@ -82,6 +82,10 @@ public interface IntentService {
|
|||||||
*/
|
*/
|
||||||
List<Intent> getInstallableIntents(Key intentKey);
|
List<Intent> getInstallableIntents(Key intentKey);
|
||||||
|
|
||||||
|
default boolean isLocal(Key intentKey) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the specified listener for intent events.
|
* Adds the specified listener for intent events.
|
||||||
*
|
*
|
||||||
|
@ -106,11 +106,11 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> {
|
|||||||
* Checks to see whether the calling instance is the master for processing
|
* Checks to see whether the calling instance is the master for processing
|
||||||
* this intent, or more specifically, the key contained in this intent.
|
* this intent, or more specifically, the key contained in this intent.
|
||||||
*
|
*
|
||||||
* @param intent intent to check
|
* @param intentKey intentKey to check
|
||||||
* @return true if master; false, otherwise
|
* @return true if master; false, otherwise
|
||||||
*/
|
*/
|
||||||
//TODO better name
|
//TODO better name
|
||||||
default boolean isMaster(Intent intent) { //FIXME remove default when impl.
|
default boolean isMaster(Key intentKey) { //FIXME remove default when impl.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,6 +200,11 @@ public class IntentManager
|
|||||||
return store.getInstallableIntents(intentKey);
|
return store.getInstallableIntents(intentKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLocal(Key intentKey) {
|
||||||
|
return store.isMaster(intentKey);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addListener(IntentListener listener) {
|
public void addListener(IntentListener listener) {
|
||||||
listenerRegistry.addListener(listener);
|
listenerRegistry.addListener(listener);
|
||||||
|
@ -276,8 +276,8 @@ public class GossipIntentStore
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMaster(Intent intent) {
|
public boolean isMaster(Key intentKey) {
|
||||||
return partitionService.isMine(intent.key());
|
return partitionService.isMine(intentKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyDelegateIfNotNull(IntentEvent event) {
|
private void notifyDelegateIfNotNull(IntentEvent event) {
|
||||||
@ -308,7 +308,7 @@ public class GossipIntentStore
|
|||||||
// The pending intents map has been updated. If we are master for
|
// The pending intents map has been updated. If we are master for
|
||||||
// this intent's partition, notify the Manager that it should do
|
// this intent's partition, notify the Manager that it should do
|
||||||
// some work.
|
// some work.
|
||||||
if (isMaster(event.value().intent())) {
|
if (isMaster(event.value().intent().key())) {
|
||||||
if (delegate != null) {
|
if (delegate != null) {
|
||||||
delegate.process(copyData(event.value()));
|
delegate.process(copyData(event.value()));
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ public class SimpleIntentStore
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMaster(Intent intent) {
|
public boolean isMaster(Key intentKey) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,9 +124,4 @@ public class SimpleIntentStore
|
|||||||
notifyDelegate(IntentEvent.getEvent(data));
|
notifyDelegate(IntentEvent.getEvent(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isMaster(Intent intent) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user