public interface FlowFileRepository extends Closeable
| Modifier and Type | Method and Description |
|---|---|
default Set<ResourceClaim> |
findOrphanedResourceClaims()
Returns the set of Resource Claims that are referenced by FlowFiles that have been "orphaned" because they belong to FlowFile Queues/Connections
that did not exist in the flow when NiFi started
|
Set<String> |
findQueuesWithFlowFiles(FlowFileSwapManager flowFileSwapManager)
Searches through the repository to find the ID's of all FlowFile Queues that currently have data queued
|
default Map<ResourceClaim,Set<ResourceClaimReference>> |
findResourceClaimReferences(Set<ResourceClaim> resourceClaims,
FlowFileSwapManager swapManager)
Scans the FlowFile Repository to locate any FlowFiles that reference the given Resource Claims.
|
String |
getFileStoreName()
Returns the name of the FileStore that the repository is stored on, or
null
if not applicable or unable to determine the file store name |
long |
getMaxFlowFileIdentifier() |
long |
getNextFlowFileSequence() |
long |
getStorageCapacity() |
long |
getUsableStorageSpace() |
void |
initialize(ResourceClaimManager claimManager)
Initializes the Content Repository, providing to it the
ContentClaimManager that is to be used for interacting with Content
Claims
|
boolean |
isValidSwapLocationSuffix(String swapLocationSuffix)
Determines whether or not the given swap location suffix is a valid, known location according to this FlowFileRepository.
|
boolean |
isVolatile() |
long |
loadFlowFiles(QueueProvider queueProvider)
Loads all flow files found within the repository, establishes the content
claims and their reference count
|
void |
swapFlowFilesIn(String swapLocation,
List<FlowFileRecord> flowFileRecords,
FlowFileQueue flowFileQueue)
Updates the Repository to indicate that the given FlowFileRecords were
Swapped In to memory
|
void |
swapFlowFilesOut(List<FlowFileRecord> swappedOut,
FlowFileQueue flowFileQueue,
String swapLocation)
Updates the Repository to indicate that the given FlowFileRecords were
Swapped Out of memory
|
void |
updateMaxFlowFileIdentifier(long maxId)
Notifies the FlowFile Repository that the given identifier has been identified as the maximum value that
has been encountered for an 'external' (swapped out) FlowFile.
|
void |
updateRepository(Collection<RepositoryRecord> records)
Updates the repository with the given RepositoryRecords.
|
void initialize(ResourceClaimManager claimManager) throws IOException
claimManager - for handling claimsIOException - if unable to initialize repositorylong getStorageCapacity()
throws IOException
IOException - if computing capacity failslong getUsableStorageSpace()
throws IOException
IOException - if computing usable space failsString getFileStoreName()
null
if not applicable or unable to determine the file store namevoid updateRepository(Collection<RepositoryRecord> records) throws IOException
records - the records to update the repository withIOException - if update failslong loadFlowFiles(QueueProvider queueProvider) throws IOException
queueProvider - the provider of FlowFile Queues into which the
FlowFiles should be enqueuedIOException - if load failsSet<String> findQueuesWithFlowFiles(FlowFileSwapManager flowFileSwapManager) throws IOException
IOException - if unable to read from the FlowFile Repositoryboolean isVolatile()
true if the Repository is volatile (i.e., its data
is lost upon application restart), false otherwiselong getNextFlowFileSequence()
FlowFiles.long getMaxFlowFileIdentifier()
throws IOException
FlowFiles that currently exist in
the repository.IOException - if computing max identifier failsvoid updateMaxFlowFileIdentifier(long maxId)
maxId - the max id of any FlowFile encounteredvoid swapFlowFilesOut(List<FlowFileRecord> swappedOut, FlowFileQueue flowFileQueue, String swapLocation) throws IOException
swappedOut - the FlowFiles that were swapped out of memoryflowFileQueue - the queue that the FlowFiles belong toswapLocation - the location to which the FlowFiles were swappedIOException - if swap failsvoid swapFlowFilesIn(String swapLocation, List<FlowFileRecord> flowFileRecords, FlowFileQueue flowFileQueue) throws IOException
swapLocation - the location (e.g., a filename) from which FlowFiles
were recoveredflowFileRecords - the records that were swapped inflowFileQueue - the queue that the FlowFiles belong toIOException - if swap failsboolean isValidSwapLocationSuffix(String swapLocationSuffix)
Determines whether or not the given swap location suffix is a valid, known location according to this FlowFileRepository. Note that while
the swapFlowFilesIn(String, List, FlowFileQueue) and swapFlowFilesOut(List, FlowFileQueue, String) methods expect
a full "swap location" this method expects only the "suffix" of a swap location. For example, if the location points to a file, this method
would expect only the filename, not the full path.
This method differs from the others because the other methods want to store the swap location or recover from a given location. However, this method is used to verify that the location is known. If for any reason, NiFi is stopped, its FlowFile Repository relocated to a new location (for example, a different disk partition), and restarted, the swap location would not match if we used the full location. Therefore, by using only the "suffix" (i.e. the filename for a file-based implementation), we can avoid worrying about relocation.
swapLocationSuffix - the suffix of the location to checktrue if the swap location is known and valid, false otherwisedefault Map<ResourceClaim,Set<ResourceClaimReference>> findResourceClaimReferences(Set<ResourceClaim> resourceClaims, FlowFileSwapManager swapManager) throws IOException
Scans the FlowFile Repository to locate any FlowFiles that reference the given Resource Claims. If the FlowFile Repository does not implement this capability, it will return null.
resourceClaims - the resource claims whose references should be foundswapManager - the swap manager to use for scanning swap filesIOException - if an IO failure occurs when attempting to find referencesdefault Set<ResourceClaim> findOrphanedResourceClaims()
Copyright © 2023 Apache NiFi Project. All rights reserved.