Module methanol

Class CacheWritingPublisher

  • All Implemented Interfaces:
    java.util.concurrent.Flow.Publisher<java.util.List<java.nio.ByteBuffer>>

    public final class CacheWritingPublisher
    extends java.lang.Object
    implements java.util.concurrent.Flow.Publisher<java.util.List<java.nio.ByteBuffer>>
    A Publisher that writes the body stream into cache while simultaneously forwarding it to downstream. Forwarding data downstream and writing it run at different paces. Consequently, writing may lag behind downstream consumption, and may, by default, proceed in background after downstream has been completed. If the com.github.mizosoft.methanol.internal.cache.CacheWritingPublisher.waitForCommit is true, downstream isn't completed unless all data is written and the edit is committed. If an error occurs while writing, the edit is silently discarded.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void subscribe​(java.util.concurrent.Flow.Subscriber<? super java.util.List<java.nio.ByteBuffer>> subscriber)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CacheWritingPublisher

        public CacheWritingPublisher​(java.util.concurrent.Flow.Publisher<java.util.List<java.nio.ByteBuffer>> upstream,
                                     Store.Editor editor,
                                     java.nio.ByteBuffer metadata,
                                     java.util.concurrent.Executor executor)
      • CacheWritingPublisher

        public CacheWritingPublisher​(java.util.concurrent.Flow.Publisher<java.util.List<java.nio.ByteBuffer>> upstream,
                                     Store.Editor editor,
                                     java.nio.ByteBuffer metadata,
                                     java.util.concurrent.Executor executor,
                                     CacheWritingPublisher.Listener listener)
      • CacheWritingPublisher

        public CacheWritingPublisher​(java.util.concurrent.Flow.Publisher<java.util.List<java.nio.ByteBuffer>> upstream,
                                     Store.Editor editor,
                                     java.nio.ByteBuffer metadata,
                                     java.util.concurrent.Executor executor,
                                     CacheWritingPublisher.Listener listener,
                                     boolean waitForCommit)
    • Method Detail

      • subscribe

        public void subscribe​(java.util.concurrent.Flow.Subscriber<? super java.util.List<java.nio.ByteBuffer>> subscriber)
        Specified by:
        subscribe in interface java.util.concurrent.Flow.Publisher<java.util.List<java.nio.ByteBuffer>>