State and Concurrency

Shared state, coordination, and streaming in FsFlow.

State and Concurrency

FsFlow provides several primitives for managing shared state and coordinating concurrent workflows. These tools allow you to build complex, highly-available systems while maintaining the benefits of a Result-based model.

Overview

Ref (Atomic References)

Ref<'T> provides a thread-safe handle for mutable state. It is perfect for shared counters, flags, or small pieces of state that need to be updated atomically across multiple fibers.

Schedule (Retries & Repetition)

The Schedule module provides a powerful language for describing how and when a workflow should be retried upon failure or repeated upon success.

STM (Software Transactional Memory)

STM allows you to compose multiple atomic operations on TVar (transactional variables) into a single transaction. It provides ACID-like properties for in-memory state.

Stream (FlowStream)

FlowStream is an effectful, pull-based stream. It allows you to process large amounts of data asynchronously while respecting the FsFlow environment and error model.


Ref (Atomic References)

Shared mutable state with atomic updates in FsFlow.

Schedule (Retry & Repeat)

Declarative policies for retrying failures and repeating successes in FsFlow.

STM (Software Transactional Memory)

Composable atomic transactions across multiple variables in FsFlow.

Stream (FlowStream)

Effectful, pull-based asynchronous streams in FsFlow.