Class ReadOnlyFileStore
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.file.AbstractFileStore
-
- org.apache.jackrabbit.oak.segment.file.ReadOnlyFileStore
-
- All Implemented Interfaces:
Closeable,AutoCloseable,SegmentStore
public class ReadOnlyFileStore extends AbstractFileStore
A read onlyAbstractFileStoreimplementation that supports going back to old revisions.All write methods are no-ops.
-
-
Field Summary
-
Fields inherited from class org.apache.jackrabbit.oak.segment.file.AbstractFileStore
binariesInlineThreshold, ioMonitor, persistentCache, remoteStoreMonitor
-
Fields inherited from interface org.apache.jackrabbit.oak.segment.SegmentStore
EMPTY_STORE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcollectBlobReferences(Consumer<String> collector)Finds all external blob references that are currently accessible in this repository and adds them to the given collector.booleancontainsSegment(SegmentId id)Checks whether the identified segment exists in this store.Set<SegmentId>getReferencedSegmentIds()ReadOnlyRevisionsgetRevisions()Iterable<SegmentId>getSegmentIds()Map<UUID,Set<UUID>>getTarGraph(String fileName)Map<String,Set<UUID>>getTarReaderIndex()@NotNull SegmentWritergetWriter()@NotNull SegmentreadSegment(SegmentId id)Reads the identified segment from this store.protected voidregisterCloseables(Closer closer)voidsetRevision(String revision)Go to the specifiedrevisionvoidwriteSegment(SegmentId id, byte[] data, int offset, int length)Writes the given segment to the segment store.-
Methods inherited from class org.apache.jackrabbit.oak.segment.file.AbstractFileStore
close, doClose, getBinariesInlineThreshold, getBlobStore, getHead, getReader, getSegmentCacheStats, getSegmentIdProvider, getStringCacheStats, getTemplateCacheStats
-
-
-
-
Method Detail
-
setRevision
public void setRevision(String revision)
Go to the specifiedrevision- Parameters:
revision-
-
writeSegment
public void writeSegment(SegmentId id, byte[] data, int offset, int length)
Description copied from interface:SegmentStoreWrites the given segment to the segment store.- Parameters:
id- segment identifierdata- byte buffer that contains the raw contents of the segmentoffset- start offset within the byte bufferlength- length of the segment
-
containsSegment
public boolean containsSegment(SegmentId id)
Description copied from interface:SegmentStoreChecks whether the identified segment exists in this store.- Parameters:
id- segment identifier- Returns:
trueif the segment exists,falseotherwise
-
readSegment
@NotNull public @NotNull Segment readSegment(SegmentId id)
Description copied from interface:SegmentStoreReads the identified segment from this store.- Parameters:
id- segment identifier- Returns:
- identified segment, or a
SegmentNotFoundExceptionthrown if not found
-
registerCloseables
protected void registerCloseables(Closer closer)
- Overrides:
registerCloseablesin classAbstractFileStore
-
getWriter
@NotNull public @NotNull SegmentWriter getWriter()
- Specified by:
getWriterin classAbstractFileStore
-
getTarGraph
public Map<UUID,Set<UUID>> getTarGraph(String fileName) throws IOException
- Throws:
IOException
-
getRevisions
public ReadOnlyRevisions getRevisions()
- Specified by:
getRevisionsin classAbstractFileStore- Returns:
- the
Revisionsobject bound to the current store.
-
collectBlobReferences
public void collectBlobReferences(Consumer<String> collector) throws IOException
Description copied from class:AbstractFileStoreFinds all external blob references that are currently accessible in this repository and adds them to the given collector. Useful for collecting garbage in an external data store.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.
- Specified by:
collectBlobReferencesin classAbstractFileStore- Parameters:
collector- reference collector called back for each blob reference found- Throws:
IOException
-
-