Class CachingSegmentReader
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.CachingSegmentReader
-
- All Implemented Interfaces:
SegmentReader
public class CachingSegmentReader extends Object implements SegmentReader
ThisSegmentReaderimplementation implements caching for strings and templates. It can also optionally rely on aBlobStorefor resolving blobs.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_STRING_CACHE_MBstatic intDEFAULT_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 CacheStatsgetStringCacheStats()@NotNull CacheStatsgetTemplateCacheStats()@NotNull SegmentBlobreadBlob(@NotNull RecordId id)Read the blob identified byid.@NotNull SegmentNodeStatereadHeadState(@NotNull Revisions revisions)Read the current head state based on the head ofrevisions@NotNull MapRecordreadMap(@NotNull RecordId id)Read the map identified byid.@NotNull SegmentNodeStatereadNode(@NotNull RecordId id)Read the node identified byid.@NotNull SegmentPropertyStatereadProperty(@NotNull RecordId id, @NotNull PropertyTemplate template)Read the property identified byidandtemplate@NotNull StringreadString(@NotNull RecordId id)Cached reading of a string.@NotNull TemplatereadTemplate(@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- ASupplierfor a theSegmentWriterused by the segment builders returned fromNodeState.builder()to write ahead changes.writer.get()must not returnnull.blobStore-BlobStoreinstance of the underlyingSegmentStore, ornullif none.stringCacheMB- the size of the string cache in MBs or0for no cache.templateCacheMB- the size of the template cache in MBs or0for no cache.
-
-
Method Detail
-
readString
@NotNull public @NotNull String readString(@NotNull @NotNull RecordId id)
Cached reading of a string.- Specified by:
readStringin interfaceSegmentReader
-
readMap
@NotNull public @NotNull MapRecord readMap(@NotNull @NotNull RecordId id)
Description copied from interface:SegmentReaderRead the map identified byid.- Specified by:
readMapin interfaceSegmentReader
-
readTemplate
@NotNull public @NotNull Template readTemplate(@NotNull @NotNull RecordId id)
Cached reading of a template.- Specified by:
readTemplatein interfaceSegmentReader
-
readNode
@NotNull public @NotNull SegmentNodeState readNode(@NotNull @NotNull RecordId id)
Description copied from interface:SegmentReaderRead the node identified byid.- Specified by:
readNodein interfaceSegmentReader
-
readHeadState
@NotNull public @NotNull SegmentNodeState readHeadState(@NotNull @NotNull Revisions revisions)
Description copied from interface:SegmentReaderRead the current head state based on the head ofrevisions- Specified by:
readHeadStatein interfaceSegmentReader
-
readProperty
@NotNull public @NotNull SegmentPropertyState readProperty(@NotNull @NotNull RecordId id, @NotNull @NotNull PropertyTemplate template)
Description copied from interface:SegmentReaderRead the property identified byidandtemplate- Specified by:
readPropertyin interfaceSegmentReader
-
readBlob
@NotNull public @NotNull SegmentBlob readBlob(@NotNull @NotNull RecordId id)
Description copied from interface:SegmentReaderRead the blob identified byid.- Specified by:
readBlobin interfaceSegmentReader
-
getStringCacheStats
@NotNull public @NotNull CacheStats getStringCacheStats()
-
getTemplateCacheStats
@NotNull public @NotNull CacheStats getTemplateCacheStats()
-
-