Package org.apache.nifi.provenance
Interface ProvenanceRepository
- All Superinterfaces:
ProvenanceEventRepository
-
Method Summary
Modifier and TypeMethodDescriptionlong
getContainerCapacity
(String containerName) getContainerFileStoreName
(String containerName) Returns the name of the FileStore that the given container is stored on, ornull
if not applicable or unable to determine the file store namelong
getContainerUsableSpace
(String containerName) Retrieves the Provenance Event with the given ID.Returns a List of allProvenanceEventRecord
s in the repository starting with the given ID.getLatestCachedEvent
(String componentId) Retrieves the most recent Provenance Event that is cached for the given component that is also accessible by the given uservoid
initialize
(EventReporter eventReporter, Authorizer authorizer, ProvenanceAuthorizableFactory resourceFactory, IdentifierLookup identifierLookup) Performs any initialization needed.retrieveLineageSubmission
(String lineageIdentifier, NiFiUser user) retrieveQuerySubmission
(String queryIdentifier, NiFiUser user) submitExpandChildren
(long eventId, NiFiUser user) Submits a request to expand the children of the event with the given id.submitExpandParents
(long eventId, NiFiUser user) Submits a request to expand the parents of the event with the given id.submitLineageComputation
(long eventId, NiFiUser user) Submits a Lineage Computation to be completed and returns the AsynchronousLineageResult that indicates the status of the request and the results, if the computation is complete.submitLineageComputation
(String flowFileUuid, NiFiUser user) Submits a Lineage Computation to be completed and returns the AsynchronousLineageResult that indicates the status of the request and the results, if the computation is complete.submitQuery
(Query query, NiFiUser user) Submits an asynchronous request to process the given query, returning an identifier that can be used to fetch the results at a later timeMethods inherited from interface org.apache.nifi.provenance.ProvenanceEventRepository
close, eventBuilder, getEvent, getEvents, getMaxEventId, registerEvent, registerEvents
-
Method Details
-
initialize
void initialize(EventReporter eventReporter, Authorizer authorizer, ProvenanceAuthorizableFactory resourceFactory, IdentifierLookup identifierLookup) throws IOException Performs any initialization needed. This should be called only by the framework.- Parameters:
eventReporter
- to report toauthorizer
- the authorizer to use for authorizing individual eventsresourceFactory
- the resource factory to use for generating Provenance Resource objects for authorization purposesidentifierLookup
- a mechanism for looking up identifiers in the flow- Throws:
IOException
- if unable to initialize
-
getEvent
Retrieves the Provenance Event with the given ID. The event will be returned only if the given user is authorized to access the event. Otherwise, an AccessDeniedException will be thrown. If the component for the event no longer exists, ResourceNotFoundException will be thrown.- Parameters:
id
- to lookupuser
- The NiFi user that the event should be authorized against. It can benull
if called by NiFi components internally where authorization is not required.- Returns:
- the Provenance Event Record with the given ID, if it exists, or
null
otherwise - Throws:
IOException
- if failure while retrieving event
-
getEvents
List<ProvenanceEventRecord> getEvents(long firstRecordId, int maxRecords, NiFiUser user) throws IOException Returns a List of allProvenanceEventRecord
s in the repository starting with the given ID. The first ID in the repository will always be 0 or higher. Each event that is found will be authorized against the given NiFiUser. If the user does not have authorization for the event, the event will not be returned.- Parameters:
firstRecordId
- id of the first record to retrievemaxRecords
- maximum number of records to retrieveuser
- The NiFi user that the events should be authorized against. It can benull
if called by NiFi components internally where authorization is not required.- Returns:
- records
- Throws:
IOException
- if error reading from repository
-
getProvenanceEventRepository
ProvenanceEventRepository getProvenanceEventRepository()- Returns:
- the
ProvenanceEventRepository
backing this ProvenanceRepository
-
submitQuery
Submits an asynchronous request to process the given query, returning an identifier that can be used to fetch the results at a later time- Parameters:
query
- to submituser
- The NiFi User to authorize the events against. It can benull
if called by NiFi components internally where authorization is not required.- Returns:
- an identifier that can be used to fetch the results at a later time
-
getLatestCachedEvent
Retrieves the most recent Provenance Event that is cached for the given component that is also accessible by the given user- Parameters:
componentId
- the ID of the component- Returns:
- an Optional containing the event, or an empty optional if no events are available or none of the available events are accessible by the given user
- Throws:
IOException
- if unable to read from the repository
-
retrieveQuerySubmission
- Parameters:
queryIdentifier
- of the queryuser
- The user who is retrieving the query. It can benull
if the request was made by NiFi components internally where authorization is not required. If the queried user and the retrieved user do not match, AccessDeniedException will be thrown.- Returns:
- the QueryResult associated with the given identifier, if the
query has finished processing. If the query has not yet finished running,
returns
null
-
submitLineageComputation
Submits a Lineage Computation to be completed and returns the AsynchronousLineageResult that indicates the status of the request and the results, if the computation is complete. If the given user does not have authorization to view one of the events in the lineage, a placeholder event will be used instead that provides none of the event details except for the identifier of the component that emitted the Provenance Event. It is necessary to include this node in the lineage view so that the lineage makes sense, rather than showing disconnected graphs when the user is not authorized for all components' provenance events.- Parameters:
flowFileUuid
- the UUID of the FlowFile for which the Lineage should be calculateduser
- The NiFi User to authorize the events against. It can benull
if called by NiFi components internally where authorization is not required.- Returns:
- a
ComputeLineageSubmission
object that can be used to check if the computing is complete and if so get the results
-
submitLineageComputation
Submits a Lineage Computation to be completed and returns the AsynchronousLineageResult that indicates the status of the request and the results, if the computation is complete. If the given user does not have authorization to view one of the events in the lineage, a placeholder event will be used instead that provides none of the event details except for the identifier of the component that emitted the Provenance Event. It is necessary to include this node in the lineage view so that the lineage makes sense, rather than showing disconnected graphs when the user is not authorized for all components' provenance events. This method is preferred tosubmitLineageComputation(String, NiFiUser)
because it is much more efficient, but the former may be used if a particular Event ID is not available.- Parameters:
eventId
- the numeric ID of the event that the lineage is foruser
- The NiFi User to authorize the events against. It can benull
if called by NiFi components internally where authorization is not required.- Returns:
- a
ComputeLineageSubmission
object that can be used to check if the computing is complete and if so get the results
-
retrieveLineageSubmission
- Parameters:
lineageIdentifier
- identifier of lineage to computeuser
- The user who is retrieving the lineage submission. It can benull
if the request was made by NiFi components internally where authorization is not required. If the queried user and the retrieved user do not match, AccessDeniedException will be thrown.- Returns:
- the
ComputeLineageSubmission
associated with the given identifier
-
submitExpandParents
Submits a request to expand the parents of the event with the given id. If the given user is not authorized to access any event, a placeholder will be used instead that contains only the ID of the component that emitted the event.- Parameters:
eventId
- the one-up id of the Event to expanduser
- The NiFi user to authorize events against. It can benull
if called by NiFi components internally where authorization is not required.- Returns:
- a submission which can be checked for status
- Throws:
IllegalArgumentException
- if the given identifier identifies a Provenance Event that has a Type that is not expandable or if the identifier cannot be found
-
submitExpandChildren
Submits a request to expand the children of the event with the given id. If the given user is not authorized to access any event, a placeholder will be used instead that contains only the ID of the component that emitted the event.- Parameters:
eventId
- the one-up id of the Eventuser
- The NiFi user to authorize events against. It can benull
if called by NiFi components internally where authorization is not required.- Returns:
- a submission which can be checked for status
- Throws:
IllegalArgumentException
- if the given identifier identifies a Provenance Event that has a Type that is not expandable or if the identifier cannot be found
-
getSearchableFields
List<SearchableField> getSearchableFields()- Returns:
- a list of all fields that can be searched via the
submitQuery(Query, NiFiUser)
method
-
getSearchableAttributes
List<SearchableField> getSearchableAttributes()- Returns:
- a list of all FlowFile attributes that can be searched via the
submitQuery(Query, NiFiUser)
method
-
getContainerNames
- Returns:
- the names of all Containers that exist for this Provenance Repository
-
getContainerCapacity
- Parameters:
containerName
- name of container to check capacity on- Returns:
- the maximum number of bytes that can be stored in the storage mechanism that backs the container with the given name
- Throws:
IOException
- if unable to check capacityIllegalArgumentException
- if no container exists with the given name
-
getContainerFileStoreName
Returns the name of the FileStore that the given container is stored on, ornull
if not applicable or unable to determine the file store name- Parameters:
containerName
- the name of the container- Returns:
- the name of the FileStore
-
getContainerUsableSpace
- Parameters:
containerName
- to check space on- Returns:
- the number of bytes available to be used used by the storage mechanism that backs the container with the given name
- Throws:
IOException
- if unable to check spaceIllegalArgumentException
- if no container exists with the given name
-