use of org.onosproject.store.service.MultiValuedTimestamp in project onos by opennetworkinglab.
the class GossipIntentStore method activate.
@Activate
public void activate(ComponentContext context) {
configService.registerProperties(getClass());
modified(context);
// TODO persistent intents must be reevaluated and the appropriate
// processing done here, current implementation is not functional
// and is for performance evaluation only
initiallyPersistent = persistenceEnabled;
KryoNamespace.Builder intentSerializer = KryoNamespace.newBuilder().register(KryoNamespaces.API).register(IntentData.class).register(MultiValuedTimestamp.class);
EventuallyConsistentMapBuilder currentECMapBuilder = storageService.<Key, IntentData>eventuallyConsistentMapBuilder().withName("intent-current").withSerializer(intentSerializer).withTimestampProvider(this::currentTimestampProvider).withPeerUpdateFunction((key, intentData) -> getPeerNodes(key, intentData));
EventuallyConsistentMapBuilder pendingECMapBuilder = storageService.<Key, IntentData>eventuallyConsistentMapBuilder().withName("intent-pending").withSerializer(intentSerializer).withTimestampProvider((key, intentData) -> new MultiValuedTimestamp<>(new WallClockTimestamp(), System.nanoTime())).withPeerUpdateFunction((key, intentData) -> getPeerNodes(key, intentData));
if (initiallyPersistent) {
currentECMapBuilder = currentECMapBuilder.withPersistence();
pendingECMapBuilder = pendingECMapBuilder.withPersistence();
}
currentMap = currentECMapBuilder.build();
pendingMap = pendingECMapBuilder.build();
currentMap.addListener(mapCurrentListener);
pendingMap.addListener(mapPendingListener);
log.info("Started");
}
Aggregations