Class DefaultSegmentWriterBuilder


  • public final class DefaultSegmentWriterBuilder
    extends java.lang.Object
    Builder for building 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);
     
    • Method Detail

      • defaultSegmentWriterBuilder

        @NotNull
        public static @NotNull DefaultSegmentWriterBuilder defaultSegmentWriterBuilder​(@NotNull
                                                                                       @NotNull java.lang.String name)
        Set the name 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 the 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.

      • withGeneration

        @NotNull
        public @NotNull DefaultSegmentWriterBuilder withGeneration​(@NotNull
                                                                   @NotNull GCGeneration generation)
        Specify the generation for the segment written by the returned segment writer.
      • build

        @NotNull
        public @NotNull DefaultSegmentWriter build​(@NotNull
                                                   @NotNull ReadOnlyFileStore store)
        Build a SegmentWriter for a ReadOnlyFileStore. Attempting to write to the returned writer will cause a UnsupportedOperationException to be thrown.