LanguageExt.Core

LanguageExt.Core Concurrency STM

Contents

struct CommuteRef <A> Source #

A proxy for Ref, returned by commute. This allows the transaction system to know that the result is a commutative and therefore give you a result based on the live state rather than the transaction.

See the concurrency section of the wiki for more info.

Properties

property A Value Source #

Methods

method string ToString () Source #

method int GetHashCode () Source #

method bool Equals (object obj) Source #

method bool Equals (A other) Source #

method A Swap (Func<A, A> f) Source #

method A Swap <X> (X x, Func<X, A, A> f) Source #

method A Swap <X, Y> (X x, Y y, Func<X, Y, A, A> f) Source #

method CommuteRef<A> Commute (Func<A, A> f) Source #

method A Commute <X> (X x, Func<X, A, A> f) Source #

method A Commute <X, Y> (X x, Y y, Func<X, Y, A, A> f) Source #

enum Isolation Source #

sync transaction isolation level. Used to enforce ACI properties of ACID on Refs.

See the concurrency section of the wiki for more info.

class Ref <A> Source #

Refs ensure safe shared use of mutable storage locations via a software transactional memory (STM) system. Refs are bound to a single storage location for their lifetime, and only allow mutation of that location to occur within a transaction.

See the concurrency section of the wiki for more info.

Properties

property A Value Source #

Value accessor

Methods

method string ToString () Source #

ToString for the bound value

method int GetHashCode () Source #

Hash code of the bound value

method bool Equals (object obj) Source #

Equality

method bool Equals (A other) Source #

Equality

method A Swap (Func<A, A> f) Source #

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method ValueTask<A> SwapAsync (Func<A, ValueTask<A>> f) Source #

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method Aff<A> SwapAff (Func<A, Aff<A>> f) Source #

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method Eff<A> SwapEff (Func<A, Eff<A>> f) Source #

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method Aff<RT, A> SwapAff <RT> (Func<A, Aff<RT, A>> f) Source #

where RT : struct, HasCancel<RT>

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method Eff<RT, A> SwapEff <RT> (Func<A, Eff<RT, A>> f) Source #

where RT : struct

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method A Swap <X> (X x, Func<X, A, A> f) Source #

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method ValueTask<A> SwapAsync <X, Y> (X x, Y y, Func<X, Y, A, ValueTask<A>> f) Source #

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method Aff<A> SwapAff <X, Y> (X x, Y y, Func<X, Y, A, Aff<A>> f) Source #

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method Eff<A> SwapEff <X, Y> (X x, Y y, Func<X, Y, A, Eff<A>> f) Source #

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method Aff<RT, A> SwapAff <X, Y, RT> (X x, Y y, Func<X, Y, A, Aff<RT, A>> f) Source #

where RT : struct, HasCancel<RT>

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method Eff<RT, A> SwapEff <X, Y, RT> (X x, Y y, Func<X, Y, A, Eff<RT, A>> f) Source #

where RT : struct

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method A Swap <X, Y> (X x, Y y, Func<X, Y, A, A> f) Source #

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method ValueTask<A> SwapAsync <X> (X x, Func<X, A, ValueTask<A>> f) Source #

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method Aff<A> SwapAff <X> (X x, Func<X, A, Aff<A>> f) Source #

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method Eff<A> SwapEff <X> (X x, Func<X, A, Eff<A>> f) Source #

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method Aff<RT, A> SwapAff <X, RT> (X x, Func<X, A, Aff<RT, A>> f) Source #

where RT : struct, HasCancel<RT>

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method Eff<RT, A> SwapEff <X, RT> (X x, Func<X, A, Eff<RT, A>> f) Source #

where RT : struct

Swap the old value for the new returned by f Must be run within a sync transaction

Parameters

param f

Swap function

returns

The value returned from f

method CommuteRef<A> Commute (Func<A, A> f) Source #

Must be called in a transaction. Sets the in-transaction-value of ref to:

`f(in-transaction-value-of-ref)`

and returns the in-transaction-value when complete.

At the commit point of the transaction, f is run AGAIN with the most recently committed value:

`f(most-recently-committed-value-of-ref)`

Thus f should be commutative, or, failing that, you must accept last-one-in-wins behavior.

Commute allows for more concurrency than just setting the Ref's value

method CommuteRef<A> Commute <X> (X x, Func<X, A, A> f) Source #

Must be called in a transaction. Sets the in-transaction-value of ref to:

`f(in-transaction-value-of-ref)`

and returns the in-transaction-value when complete.

At the commit point of the transaction, f is run AGAIN with the most recently committed value:

`f(most-recently-committed-value-of-ref)`

Thus f should be commutative, or, failing that, you must accept last-one-in-wins behavior.

Commute allows for more concurrency than just setting the Ref's value

method CommuteRef<A> Commute <X, Y> (X x, Y y, Func<X, Y, A, A> f) Source #

Must be called in a transaction. Sets the in-transaction-value of ref to:

`f(in-transaction-value-of-ref)`

and returns the in-transaction-value when complete.

At the commit point of the transaction, f is run AGAIN with the most recently committed value:

`f(most-recently-committed-value-of-ref)`

Thus f should be commutative, or, failing that, you must accept last-one-in-wins behavior.

Commute allows for more concurrency than just setting the Ref's value

class STM Source #

Software transactional memory using Multi-Version Concurrency Control (MVCC)

See the concurrency section of the wiki for more info.

Properties

property long TransactionId Source #

Get the currently running TransactionId