Core Library0.xAPI reference

Choose documentation 1

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MoreLess about this notice

class libtmux-scala

Observation

Pulls a bounded Java subscription with one active stream consumer. A full buffer yields a Delivery.Gap in this stream before the events that remain. FS2 demand does not provide tmux backpressure. A subscription does not reconnect: attach again and read a snapshot.

Source and package
Qualified name
io.github.libtmux.scaladsl.cats.Observation
Package
io.github.libtmux.scaladsl.cats
Distribution
io.github.libtmux:libtmux-scala_3
Source
libtmux-scala-cats/src/main/scala/io/github/libtmux/scaladsl/cats/Observation.scala
final class Observation[F[_], A]object Observation

Description

The stream itself suspends the fiber, not a platform thread, while idle: EventSubscription is already single-consumer by construction at the Java layer, with a non-blocking poll plus a one-shot onReady wakeup. Each wait polls first — if something is already buffered, nothing suspends at all — and only then arms onReady, disarming it with clearReady if the fiber is cancelled first. No ExecutionContext sized for blocking stream reads is needed, because no read here ever blocks a thread.

Type parameters
  • F for Observation() [overload 1]

  • A for Observation() [overload 1]

Members6 members

Common operations3

  • kept method The event a strict reader kept. A gap fails the read.
  • value method The value inside an event delivery, and none for a gap.
  • UnknownCause class Java ended the subscription without exposing the reason.

Other members3

  • droppedCount method The cumulative overflow count. A Delivery.Gap in stream says where it sits.
  • isClosed method Reports subscription closure, including after resource finalization.
  • stream method Reads on F's own fiber scheduler. Cancelling the stream releases its consumer slot and disarms any pending wakeup; releasing the observation discards its buffered events. Deliberate closure ends the stream. A client that ended the subscription fails it with that cause.
Esc
Search in

Type to search.

Reference previewOpen reference