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 onlyAbstractFileStore
implementation 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, 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 void
close()
void
collectBlobReferences(Consumer<String> collector)
Finds all external blob references that are currently accessible in this repository and adds them to the given collector.boolean
containsSegment(SegmentId id)
Checks whether the identified segment exists in this store.Set<SegmentId>
getReferencedSegmentIds()
ReadOnlyRevisions
getRevisions()
Iterable<SegmentId>
getSegmentIds()
Map<UUID,Set<UUID>>
getTarGraph(String fileName)
Map<String,Set<UUID>>
getTarReaderIndex()
@NotNull SegmentWriter
getWriter()
@NotNull Segment
readSegment(SegmentId id)
Reads the identified segment from this store.void
setRevision(String revision)
Go to the specifiedrevision
void
writeSegment(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
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:SegmentStore
Writes 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:SegmentStore
Checks whether the identified segment exists in this store.- Parameters:
id
- segment identifier- Returns:
true
if the segment exists,false
otherwise
-
readSegment
@NotNull public @NotNull Segment readSegment(SegmentId id)
Description copied from interface:SegmentStore
Reads the identified segment from this store.- Parameters:
id
- segment identifier- Returns:
- identified segment, or a
SegmentNotFoundException
thrown if not found
-
close
public void close()
-
getWriter
@NotNull public @NotNull SegmentWriter getWriter()
- Specified by:
getWriter
in classAbstractFileStore
-
getTarGraph
public Map<UUID,Set<UUID>> getTarGraph(String fileName) throws IOException
- Throws:
IOException
-
getRevisions
public ReadOnlyRevisions getRevisions()
- Specified by:
getRevisions
in classAbstractFileStore
- Returns:
- the
Revisions
object bound to the current store.
-
collectBlobReferences
public void collectBlobReferences(Consumer<String> collector) throws IOException
Description copied from class:AbstractFileStore
Finds 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:
collectBlobReferences
in classAbstractFileStore
- Parameters:
collector
- reference collector called back for each blob reference found- Throws:
IOException
-
-