Packages

sealed abstract class ZTRef[+EA, +EB, -A, +B] extends Serializable

A ZTRef[EA, EB, A, B] is a polymorphic, purely functional description of a mutable reference that can be modified as part of a transactional effect. The fundamental operations of a ZTRef are set and get. set takes a value of type A and transactionally sets the reference to a new value, potentially failing with an error of type EA. get gets the current value of the reference and returns a value of type B, potentially failing with an error of type EB.

When the error and value types of the ZTRef are unified, that is, it is a ZTRef[E, E, A, A], the ZTRef also supports atomic modify and update operations. All operations are guaranteed to be executed transactionally.

NOTE: While ZTRef provides the transactional equivalent of a mutable reference, the value inside the ZTRef should be immutable. For performance reasons ZTRef is implemented in terms of compare and swap operations rather than synchronization. These operations are not safe for mutable values that do not support concurrent access.

Self Type
ZTRef[EA, EB, A, B]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ZTRef
  2. Serializable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def atomic: Atomic[_]
    Attributes
    protected
  2. abstract def fold[EC, ED, C, D](ea: (EA) => EC, eb: (EB) => ED, ca: (C) => Either[EC, A], bd: (B) => Either[ED, D]): ZTRef[EC, ED, C, D]

    Folds over the error and value types of the ZTRef.

    Folds over the error and value types of the ZTRef. This is a highly polymorphic method that is capable of arbitrarily transforming the error and value types of the ZTRef. For most use cases one of the more specific combinators implemented in terms of fold will be more ergonomic but this method is extremely useful for implementing new combinators.

  3. abstract def foldAll[EC, ED, C, D](ea: (EA) => EC, eb: (EB) => ED, ec: (EB) => EC, ca: (C) => (B) => Either[EC, A], bd: (B) => Either[ED, D]): ZTRef[EC, ED, C, D]

    Folds over the error and value types of the ZTRef, allowing access to the state in transforming the set value.

    Folds over the error and value types of the ZTRef, allowing access to the state in transforming the set value. This is a more powerful version of fold but requires unifying the error types.

  4. abstract def get: STM[EB, B]

    Retrieves the value of the ZTRef.

  5. abstract def set(a: A): STM[EA, Unit]

    Sets the value of the ZTRef.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def collect[C](pf: PartialFunction[B, C]): ZTRef[EA, Option[EB], A, C]

    Maps and filters the get value of the ZTRef with the specified partial function, returning a ZTRef with a get value that succeeds with the result of the partial function if it is defined or else fails with None.

  7. final def contramap[C](f: (C) => A): ZTRef[EA, EB, C, B]

    Transforms the set value of the ZTRef with the specified function.

  8. final def contramapEither[EC >: EA, C](f: (C) => Either[EC, A]): ZTRef[EC, EB, C, B]

    Transforms the set value of the ZTRef with the specified fallible function.

  9. final def dimap[C, D](f: (C) => A, g: (B) => D): ZTRef[EA, EB, C, D]

    Transforms both the set and get values of the ZTRef with the specified functions.

  10. final def dimapEither[EC >: EA, ED >: EB, C, D](f: (C) => Either[EC, A], g: (B) => Either[ED, D]): ZTRef[EC, ED, C, D]

    Transforms both the set and get values of the ZTRef with the specified fallible functions.

  11. final def dimapError[EC, ED](f: (EA) => EC, g: (EB) => ED): ZTRef[EC, ED, A, B]

    Transforms both the set and get errors of the ZTRef with the specified functions.

  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  14. final def filterInput[A1 <: A](f: (A1) => Boolean): ZTRef[Option[EA], EB, A1, B]

    Filters the set value of the ZTRef with the specified predicate, returning a ZTRef with a set value that succeeds if the predicate is satisfied or else fails with None.

  15. final def filterOutput(f: (B) => Boolean): ZTRef[EA, Option[EB], A, B]

    Filters the get value of the ZTRef with the specified predicate, returning a ZTRef with a get value that succeeds if the predicate is satisfied or else fails with None.

  16. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  17. def foldAllM[EC, ED, C, D](ea: (EA) => EC, eb: (EB) => ED, ec: (EB) => EC, ca: (C) => (B) => STM[EC, A], bd: (B) => STM[ED, D]): ZTRef[EC, ED, C, D]

    Folds over the error and value types of the ZTRef, allowing access to the state in transforming the set value.

    Folds over the error and value types of the ZTRef, allowing access to the state in transforming the set value. This is a more powerful version of fold but requires unifying the error types.

  18. def foldM[EC, ED, C, D](ea: (EA) => EC, eb: (EB) => ED, ca: (C) => STM[EC, A], bd: (B) => STM[ED, D]): ZTRef[EC, ED, C, D]

    Folds over the error and value types of the ZTRef.

    Folds over the error and value types of the ZTRef. This is a highly polymorphic method that is capable of arbitrarily transforming the error and value types of the ZTRef. For most use cases one of the more specific combinators implemented in terms of fold will be more ergonomic but this method is extremely useful for implementing new combinators.

  19. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  20. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  21. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  22. final def map[C](f: (B) => C): ZTRef[EA, EB, A, C]

    Transforms the get value of the ZTRef with the specified function.

  23. final def mapEither[EC >: EB, C](f: (B) => Either[EC, C]): ZTRef[EA, EC, A, C]

    Transforms the get value of the ZTRef with the specified fallible function.

  24. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  26. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. final def readOnly: ZTRef[EA, EB, Nothing, B]

    Returns a read only view of the ZTRef.

  28. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  29. def toString(): String
    Definition Classes
    AnyRef → Any
  30. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  31. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  32. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  33. final def writeOnly: ZTRef[EA, Unit, A, Nothing]

    Returns a write only view of the ZTRef.

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped