trait ReadWrite[F[_], A] extends AnyRef

A purely functional ReadWriteLock.

It declare that only a single writer at a time can modify the data, and predefined count of readers can concurrently read the data.

In other cases, it will be semantically blocked until operation become available. All those wishing to access the data are serviced in order.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ReadWrite
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def get: F[A]

    Like read, but does not require explicit release.

    Like read, but does not require explicit release.

    returns

    value snapshot

  2. abstract def modify[B](f: (A) => (A, B)): F[B]

    Like tryModify but does not complete until the update has been successfully made.

  3. abstract def read: F[(A, F[Unit])]

    Acquires a single reader if there is no writers in queue and if the max number of readers is not reached.

    Acquires a single reader if there is no writers in queue and if the max number of readers is not reached.

    Otherwise, it will be semantically blocked until operation become available.

    WARN! Ignoring release action lead to resource leak. In most cases, get is preferable.

    returns

    current value and release action.

  4. abstract def tryGet: F[Option[A]]

    Like tryRead, but does not require explicit release

    Like tryRead, but does not require explicit release

    returns

    value snapshot wrapped in Some or None if reading is unavailable.

  5. abstract def tryModify[B](f: (A) => (A, B)): F[Option[B]]

    Like tryUpdate but allows the update function to return an output value of type B.

    Like tryUpdate but allows the update function to return an output value of type B. The returned action completes with None if the value is not updated successfully and Some(b) otherwise.

  6. abstract def tryRead: F[Option[(A, F[Unit])]]

    Acquires a single reader if there is no writers in queue and if the max number of readers is not reached.

    Acquires a single reader if there is no writers in queue and if the max number of readers is not reached.

    If not, None will be returned as a result.

    returns

    current value and release action wrapped in Some or None if reading is unavailable.

  7. abstract def tryUpdate(f: (A) => A): F[Boolean]

    Attempts to modify the current value with supplied function, returning false if writing is unavailable.

    Attempts to modify the current value with supplied function, returning false if writing is unavailable.

    returns

    whether or not the update succeeded

  8. abstract def tryWrite: F[Option[(A, (A) => F[Unit])]]

    Acquires a single writer if there is no writers in queue and no one is reading.

    Acquires a single writer if there is no writers in queue and no one is reading.

    Or else, None will be returned as a result.

    returns

    current value and putAndRelease action wrapped in Some or None if writing is unavailable.

  9. abstract def update(f: (A) => A): F[Unit]

    Modifies the current value using the supplied update function.

    Modifies the current value using the supplied update function.

    In scenarios where write operation is unavailable it may semantically blocks until operation successfully made.

    returns

    a task that update state value on evaluation.

  10. abstract def write: F[(A, (A) => F[Unit])]

    Acquires a single writer if there is no writers in queue and no one is reading.

    Acquires a single writer if there is no writers in queue and no one is reading.

    Otherwise, it will be semantically blocked until operation become available.

    WARN! Ignoring putAndRelease action lead to resource leak. In most cases, update or set is preferable.

    returns

    current value and putAndRelease action.

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 eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. def set(a: A): F[Unit]

    Sets the current value to a.

    Sets the current value to a.

    In scenarios where write operation is unavailable it may semantically blocks until operation successfully made.

    returns

    a task that update state value to a on evaluation.

  16. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  17. def toString(): String
    Definition Classes
    AnyRef → Any
  18. def trySet(a: A): F[Boolean]

    Sets the current value to a.

    Sets the current value to a.

    In scenarios where write operation is unavailable it may semantically blocks until operation successfully made.

    returns

    whether or not the update succeeded

  19. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped