STM

ai.entrolution.bengal.stm.STM
See theSTM companion object
abstract class STM[F[_]]

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
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Classlikes

implicit class TxnOps[V](txn: => Txn[V])

Provides commit and error-handling operations on Txn values.

Provides commit and error-handling operations on Txn values.

Attributes

Source
STM.scala
Supertypes
class Object
trait Matchable
class Any
implicit class TxnVarMapOps[K, V](txnVarMap: TxnVarMap[F, K, V])

Provides transaction operations on TxnVarMap instances.

Provides transaction operations on TxnVarMap instances. Automatically available when an STM[F] is implicit.

Attributes

Source
STM.scala
Supertypes
class Object
trait Matchable
class Any
implicit class TxnVarOps[V](txnVar: TxnVar[F, V])

Provides transaction operations on TxnVar instances.

Provides transaction operations on TxnVar instances. Automatically available when an STM[F] is implicit.

Attributes

Source
STM.scala
Supertypes
class Object
trait Matchable
class Any

Value members

Abstract methods

def allocateTxnVar[V](value: V): F[TxnVar[F, V]]

Creates a new transactional variable with the given initial value.

Creates a new transactional variable with the given initial value.

Attributes

Source
STM.scala
def allocateTxnVarMap[K, V](valueMap: Map[K, V]): F[TxnVarMap[F, K, V]]

Creates a new transactional map with the given initial entries.

Creates a new transactional map with the given initial entries.

Attributes

Source
STM.scala

Inherited methods

def abort(ex: Throwable): Txn[Unit]

Attributes

Inherited from:
TxnApiContext (hidden)
Source
TxnApiContext.scala
def delay[V](thunk: => V): Txn[V]

Attributes

Inherited from:
TxnApiContext (hidden)
Source
TxnApiContext.scala
def fromF[V](spec: F[V]): Txn[V]

Attributes

Inherited from:
TxnApiContext (hidden)
Source
TxnApiContext.scala
def pure[V](value: V): Txn[V]

Attributes

Inherited from:
TxnApiContext (hidden)
Source
TxnApiContext.scala
def waitFor(predicate: => Boolean): Txn[Unit]

Attributes

Inherited from:
TxnApiContext (hidden)
Source
TxnApiContext.scala

Inherited fields

val unit: Txn[Unit]

Attributes

Inherited from:
TxnApiContext (hidden)
Source
TxnApiContext.scala

Implicits

Implicits

final implicit def TxnOps[V](txn: => Txn[V]): TxnOps[V]

Provides commit and error-handling operations on Txn values.

Provides commit and error-handling operations on Txn values.

Attributes

Source
STM.scala
final implicit def TxnVarMapOps[K, V](txnVarMap: TxnVarMap[F, K, V]): TxnVarMapOps[K, V]

Provides transaction operations on TxnVarMap instances.

Provides transaction operations on TxnVarMap instances. Automatically available when an STM[F] is implicit.

Attributes

Source
STM.scala
final implicit def TxnVarOps[V](txnVar: TxnVar[F, V]): TxnVarOps[V]

Provides transaction operations on TxnVar instances.

Provides transaction operations on TxnVar instances. Automatically available when an STM[F] is implicit.

Attributes

Source
STM.scala