Interface RaftLogFlusher
- All Superinterfaces:
AutoCloseable,CloseableSilently
- All Known Implementing Classes:
DelayedFlusher,RaftLogFlusher.DirectFlusher,RaftLogFlusher.NoopFlusher
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
RaftLog. You can use its
implementations to improve performance at the cost of safety.
The default strategy is RaftLogFlusher.DirectFlusher, which is the safest but slowest option.
The RaftLogFlusher.NoopFlusher is the fastest but most dangerous option, as it will defer flushing to
the operating system. It's then possible to run into data corruption or data loss issues. Please
refer to the documentation regarding this.
DelayedFlusher can be configured to provide a trade-off between performance and
safety. This will cause flushes to be performed in a delayed fashion. See its documentation for
more. You should pick this if RaftLogFlusher.DirectFlusher does not provide the desired performance, but
you still wish a lower likelihood of corruption issues than with RaftLogFlusher.NoopFlusher. The
recommended configuration would be to find the smallest possible delay with which you achieve
your performance goals.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classAn implementation ofRaftLogFlusherwhich flushes immediately in a blocking fashion.static interfaceFactory methods to create a newRaftLogFlusher.static final classAn implementation ofRaftLogFlusherwhich does nothing. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()voidSignals that there is data to be flushed in the journal.default booleanisDirect()If this returns true, then any calls toflush(Journal)are synchronous and immediate, and any guarantees offered by the implementation will hold after a call toflush(Journal).
-
Method Details
-
flush
Signals that there is data to be flushed in the journal. The implementation may or may not immediately flush this.- Parameters:
journal- the journal to flush
-
isDirect
default boolean isDirect()If this returns true, then any calls toflush(Journal)are synchronous and immediate, and any guarantees offered by the implementation will hold after a call toflush(Journal). -
close
default void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseableSilently
-