Class CachingSegmentReader
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.CachingSegmentReader
-
- All Implemented Interfaces:
SegmentReader
public class CachingSegmentReader extends Object implements SegmentReader
ThisSegmentReader
implementation implements caching for strings and templates. It can also optionally rely on aBlobStore
for resolving blobs.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_STRING_CACHE_MB
static int
DEFAULT_TEMPLATE_CACHE_MB
-
Constructor Summary
Constructors Constructor Description CachingSegmentReader(@NotNull Supplier<SegmentWriter> writer, @Nullable BlobStore blobStore, long stringCacheMB, long templateCacheMB, MeterStats readStats)
Create a new instance based on the supplied arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull CacheStats
getStringCacheStats()
@NotNull CacheStats
getTemplateCacheStats()
@NotNull SegmentBlob
readBlob(@NotNull RecordId id)
Read the blob identified byid
.@NotNull SegmentNodeState
readHeadState(@NotNull Revisions revisions)
Read the current head state based on the head ofrevisions
@NotNull MapRecord
readMap(@NotNull RecordId id)
Read the map identified byid
.@NotNull SegmentNodeState
readNode(@NotNull RecordId id)
Read the node identified byid
.@NotNull SegmentPropertyState
readProperty(@NotNull RecordId id, @NotNull PropertyTemplate template)
Read the property identified byid
andtemplate
@NotNull String
readString(@NotNull RecordId id)
Cached reading of a string.@NotNull Template
readTemplate(@NotNull RecordId id)
Cached reading of a template.
-
-
-
Field Detail
-
DEFAULT_STRING_CACHE_MB
public static final int DEFAULT_STRING_CACHE_MB
- See Also:
- Constant Field Values
-
DEFAULT_TEMPLATE_CACHE_MB
public static final int DEFAULT_TEMPLATE_CACHE_MB
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CachingSegmentReader
public CachingSegmentReader(@NotNull @NotNull Supplier<SegmentWriter> writer, @Nullable @Nullable BlobStore blobStore, long stringCacheMB, long templateCacheMB, MeterStats readStats)
Create a new instance based on the supplied arguments.- Parameters:
writer
- ASupplier
for a theSegmentWriter
used by the segment builders returned fromNodeState.builder()
to write ahead changes.writer.get()
must not returnnull
.blobStore
-BlobStore
instance of the underlyingSegmentStore
, ornull
if none.stringCacheMB
- the size of the string cache in MBs or0
for no cache.templateCacheMB
- the size of the template cache in MBs or0
for no cache.
-
-
Method Detail
-
readString
@NotNull public @NotNull String readString(@NotNull @NotNull RecordId id)
Cached reading of a string.- Specified by:
readString
in interfaceSegmentReader
-
readMap
@NotNull public @NotNull MapRecord readMap(@NotNull @NotNull RecordId id)
Description copied from interface:SegmentReader
Read the map identified byid
.- Specified by:
readMap
in interfaceSegmentReader
-
readTemplate
@NotNull public @NotNull Template readTemplate(@NotNull @NotNull RecordId id)
Cached reading of a template.- Specified by:
readTemplate
in interfaceSegmentReader
-
readNode
@NotNull public @NotNull SegmentNodeState readNode(@NotNull @NotNull RecordId id)
Description copied from interface:SegmentReader
Read the node identified byid
.- Specified by:
readNode
in interfaceSegmentReader
-
readHeadState
@NotNull public @NotNull SegmentNodeState readHeadState(@NotNull @NotNull Revisions revisions)
Description copied from interface:SegmentReader
Read the current head state based on the head ofrevisions
- Specified by:
readHeadState
in interfaceSegmentReader
-
readProperty
@NotNull public @NotNull SegmentPropertyState readProperty(@NotNull @NotNull RecordId id, @NotNull @NotNull PropertyTemplate template)
Description copied from interface:SegmentReader
Read the property identified byid
andtemplate
- Specified by:
readProperty
in interfaceSegmentReader
-
readBlob
@NotNull public @NotNull SegmentBlob readBlob(@NotNull @NotNull RecordId id)
Description copied from interface:SegmentReader
Read the blob identified byid
.- Specified by:
readBlob
in interfaceSegmentReader
-
getStringCacheStats
@NotNull public @NotNull CacheStats getStringCacheStats()
-
getTemplateCacheStats
@NotNull public @NotNull CacheStats getTemplateCacheStats()
-
-