class EventsBuffer extends NamedLogging

This in-memory fan-out buffer allows a DatabaseSequencer.single(...) instance to fully bypass reading events back from the database, since there's only a single writer.

Multiple readers may request an immutable snapshot of the buffer at any time. We use immutable scala.collection.immutable.Vector to allow efficient random access to find the reading start point using binary search.

The user of this buffer is responsible for providing the events in the right order.

The buffer is configured with a memory limit and only holds events up to this limit. The memory used by an event is merely an approximated value and not intended to be very precise, see com.digitalasset.canton.synchronizer.sequencer.store.EventsBuffer.approximateEventSize. There is no direct bound on the number of events that can be buffered, as long as the total sum of the memory used by all events is below the memory limit. This means there could be a few very big events or a lot of small events, or anything in between.

There are some invariants/restrictions:

  • The EventsBuffer always keeps at least 1 element, even if the single event exceeds the memory limit.
  • After adding elements to the buffer, old elements are removed from the buffer until the memory usage drops below the memory limit.
  • Only a single process may write to the buffer.
Annotations
@SuppressWarnings()
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. EventsBuffer
  2. NamedLogging
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new EventsBuffer(maxEventsBufferMemory: BytesUnit, loggerFactory: NamedLoggerFactory, cacheMetrics: CacheMetrics)

    maxEventsBufferMemory

    the maximum amount of memory the buffered events may occupy

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. final def bufferEvents(events: NonEmpty[Seq[Sequenced[BytesPayload]]]): Unit

    Appends events up to the memory limit to the buffer.

    Appends events up to the memory limit to the buffer. May drop already buffered events and may not buffer all provided events to stay within the memory limit.

  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. implicit def errorLoggingContext(implicit traceContext: TraceContext): ErrorLoggingContext
    Attributes
    protected
    Definition Classes
    NamedLogging
  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  12. final def invalidateBuffer(): Unit

    Empty the buffer for events, i.e.

    Empty the buffer for events, i.e. in case of a writer failure

  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def logger: TracedLogger
    Attributes
    protected
    Definition Classes
    NamedLogging
  15. val loggerFactory: NamedLoggerFactory
    Definition Classes
    EventsBufferNamedLogging
  16. implicit def namedLoggingContext(implicit traceContext: TraceContext): NamedLoggingContext
    Attributes
    protected
    Definition Classes
    NamedLogging
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def noTracingLogger: Logger
    Attributes
    protected
    Definition Classes
    NamedLogging
  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  21. final def prependEventsForPreloading(events: NonEmpty[Seq[Sequenced[BytesPayload]]]): Boolean

    Prepends events to the buffer up to the memory limit.

    Prepends events to the buffer up to the memory limit. May not buffer all provided events to stay within the memory limits.

    returns

    true if the buffer is at the memory limit or some events had to be dropped again to stay within the memory limit.

  22. final def snapshot(): Vector[Sequenced[BytesPayload]]
  23. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  24. def toString(): String
    Definition Classes
    AnyRef → Any
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from NamedLogging

Inherited from AnyRef

Inherited from Any

Ungrouped