use of com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheSnapshot in project kylo by Teradata.
the class NifiFlowCacheImpl method syncAndReturnUpdates.
private NiFiFlowCacheSync syncAndReturnUpdates(NiFiFlowCacheSync sync, NifiFlowCacheSnapshot latest, boolean preview) {
if (latest != null && sync.needsUpdate(latest.getSnapshotDate())) {
NifiFlowCacheSnapshot updated = new NifiFlowCacheSnapshot.Builder().withProcessorIdToFeedNameMap(sync.getProcessorIdToFeedNameMapUpdatedSinceLastSync(latest.getProcessorIdToFeedNameMap())).withProcessorIdToFeedProcessGroupId(sync.getProcessorIdToProcessGroupIdUpdatedSinceLastSync(latest.getProcessorIdToFeedProcessGroupId())).withProcessorIdToProcessorName(sync.getProcessorIdToProcessorNameUpdatedSinceLastSync(latest.getProcessorIdToProcessorName())).withConnections(sync.getConnectionIdToConnectionUpdatedSinceLastSync(latest.getConnectionIdToConnectionName(), latest.getConnectionIdToConnection())).withReusableTemplateProcessorIds(latest.getReusableTemplateProcessorIds()).build();
// reset the pointers on this sync to be the latest
if (!preview) {
sync.setSnapshot(latest);
sync.setLastSync(latest.getSnapshotDate());
}
NiFiFlowCacheSync updatedSync = new NiFiFlowCacheSync(sync.getSyncId(), updated);
updatedSync.setUpdated(true);
if (!preview) {
updatedSync.setLastSync(latest.getSnapshotDate());
}
return updatedSync;
}
return NiFiFlowCacheSync.EMPTY(sync.getSyncId());
}
use of com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheSnapshot in project kylo by Teradata.
the class NifiFlowCacheImpl method syncAndReturnUpdates.
private NiFiFlowCacheSync syncAndReturnUpdates(NiFiFlowCacheSync sync, boolean preview) {
if (!preview) {
lastSyncTimeMap.put(sync.getSyncId(), DateTime.now());
}
if (isKyloClustered()) {
applyClusterUpdates();
}
if (sync.needsUpdate(lastUpdated)) {
Map<String, String> processorIdToFeedNameMapCopy = ImmutableMap.copyOf(processorIdToFeedNameMap);
Map<String, String> processorIdToFeedProcessGroupIdCopy = ImmutableMap.copyOf(processorIdToFeedProcessGroupId);
Map<String, String> processorIdToProcessorNameCopy = ImmutableMap.copyOf(processorIdToProcessorName);
Map<String, NiFiFlowCacheConnectionData> connectionDataMapCopy = ImmutableMap.copyOf(connectionIdToConnectionMap);
// get feeds updated since last sync
NifiFlowCacheSnapshot latest = new NifiFlowCacheSnapshot.Builder().withProcessorIdToFeedNameMap(processorIdToFeedNameMapCopy).withProcessorIdToFeedProcessGroupId(processorIdToFeedProcessGroupIdCopy).withProcessorIdToProcessorName(processorIdToProcessorNameCopy).withConnections(connectionDataMapCopy).withSnapshotDate(lastUpdated).build();
return syncAndReturnUpdates(sync, latest, preview);
} else {
return NiFiFlowCacheSync.EMPTY(sync.getSyncId());
}
}
use of com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheSnapshot in project kylo by Teradata.
the class NifiFlowCacheImpl method initializeLatestSnapshot.
private void initializeLatestSnapshot() {
latest = new NifiFlowCacheSnapshot(processorIdToFeedNameMap, processorIdToFeedProcessGroupId, processorIdToProcessorName, null, null);
latest.setConnectionIdToConnection(connectionIdToConnectionMap);
latest.setConnectionIdToConnectionName(connectionIdCacheNameMap);
latest.setReusableTemplateProcessorIds(reuseableTemplateProcessorIds);
latest.setFeedToInputProcessorIds(feedToInputProcessorIds);
}
Aggregations