Class DefaultSegmentWriterBuilder
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.DefaultSegmentWriterBuilder
-
public final class DefaultSegmentWriterBuilder extends Object
Builder for buildingDefaultSegmentWriterinstances. The returned instances are thread-safe ifwithWriterPool(PoolType)was specified and not thread-safe ifwithoutWriterPool()was specified (default).Default: calling one of the
build()methods without previously calling one of thewith...()methods returns aSegmentWriteras would the following chain of calls:segmentWriterBuilder("name") .with(LATEST_VERSION) .withGeneration(0) .withoutWriterPool() .with(new WriterCacheManager.Default()) .build(store);
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull DefaultSegmentWriterbuild(@NotNull FileStore store)Build aSegmentWriterfor aFileStore.@NotNull DefaultSegmentWriterbuild(@NotNull ReadOnlyFileStore store)Build aSegmentWriterfor aReadOnlyFileStore.@NotNull DefaultSegmentWriterbuild(@NotNull MemoryStore store)Build aSegmentWriterfor aMemoryStore.static @NotNull DefaultSegmentWriterBuilderdefaultSegmentWriterBuilder(@NotNull String name)Set thenameof this builder.@NotNull DefaultSegmentWriterBuilderwith(WriterCacheManager cacheManager)Specify thecacheManagerused by the returned writer.@NotNull DefaultSegmentWriterBuilderwithGeneration(@NotNull Supplier<GCGeneration> generation)Specify thegenerationfor the segment written by the returned segment writer.@NotNull DefaultSegmentWriterBuilderwithGeneration(@NotNull GCGeneration generation)Specify thegenerationfor the segment written by the returned segment writer.@NotNull DefaultSegmentWriterBuilderwithoutCache()Specify that the returned writer should not use a cache.@NotNull DefaultSegmentWriterBuilderwithoutWriterPool()Create aSegmentWriterbacked by aSegmentBufferWriter.@NotNull DefaultSegmentWriterBuilderwithWriterPool()@NotNull DefaultSegmentWriterBuilderwithWriterPool(SegmentBufferWriterPool.PoolType writerType)Create aSegmentWriterbacked by aSegmentBufferWriterPool.
-
-
-
Method Detail
-
defaultSegmentWriterBuilder
@NotNull public static @NotNull DefaultSegmentWriterBuilder defaultSegmentWriterBuilder(@NotNull @NotNull String name)
Set thenameof this builder. This name will appear in the segment's meta data.
-
withGeneration
@NotNull public @NotNull DefaultSegmentWriterBuilder withGeneration(@NotNull @NotNull Supplier<GCGeneration> generation)
Specify thegenerationfor the segment written by the returned segment writer.If
withoutWriterPool()was specified all segments will be written at the generation thatgeneration.get()returned at the time any of thebuild()methods is called. IfwithWriterPool(PoolType)()} was specified, segments will be written at the generation thatgeneration.get()returns when a new segment is created by the returned writer.
-
withGeneration
@NotNull public @NotNull DefaultSegmentWriterBuilder withGeneration(@NotNull @NotNull GCGeneration generation)
Specify thegenerationfor the segment written by the returned segment writer.
-
withWriterPool
@NotNull public @NotNull DefaultSegmentWriterBuilder withWriterPool()
-
withWriterPool
@NotNull public @NotNull DefaultSegmentWriterBuilder withWriterPool(SegmentBufferWriterPool.PoolType writerType)
Create aSegmentWriterbacked by aSegmentBufferWriterPool. The returned instance is thread safe.
-
withoutWriterPool
@NotNull public @NotNull DefaultSegmentWriterBuilder withoutWriterPool()
Create aSegmentWriterbacked by aSegmentBufferWriter. The returned instance is not thread safe.
-
with
@NotNull public @NotNull DefaultSegmentWriterBuilder with(WriterCacheManager cacheManager)
Specify thecacheManagerused by the returned writer.
-
withoutCache
@NotNull public @NotNull DefaultSegmentWriterBuilder withoutCache()
Specify that the returned writer should not use a cache.- See Also:
with(WriterCacheManager)
-
build
@NotNull public @NotNull DefaultSegmentWriter build(@NotNull @NotNull FileStore store)
Build aSegmentWriterfor aFileStore.
-
build
@NotNull public @NotNull DefaultSegmentWriter build(@NotNull @NotNull ReadOnlyFileStore store)
Build aSegmentWriterfor aReadOnlyFileStore. Attempting to write to the returned writer will cause aUnsupportedOperationExceptionto be thrown.
-
build
@NotNull public @NotNull DefaultSegmentWriter build(@NotNull @NotNull MemoryStore store)
Build aSegmentWriterfor aMemoryStore.
-
-