ai.entrolution.bengal.stm

Members list

Packages

Core model types for Bengal STM.

Core model types for Bengal STM.

Attributes

Syntax extensions for STM transactions, including F-variant methods for effectful arguments.

Syntax extensions for STM transactions, including F-variant methods for effectful arguments.

Import bengal.stm.syntax.all._ to bring these implicit classes into scope. The F-variant methods (setF, modifyF, handleErrorWithF) accept arguments wrapped in F[_]. Important: the F[_] arguments must not encapsulate side effects, as they may be evaluated multiple times during transaction retries.

Attributes

Type members

Classlikes

abstract class STM[F[_]]

Software Transactional Memory runtime for Cats Effect.

Software Transactional Memory runtime for Cats Effect.

STM provides composable in-memory transactions with automatic concurrency management including locking, retries, semantic blocking, and intelligent scheduling. Create a runtime via STM.runtime and use the implicit syntax classes to build and commit transactions.

import bengal.stm.model.TxnVar

STM.runtime[IO].flatMap { implicit stm =>
 for {
   counter <- TxnVar.of[IO, Int](0)
   _       <- counter.modify(_ + 1).commit
   value   <- counter.get.commit
 } yield value
}

Type parameters

F

the effect type (must have an Async instance)

Attributes

Companion
object
Source
STM.scala
Supertypes
class Object
trait Matchable
class Any
object STM

Attributes

Companion
class
Source
STM.scala
Supertypes
class Object
trait Matchable
class Any
Self type
STM.type