Hyperlinkv0.8.0-beta.28

TxQueue

TxQueue.Statetypeeffect/TxQueue.ts:57
State<_A, E>

Represents the state of a transactional queue with sophisticated lifecycle management.

Details

The queue progresses through three states:

  • Open: Accepting offers and serving takes normally
  • Closing: No new offers accepted, serving remaining items until empty
  • Done: Terminal state with completion cause, no further operations possible

Example (Inspecting queue lifecycle states)

import type { TxQueue } from "effect"

// State progression example
declare const state: TxQueue.State<string, Error>

if (state._tag === "Open") {
  console.log("Queue is accepting new items")
} else if (state._tag === "Closing") {
  console.log("Queue is draining, cause:", state.cause)
} else {
  console.log("Queue is done, cause:", state.cause)
}
models
Source effect/TxQueue.ts:5712 lines
export type State<_A, E> =
  | {
    readonly _tag: "Open"
  }
  | {
    readonly _tag: "Closing"
    readonly cause: Cause.Cause<E>
  }
  | {
    readonly _tag: "Done"
    readonly cause: Cause.Cause<E>
  }
Referenced by 8 symbols