Search in sources :

Example 1 with NifiFlowCacheSnapshot

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());
}
Also used : NiFiFlowCacheSync(com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheSync) NifiFlowCacheSnapshot(com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheSnapshot)

Example 2 with NifiFlowCacheSnapshot

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());
    }
}
Also used : NiFiFlowCacheConnectionData(com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheConnectionData) NifiFlowCacheSnapshot(com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheSnapshot)

Example 3 with NifiFlowCacheSnapshot

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);
}
Also used : NifiFlowCacheSnapshot(com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheSnapshot)

Aggregations

NifiFlowCacheSnapshot (com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheSnapshot)3 NiFiFlowCacheConnectionData (com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheConnectionData)1 NiFiFlowCacheSync (com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheSync)1