public class FileStore extends Object implements SegmentStore, Closeable
Modifier and Type | Class and Description |
---|---|
static class |
FileStore.ReadOnlyStore
A read only
FileStore implementation that supports
going back to old revisions. |
Modifier and Type | Method and Description |
---|---|
List<File> |
cleanup()
Run garbage collection on the segment level: reclaim those data segments
that are from an old segment generation and those bulk segments that are not
reachable anymore.
|
void |
close() |
void |
collectBlobReferences(org.apache.jackrabbit.oak.plugins.blob.ReferenceCollector collector)
Finds all external blob references that are currently accessible
in this repository and adds them to the given collector.
|
boolean |
compact()
Copy every referenced record in data (non-bulk) segments.
|
boolean |
containsSegment(SegmentId id)
Checks whether the identified segment exists in this store.
|
void |
flush() |
void |
gc()
Trigger a garbage collection cycle
|
BinaryReferenceConsumer |
getBinaryReferenceConsumer() |
org.apache.jackrabbit.oak.spi.blob.BlobStore |
getBlobStore() |
SegmentNodeState |
getHead()
Convenience method for accessing the root node for the current head.
|
org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean |
getNodeDeduplicationCacheStats() |
SegmentReader |
getReader() |
TarRevisions |
getRevisions() |
org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean |
getSegmentCacheStats() |
Iterable<SegmentId> |
getSegmentIds() |
FileStoreStats |
getStats() |
org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean |
getStringCacheStats() |
org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean |
getStringDeduplicationCacheStats() |
Map<UUID,List<UUID>> |
getTarGraph(String fileName) |
Map<String,Set<UUID>> |
getTarReaderIndex() |
org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean |
getTemplateCacheStats() |
org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean |
getTemplateDeduplicationCacheStats() |
SegmentTracker |
getTracker() |
SegmentWriter |
getWriter() |
void |
maybeCompact(boolean cleanup) |
SegmentId |
newBulkSegmentId()
Create a new
SegmentId for a segment of type "bulk". |
SegmentId |
newDataSegmentId()
Create a new
SegmentId for a segment of type "data". |
SegmentId |
newSegmentId(long msb,
long lsb)
Create a
SegmentId represented by the given MSB/LSB pair. |
int |
readerCount() |
Segment |
readSegment(SegmentId id)
Reads the identified segment from this store.
|
void |
writeSegment(SegmentId id,
byte[] buffer,
int offset,
int length)
Writes the given segment to the segment store.
|
@Nonnull public org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean getSegmentCacheStats()
@Nonnull public org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean getStringCacheStats()
@Nonnull public org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean getTemplateCacheStats()
@CheckForNull public org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean getStringDeduplicationCacheStats()
@CheckForNull public org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean getTemplateDeduplicationCacheStats()
@CheckForNull public org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean getNodeDeduplicationCacheStats()
public void maybeCompact(boolean cleanup) throws IOException
IOException
public int readerCount()
public FileStoreStats getStats()
public void flush() throws IOException
IOException
public List<File> cleanup() throws IOException
IOException
public void collectBlobReferences(org.apache.jackrabbit.oak.plugins.blob.ReferenceCollector collector) throws IOException
Note that this method only collects blob references that are already stored in the repository (at the time when this method is called), so the garbage collector will need some other mechanism for tracking in-memory references and references stored while this method is running.
collector
- reference collector called back for each blob reference foundIOException
public boolean compact() throws IOException
true
if compaction succeeded, false
otherwise.IOException
@Nonnull public SegmentTracker getTracker()
@Nonnull public SegmentWriter getWriter()
@Nonnull public SegmentReader getReader()
@Nonnull public BinaryReferenceConsumer getBinaryReferenceConsumer()
@Nonnull public TarRevisions getRevisions()
@Nonnull public SegmentNodeState getHead()
fileStore.getReader().readHeadState(fileStore.getRevisions())
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public boolean containsSegment(SegmentId id)
SegmentStore
containsSegment
in interface SegmentStore
id
- segment identifiertrue
if the segment exists, false
otherwise@Nonnull public Segment readSegment(SegmentId id)
SegmentStore
readSegment
in interface SegmentStore
id
- segment identifierSegmentNotFoundException
thrown if not foundpublic void writeSegment(SegmentId id, byte[] buffer, int offset, int length) throws IOException
SegmentStore
writeSegment
in interface SegmentStore
id
- segment identifierbuffer
- byte buffer that contains the raw contents of the segmentoffset
- start offset within the byte bufferlength
- length of the segmentIOException
@Nonnull public SegmentId newSegmentId(long msb, long lsb)
SegmentStore
SegmentId
represented by the given MSB/LSB pair.newSegmentId
in interface SegmentStore
msb
- The most significant bits of the SegmentId
.lsb
- The least significant bits of the SegmentId
.null
instance of SegmentId
.@Nonnull public SegmentId newBulkSegmentId()
SegmentStore
SegmentId
for a segment of type "bulk".newBulkSegmentId
in interface SegmentStore
null
instance of SegmentId
.@Nonnull public SegmentId newDataSegmentId()
SegmentStore
SegmentId
for a segment of type "data".newDataSegmentId
in interface SegmentStore
null
instance of SegmentId
.@CheckForNull public org.apache.jackrabbit.oak.spi.blob.BlobStore getBlobStore()
null
otherwise.public void gc()
public Map<UUID,List<UUID>> getTarGraph(String fileName) throws IOException
IOException
Copyright © 2012-2016 The Apache Software Foundation. All Rights Reserved.