public final class DefaultSegmentWriterBuilder extends Object
DefaultSegmentWriter
instances.
The returned instances are thread safe if withWriterPool()
was specified and not thread sage 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);
Modifier and Type | Method and Description |
---|---|
@NotNull DefaultSegmentWriter |
build(@NotNull FileStore store)
Build a
SegmentWriter for a FileStore . |
@NotNull DefaultSegmentWriter |
build(@NotNull MemoryStore store)
Build a
SegmentWriter for a MemoryStore . |
@NotNull DefaultSegmentWriter |
build(@NotNull ReadOnlyFileStore store)
Build a
SegmentWriter for a ReadOnlyFileStore . |
static @NotNull DefaultSegmentWriterBuilder |
defaultSegmentWriterBuilder(@NotNull String name)
Set the
name of this builder. |
@NotNull DefaultSegmentWriterBuilder |
with(WriterCacheManager cacheManager)
Specify the
cacheManager used by the returned writer. |
@NotNull DefaultSegmentWriterBuilder |
withGeneration(@NotNull GCGeneration generation)
Specify the
generation for the segment written by the returned
segment writer. |
@NotNull DefaultSegmentWriterBuilder |
withGeneration(@NotNull Supplier<GCGeneration> generation)
Specify the
generation 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 a
SegmentWriter backed by a SegmentBufferWriter . |
@NotNull DefaultSegmentWriterBuilder |
withWriterPool()
Create a
SegmentWriter backed by a SegmentBufferWriterPool . |
@NotNull public static @NotNull DefaultSegmentWriterBuilder defaultSegmentWriterBuilder(@NotNull @NotNull String name)
name
of this builder. This name will appear in the segment's
meta data.@NotNull public @NotNull DefaultSegmentWriterBuilder withGeneration(@NotNull @NotNull Supplier<GCGeneration> generation)
generation
for the segment written by the returned
segment writer.
If withoutWriterPool()
was specified all segments will be written
at the generation that generation.get()
returned at the time
any of the build()
methods is called.
If withWriterPool()
was specified a segments will be written
at the generation that generation.get()
returns when a new segment
is created by the returned writer.
@NotNull public @NotNull DefaultSegmentWriterBuilder withGeneration(@NotNull @NotNull GCGeneration generation)
generation
for the segment written by the returned
segment writer.@NotNull public @NotNull DefaultSegmentWriterBuilder withWriterPool()
SegmentWriter
backed by a SegmentBufferWriterPool
.
The returned instance is thread safe.@NotNull public @NotNull DefaultSegmentWriterBuilder withoutWriterPool()
SegmentWriter
backed by a SegmentBufferWriter
.
The returned instance is not thread safe.@NotNull public @NotNull DefaultSegmentWriterBuilder with(WriterCacheManager cacheManager)
cacheManager
used by the returned writer.@NotNull public @NotNull DefaultSegmentWriterBuilder withoutCache()
with(WriterCacheManager)
@NotNull public @NotNull DefaultSegmentWriter build(@NotNull @NotNull FileStore store)
SegmentWriter
for a FileStore
.@NotNull public @NotNull DefaultSegmentWriter build(@NotNull @NotNull ReadOnlyFileStore store)
SegmentWriter
for a ReadOnlyFileStore
.
Attempting to write to the returned writer will cause a
UnsupportedOperationException
to be thrown.@NotNull public @NotNull DefaultSegmentWriter build(@NotNull @NotNull MemoryStore store)
SegmentWriter
for a MemoryStore
.Copyright © 2012–2020 The Apache Software Foundation. All rights reserved.