Class SnapshotProducer.Builder
- java.lang.Object
-
- io.datareplication.producer.snapshot.SnapshotProducer.Builder
-
- Enclosing interface:
- SnapshotProducer
public static class SnapshotProducer.Builder extends java.lang.Object
A builder forSnapshotProducer
.Each of the builder methods modifies the state of the builder and returns the same instance. Because of that, builders are not thread-safe.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NonNull SnapshotProducer
build()
Build a newSnapshotProducer
with the parameters set on this builder.SnapshotProducer.Builder
clock(@NonNull java.time.Clock clock)
Use the givenClock
when generating timestamps for new entities.@NonNull SnapshotProducer.Builder
maxBytesPerPage(long maxBytesPerPage)
Set the maximum bytes per page.@NonNull SnapshotProducer.Builder
maxEntitiesPerPage(long maxEntitiesPerPage)
Set the maximum entities per page.
-
-
-
Method Detail
-
clock
@NonNull public SnapshotProducer.Builder clock(@NonNull @NonNull java.time.Clock clock)
Use the givenClock
when generating timestamps for new entities.- Parameters:
clock
- the clock to use for timestamps- Returns:
- this builder
-
maxBytesPerPage
@NonNull public @NonNull SnapshotProducer.Builder maxBytesPerPage(long maxBytesPerPage)
Set the maximum bytes per page. When a page is composed, a new page will be created if the current page gets too big. Defaults to 1 MB.- Parameters:
maxBytesPerPage
- the maximum bytes per page. Must be equal or greater than 1.- Returns:
- this builder
- Throws:
java.lang.IllegalArgumentException
- if the argument is < 1
-
maxEntitiesPerPage
@NonNull public @NonNull SnapshotProducer.Builder maxEntitiesPerPage(long maxEntitiesPerPage)
Set the maximum entities per page. When a page is composed, a new page will be created if the current page has too many entities. Defaults to Long.MAX_VALUE (meaning no limit).- Parameters:
maxEntitiesPerPage
- the maximum number of entities per page. Must be equal or greater than 1.- Returns:
- this builder
- Throws:
java.lang.IllegalArgumentException
- if the argument is < 1
-
build
@NonNull public @NonNull SnapshotProducer build()
Build a newSnapshotProducer
with the parameters set on this builder.- Returns:
- a new
SnapshotProducer
-
-