public interface ContentRepository
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Performs any cleanup actions that may need to be taken upon system
restart.
|
ContentClaim |
clone(ContentClaim original,
boolean lossTolerant)
Clones the content for the given content claim and returns content claim
of the new object
|
ContentClaim |
create(boolean lossTolerant)
Creates a new content claim
|
int |
decrementClaimantCount(ContentClaim claim)
Reduces the number of claimants for the given claim.
|
long |
exportTo(ContentClaim claim,
OutputStream destination)
Exports the content of the given claim to the given destination.
|
long |
exportTo(ContentClaim claim,
OutputStream destination,
long offset,
long length)
Exports a subset of the content of the given claim, starting at offset
and copying length bytes, to the given destination.
|
long |
exportTo(ContentClaim claim,
Path destination,
boolean append)
Exports the content of the given claim to the given destination.
|
long |
exportTo(ContentClaim claim,
Path destination,
boolean append,
long offset,
long length)
Exports the content of the given claim to the given destination.
|
int |
getClaimantCount(ContentClaim claim)
Obtains the current number of claimants for the given claim
|
long |
getContainerCapacity(String containerName) |
Set<String> |
getContainerNames() |
long |
getContainerUsableSpace(String containerName) |
long |
importFrom(InputStream content,
ContentClaim claim)
Imports content from the given stream creating a new content object and
claim within the repository.
|
long |
importFrom(Path content,
ContentClaim claim)
Imports content from the given path creating a new content object and
claim within the repository.
|
int |
incrementClaimaintCount(ContentClaim claim)
Increments the number of claimants for the given claim
|
void |
initialize(ResourceClaimManager claimManager)
Initializes the Content Repository, providing to it the
ContentClaimManager that is to be used for interacting with Content
Claims
|
boolean |
isAccessible(ContentClaim contentClaim) |
long |
merge(Collection<ContentClaim> claims,
ContentClaim destination,
byte[] header,
byte[] footer,
byte[] demarcator)
Creates a new content item that is the merger in iteration order of all
content for the given claims
|
void |
purge()
Purges the contents of the repository, as if the repository were newly
created.
|
InputStream |
read(ContentClaim claim)
Provides access to the input stream for the given claim
|
boolean |
remove(ContentClaim claim)
Removes the content indicated by the given claim
|
void |
shutdown()
Shuts down the Content Repository, freeing any resources that may be
held.
|
long |
size(ContentClaim claim) |
OutputStream |
write(ContentClaim claim)
Obtains an OutputStream to the content for the given claim.
|
void initialize(ResourceClaimManager claimManager) throws IOException
claimManager
- to handle claimsIOException
- if unable to initvoid shutdown()
Set<String> getContainerNames()
long getContainerCapacity(String containerName) throws IOException
containerName
- name of container to check capacity onIOException
- if unable to check capacityIllegalArgumentException
- if no container exists with the given
namelong getContainerUsableSpace(String containerName) throws IOException
containerName
- to check space onIOException
- if unable to check spaceIllegalArgumentException
- if no container exists with the given
nameContentClaim create(boolean lossTolerant) throws IOException
lossTolerant
- indicates whether the content for the new claim is
loss tolerant. If true the repository might choose more volatile storage
options which could increase performance for a tradeoff with reliabilityIOException
- if unable to create claimint incrementClaimaintCount(ContentClaim claim)
claim
- to incrementint getClaimantCount(ContentClaim claim)
claim
- to get count ofint decrementClaimantCount(ContentClaim claim)
claim
- to decrementboolean remove(ContentClaim claim)
claim
- to removeContentClaim clone(ContentClaim original, boolean lossTolerant) throws IOException
original
- to clonelossTolerant
- if can be place in a loss tolerant repositoryIOException
- if an IO error occurs. Any content written to the new
destination prior to the error will be destroyedlong merge(Collection<ContentClaim> claims, ContentClaim destination, byte[] header, byte[] footer, byte[] demarcator) throws IOException
claims
- the claims to merge which will be combined in order of
collection iterationdestination
- the claim to write the merged content toheader
- if supplied will be prepended to the outputfooter
- if supplied will be appended to the outputdemarcator
- if supplied will be placed in between each merged
objectIOException
- if unable to mergeIllegalArgumentException
- if the given destination is included in
the given claimslong importFrom(Path content, ContentClaim claim) throws IOException
content
- to import fromclaim
- the claim to write imported content toIOException
- if failure to read given contentlong importFrom(InputStream content, ContentClaim claim) throws IOException
content
- to import fromclaim
- the claim to write imported content toIOException
- if unable to read contentlong exportTo(ContentClaim claim, Path destination, boolean append) throws IOException
claim
- to export fromdestination
- where to export dataappend
- if true appends to the destination; false overwritesIOException
- if an IO error occurs. The state of the content for
the given destination is unknown and callers should consider whether they
should clean up any partially created pathslong exportTo(ContentClaim claim, Path destination, boolean append, long offset, long length) throws IOException
claim
- to export fromdestination
- where to export dataappend
- if true appends to the destination; false overwritesoffset
- the offset at which the claim should start being copiedlength
- the number of bytes to copyIOException
- if an IO error occurs. The state of the content for
the given destination is unknown and callers should consider whether they
should clean up any partially created pathslong exportTo(ContentClaim claim, OutputStream destination) throws IOException
claim
- to export fromdestination
- where to export dataIOException
- if an IO error occurs.long exportTo(ContentClaim claim, OutputStream destination, long offset, long length) throws IOException
claim
- to export fromdestination
- where to export dataoffset
- the offset into the claim at which the copy should beginlength
- the number of bytes to copyIOException
- if an IO error occurs.long size(ContentClaim claim) throws IOException
claim
- to get size ofIOException
- if size check failedInputStream read(ContentClaim claim) throws IOException
claim
- to read fromIOException
- if unable to readOutputStream write(ContentClaim claim) throws IOException
claim
- to write toIOException
- if unable to obtain streamvoid purge()
void cleanup()
boolean isAccessible(ContentClaim contentClaim) throws IOException
contentClaim
- the Content Claim to checkfalse
IOException
- if unable to determine accessibilityCopyright © 2016 Apache NiFi Project. All rights reserved.