Search in sources :

Example 1 with RepositoryRecord

use of org.apache.nifi.controller.repository.RepositoryRecord in project nifi by apache.

the class StandardFlowFileQueue method drop.

private QueueSize drop(final List<FlowFileRecord> flowFiles, final String requestor) throws IOException {
    // Create a Provenance Event and a FlowFile Repository record for each FlowFile
    final List<ProvenanceEventRecord> provenanceEvents = new ArrayList<>(flowFiles.size());
    final List<RepositoryRecord> flowFileRepoRecords = new ArrayList<>(flowFiles.size());
    for (final FlowFileRecord flowFile : flowFiles) {
        provenanceEvents.add(createDropEvent(flowFile, requestor));
        flowFileRepoRecords.add(createDeleteRepositoryRecord(flowFile));
    }
    long dropContentSize = 0L;
    for (final FlowFileRecord flowFile : flowFiles) {
        dropContentSize += flowFile.getSize();
        final ContentClaim contentClaim = flowFile.getContentClaim();
        if (contentClaim == null) {
            continue;
        }
        final ResourceClaim resourceClaim = contentClaim.getResourceClaim();
        if (resourceClaim == null) {
            continue;
        }
        resourceClaimManager.decrementClaimantCount(resourceClaim);
    }
    provRepository.registerEvents(provenanceEvents);
    flowFileRepository.updateRepository(flowFileRepoRecords);
    return new QueueSize(flowFiles.size(), dropContentSize);
}
Also used : QueueSize(org.apache.nifi.controller.queue.QueueSize) ContentClaim(org.apache.nifi.controller.repository.claim.ContentClaim) ProvenanceEventRecord(org.apache.nifi.provenance.ProvenanceEventRecord) ArrayList(java.util.ArrayList) RepositoryRecord(org.apache.nifi.controller.repository.RepositoryRecord) ResourceClaim(org.apache.nifi.controller.repository.claim.ResourceClaim) FlowFileRecord(org.apache.nifi.controller.repository.FlowFileRecord)

Aggregations

ArrayList (java.util.ArrayList)1 QueueSize (org.apache.nifi.controller.queue.QueueSize)1 FlowFileRecord (org.apache.nifi.controller.repository.FlowFileRecord)1 RepositoryRecord (org.apache.nifi.controller.repository.RepositoryRecord)1 ContentClaim (org.apache.nifi.controller.repository.claim.ContentClaim)1 ResourceClaim (org.apache.nifi.controller.repository.claim.ResourceClaim)1 ProvenanceEventRecord (org.apache.nifi.provenance.ProvenanceEventRecord)1