LongSpscRingBuffer

zio.blocks.ringbuffer.LongSpscRingBuffer
See theLongSpscRingBuffer companion object
final class LongSpscRingBuffer(val capacity: Int)

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

Layout: a single Array[Long]. Since every 64-bit pattern is a legal Long, the FastFlow signal requires reserving sentinel values: EMPTY (Long.MinValue) means "slot empty" and DONE (Long.MinValue + 1L) is the in-band end-of-stream marker. The array is pre-filled with EMPTY at construction.

offer(EMPTY) and offer(DONE) throw IllegalArgumentException (the same shape of contract as SpscRingBuffer.offer(null)). This costs two bit patterns out of 2^64 in exchange for a single memory-ordered op per insert/remove on a single cache line per slot, and removes the need for a separate control queue.

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 for empty, DONE for the sentinel, or the raw Long payload for data.

SPSC: one producer thread, one consumer thread.

Value parameters

capacity

must be a positive power of two

Attributes

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

Members list

Value members

Concrete methods

def isEmpty: Boolean

Attributes

Source
LongSpscRingBuffer.scala
def isFull: Boolean

Attributes

Source
LongSpscRingBuffer.scala
def offer(a: Long): Boolean

Attributes

Source
LongSpscRingBuffer.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
LongSpscRingBuffer.scala
def peek(): Boolean

Attributes

Source
LongSpscRingBuffer.scala
def pollPacked(): Long

Atomically polls the next slot:

Atomically polls the next slot:

  • EMPTY (Long.MinValue) — slot is empty; consumer index NOT advanced.
  • DONE (Long.MinValue + 1L) — in-band done sentinel; consumer index advanced.
  • any other value — the user-visible data; consumer index advanced.

Attributes

Source
LongSpscRingBuffer.scala
def size: Int

Attributes

Source
LongSpscRingBuffer.scala
def take(): Long

Attributes

Source
LongSpscRingBuffer.scala

Concrete fields

val capacity: Int

Attributes

Source
LongSpscRingBuffer.scala

Inherited fields

var consumerIndex: Long

Attributes

Inherited from:
LongSpscConsumerFields (hidden)
Source
LongSpscRingBuffer.scala
var p00: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p01: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p02: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p03: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p04: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p05: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p06: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p07: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p08: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p09: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p0a: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p0b: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p0c: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p0d: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p0e: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p0f: Long

Attributes

Inherited from:
LongSpscPad0 (hidden)
Source
LongSpscRingBuffer.scala
var p10: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p11: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p12: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p13: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p14: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p15: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p16: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p17: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p18: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p19: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p1a: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p1b: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p1c: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p1d: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p1e: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p1f: Long

Attributes

Inherited from:
LongSpscPad1 (hidden)
Source
LongSpscRingBuffer.scala
var p20: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p21: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p22: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p23: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p24: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p25: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p26: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p27: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p28: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p29: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p2a: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p2b: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p2c: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p2d: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p2e: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var p2f: Long

Attributes

Inherited from:
LongSpscPad2 (hidden)
Source
LongSpscRingBuffer.scala
var producerIndex: Long

Attributes

Inherited from:
LongSpscProducerFields (hidden)
Source
LongSpscRingBuffer.scala
var producerLimit: Long

Attributes

Inherited from:
LongSpscProducerFields (hidden)
Source
LongSpscRingBuffer.scala