Class DefaultSegmentWriterBuilder
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.DefaultSegmentWriterBuilder
-
public final class DefaultSegmentWriterBuilder extends java.lang.Object
Builder for buildingDefaultSegmentWriter
instances. The returned instances are thread safe ifwithWriterPool()
was specified and not thread sage ifwithoutWriterPool()
was specified (default).Default: calling one of the
build()
methods without previously calling one of thewith...()
methods returns aSegmentWriter
as 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 DefaultSegmentWriter
build(@NotNull FileStore store)
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 java.lang.String name)
Set thename
of this builder.@NotNull DefaultSegmentWriterBuilder
with(WriterCacheManager cacheManager)
Specify thecacheManager
used by the returned writer.@NotNull DefaultSegmentWriterBuilder
withGeneration(@NotNull org.apache.jackrabbit.guava.common.base.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
withoutCache()
Specify that the returned writer should not use a cache.@NotNull DefaultSegmentWriterBuilder
withoutWriterPool()
Create aSegmentWriter
backed by aSegmentBufferWriter
.@NotNull DefaultSegmentWriterBuilder
withWriterPool()
Create aSegmentWriter
backed by aSegmentBufferWriterPool
.
-
-
-
Method Detail
-
defaultSegmentWriterBuilder
@NotNull public static @NotNull DefaultSegmentWriterBuilder defaultSegmentWriterBuilder(@NotNull @NotNull java.lang.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 org.apache.jackrabbit.guava.common.base.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()
was specified a 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
@NotNull public @NotNull DefaultSegmentWriterBuilder withWriterPool()
Create aSegmentWriter
backed by aSegmentBufferWriterPool
. The returned instance is thread safe.
-
withoutWriterPool
@NotNull public @NotNull DefaultSegmentWriterBuilder withoutWriterPool()
Create aSegmentWriter
backed by aSegmentBufferWriter
. The returned instance is not thread safe.
-
with
@NotNull public @NotNull DefaultSegmentWriterBuilder with(WriterCacheManager cacheManager)
Specify thecacheManager
used 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 aSegmentWriter
for aFileStore
.
-
build
@NotNull public @NotNull DefaultSegmentWriter build(@NotNull @NotNull ReadOnlyFileStore store)
Build aSegmentWriter
for aReadOnlyFileStore
. Attempting to write to the returned writer will cause aUnsupportedOperationException
to be thrown.
-
build
@NotNull public @NotNull DefaultSegmentWriter build(@NotNull @NotNull MemoryStore store)
Build aSegmentWriter
for aMemoryStore
.
-
-