Class DefaultSegmentWriterBuilder
java.lang.Object
org.apache.jackrabbit.oak.segment.DefaultSegmentWriterBuilder
Builder for building
DefaultSegmentWriter
instances.
The returned instances are thread-safe if withWriterPool(PoolType)
was specified and not thread-safe if withoutWriterPool()
was specified (default).
Default: calling one of the build()
methods without previously
calling one of the with...()
methods returns a SegmentWriter
as would the following chain of calls:
segmentWriterBuilder("name") .with(LATEST_VERSION) .withGeneration(0) .withoutWriterPool() .with(new WriterCacheManager.Default()) .build(store);
-
Method Summary
Modifier and TypeMethodDescription@NotNull DefaultSegmentWriter
Build aSegmentWriter
for aFileStore
.@NotNull DefaultSegmentWriter
build
(@NotNull ReadOnlyFileStore store) Build aSegmentWriter
for aReadOnlyFileStore
.@NotNull DefaultSegmentWriter
build
(@NotNull MemoryStore store) Build aSegmentWriter
for aMemoryStore
.static @NotNull DefaultSegmentWriterBuilder
defaultSegmentWriterBuilder
(@NotNull String name) Set thename
of this builder.@NotNull DefaultSegmentWriterBuilder
with
(WriterCacheManager cacheManager) Specify thecacheManager
used by the returned writer.@NotNull DefaultSegmentWriterBuilder
withGeneration
(@NotNull Supplier<GCGeneration> generation) Specify thegeneration
for the segment written by the returned segment writer.@NotNull DefaultSegmentWriterBuilder
withGeneration
(@NotNull GCGeneration generation) Specify thegeneration
for the segment written by the returned segment writer.@NotNull DefaultSegmentWriterBuilder
Specify that the returned writer should not use a cache.@NotNull DefaultSegmentWriterBuilder
Create aSegmentWriter
backed by aSegmentBufferWriter
.@NotNull DefaultSegmentWriterBuilder
@NotNull DefaultSegmentWriterBuilder
withWriterPool
(SegmentBufferWriterPool.PoolType writerType) Create aSegmentWriter
backed by aSegmentBufferWriterPool
.
-
Method Details
-
defaultSegmentWriterBuilder
@NotNull public static @NotNull DefaultSegmentWriterBuilder defaultSegmentWriterBuilder(@NotNull @NotNull String name) Set thename
of this builder. This name will appear in the segment's meta data. -
withGeneration
@NotNull public @NotNull DefaultSegmentWriterBuilder withGeneration(@NotNull @NotNull Supplier<GCGeneration> generation) Specify thegeneration
for 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 thegeneration
for the segment written by the returned segment writer. -
withWriterPool
-
withWriterPool
@NotNull public @NotNull DefaultSegmentWriterBuilder withWriterPool(SegmentBufferWriterPool.PoolType writerType) Create aSegmentWriter
backed by aSegmentBufferWriterPool
. The returned instance is thread safe. -
withoutWriterPool
Create aSegmentWriter
backed by aSegmentBufferWriter
. The returned instance is not thread safe. -
with
Specify thecacheManager
used by the returned writer. -
withoutCache
Specify that the returned writer should not use a cache.- See Also:
-
build
Build aSegmentWriter
for aFileStore
. -
build
Build aSegmentWriter
for aReadOnlyFileStore
. Attempting to write to the returned writer will cause aUnsupportedOperationException
to be thrown. -
build
Build aSegmentWriter
for aMemoryStore
.
-