DoubleSpscRingBuffer

zio.blocks.ringbuffer.DoubleSpscRingBuffer
See theDoubleSpscRingBuffer companion object
final class DoubleSpscRingBuffer(val capacity: Int)

High-performance non-blocking SPSC ring buffer specialized for Double.

Layout: a single Array[Long] storing raw doubleToRawLongBits. The FastFlow signal uses two reserved NaN bit patterns: EMPTY_BITS (0xFFF8_0000_0000_0001L) is the empty marker, DONE_BITS (0xFFF8_0000_0000_0002L) is the in-band end-of-stream marker. If the user offers a Double whose raw bits happen to equal either reserved pattern, it is canonicalized to Double.NaN's standard bit pattern (0x7FF8_0000_0000_0000L) on insertion.

This canonicalization is unobservable: IEEE 754 guarantees NaN != NaN, all NaNs compare equal under reference NaN semantics, and there is no portable Scala/Java way to round-trip a specific NaN payload through arithmetic. The remapping only affects two specific raw bit patterns, which the user could not have meaningfully produced through normal floating-point operations.

In-band "done" sentinel: producers can call offerDone() to insert the end-of-stream marker after the last data value. Consumers reading via pollPacked() receive EMPTY_BITS for empty, DONE_BITS for the sentinel, or the raw doubleToRawLongBits value for data. This removes the need for a separate control queue alongside the data queue.

One memory-ordered op per insert/remove, one cache line per slot.

SPSC: one producer thread, one consumer thread.

Value parameters

capacity

must be a positive power of two

Attributes

Companion
object
Source
DoubleSpscRingBuffer.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def isEmpty: Boolean

Attributes

Source
DoubleSpscRingBuffer.scala
def isFull: Boolean

Attributes

Source
DoubleSpscRingBuffer.scala
def offer(a: Double): Boolean

Attributes

Source
DoubleSpscRingBuffer.scala
def offerDone(): Boolean

Insert the in-band done sentinel. Returns false if the buffer is full; the caller is expected to retry until it succeeds.

Insert the in-band done sentinel. Returns false if the buffer is full; the caller is expected to retry until it succeeds.

Attributes

Source
DoubleSpscRingBuffer.scala
def peek(): Boolean

Attributes

Source
DoubleSpscRingBuffer.scala
def pollPacked(): Long

Atomically polls the next slot and returns the raw bits:

Atomically polls the next slot and returns the raw bits:

  • EMPTY_BITS — slot is empty; consumer index is NOT advanced.
  • DONE_BITS — in-band done sentinel; consumer index advanced.
  • any other value — doubleToRawLongBits(value) for the payload; consumer index advanced. Decode with Double.longBitsToDouble.

Attributes

Source
DoubleSpscRingBuffer.scala
def size: Int

Attributes

Source
DoubleSpscRingBuffer.scala
def take(): Double

Attributes

Source
DoubleSpscRingBuffer.scala

Concrete fields

val capacity: Int

Attributes

Source
DoubleSpscRingBuffer.scala

Inherited fields

var consumerIndex: Long

Attributes

Inherited from:
DoubleSpscConsumerFields (hidden)
Source
DoubleSpscRingBuffer.scala
var p00: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p01: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p02: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p03: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p04: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p05: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p06: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p07: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p08: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p09: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p0a: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p0b: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p0c: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p0d: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p0e: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p0f: Long

Attributes

Inherited from:
DoubleSpscPad0 (hidden)
Source
DoubleSpscRingBuffer.scala
var p10: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p11: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p12: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p13: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p14: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p15: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p16: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p17: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p18: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p19: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p1a: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p1b: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p1c: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p1d: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p1e: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p1f: Long

Attributes

Inherited from:
DoubleSpscPad1 (hidden)
Source
DoubleSpscRingBuffer.scala
var p20: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p21: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p22: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p23: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p24: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p25: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p26: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p27: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p28: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p29: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p2a: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p2b: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p2c: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p2d: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p2e: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var p2f: Long

Attributes

Inherited from:
DoubleSpscPad2 (hidden)
Source
DoubleSpscRingBuffer.scala
var producerIndex: Long

Attributes

Inherited from:
DoubleSpscProducerFields (hidden)
Source
DoubleSpscRingBuffer.scala
var producerLimit: Long

Attributes

Inherited from:
DoubleSpscProducerFields (hidden)
Source
DoubleSpscRingBuffer.scala