sealed abstract class Synchronized[-RA, -RB, +EA, +EB, -A, +B] extends ZRef[RA, RB, EA, EB, A, B]
A ZRef.Synchronized[RA, RB, EA, EB, A, B] is a polymorphic, purely
functional description of a mutable reference. The fundamental operations
of a ZRef.Synchronized are set and get. set takes a value of type
A and sets the reference to a new value, requiring an environment of type
RA and potentially failing with an error of type EA. get gets the
current value of the reference and returns a value of type B, requiring
an environment of type RB and potentially failing with an error of type
EB.
When the error and value types of the ZRef.Synchronized are unified, that
is, it is a ZRef.Synchronized[R, R, E, E, A, A], the ZRef.Synchronized
also supports atomic modify and update operations.
Unlike an ordinary ZRef, a ZRef.Synchronized allows performing effects
within update operations, at some cost to performance. Writes will
semantically block other writers, while multiple readers can read
simultaneously.
ZRef.Synchronized also supports composing multiple ZRef.Synchronized
values together to form a single ZRef.Synchronized value that can be
atomically updated using the zip operator. In this case reads and writes
will semantically block other readers and writers.
- Self Type
- Synchronized[RA, RB, EA, EB, A, B]
- Alphabetic
- By Inheritance
- Synchronized
- ZRef
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
semaphores: Set[Semaphore]
- Attributes
- protected
-
abstract
def
unsafeGet(implicit trace: ZTraceElement): ZIO[RB, EB, B]
- Attributes
- protected
-
abstract
def
unsafeSet(a: A)(implicit trace: ZTraceElement): ZIO[RA, EA, Unit]
- Attributes
- protected
-
abstract
def
unsafeSetAsync(a: A)(implicit trace: ZTraceElement): ZIO[RA, EA, Unit]
- Attributes
- protected
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
collect[C](pf: PartialFunction[B, C]): Synchronized[RA, RB, EA, Option[EB], A, C]
Maps and filters the
getvalue of theZRefMwith the specified partial function, returning aZRefMwith agetvalue that succeeds with the result of the partial function if it is defined or else fails withNone.Maps and filters the
getvalue of theZRefMwith the specified partial function, returning aZRefMwith agetvalue that succeeds with the result of the partial function if it is defined or else fails withNone.- Definition Classes
- Synchronized → ZRef
-
final
def
collectZIO[RC <: RB, EC >: EB, C](pf: PartialFunction[B, ZIO[RC, EC, C]]): Synchronized[RA, RC, EA, Option[EC], A, C]
Maps and filters the
getvalue of theZRef.Synchronizedwith the specified effectual partial function, returning aZRef.Synchronizedwith agetvalue that succeeds with the result of the partial function if it is defined or else fails withNone. -
final
def
contramap[C](f: (C) ⇒ A): Synchronized[RA, RB, EA, EB, C, B]
Transforms the
setvalue of theZRef.Synchronizedwith the specified function.Transforms the
setvalue of theZRef.Synchronizedwith the specified function.- Definition Classes
- Synchronized → ZRef
-
final
def
contramapEither[EC >: EA, C](f: (C) ⇒ Either[EC, A]): Synchronized[RA, RB, EC, EB, C, B]
Transforms the
setvalue of theZRefwith the specified fallible function.Transforms the
setvalue of theZRefwith the specified fallible function.- Definition Classes
- Synchronized → ZRef
-
final
def
contramapZIO[RC <: RA, EC >: EA, C](f: (C) ⇒ ZIO[RC, EC, A]): Synchronized[RC, RB, EC, EB, C, B]
Transforms the
setvalue of theZRef.Synchronizedwith the specified effectual function. -
final
def
dimap[C, D](f: (C) ⇒ A, g: (B) ⇒ D): Synchronized[RA, RB, EA, EB, C, D]
Transforms both the
setandgetvalues of theZRef.Synchronizedwith the specified functions.Transforms both the
setandgetvalues of theZRef.Synchronizedwith the specified functions.- Definition Classes
- Synchronized → ZRef
-
final
def
dimapEither[EC >: EA, ED >: EB, C, D](f: (C) ⇒ Either[EC, A], g: (B) ⇒ Either[ED, D]): Synchronized[RA, RB, EC, ED, C, D]
Transforms both the
setandgetvalues of theZRefwith the specified fallible functions.Transforms both the
setandgetvalues of theZRefwith the specified fallible functions.- Definition Classes
- Synchronized → ZRef
-
final
def
dimapError[EC, ED](f: (EA) ⇒ EC, g: (EB) ⇒ ED): Synchronized[RA, RB, EC, ED, A, B]
Transforms both the
setandgeterrors of theZRef.Synchronizedwith the specified functions.Transforms both the
setandgeterrors of theZRef.Synchronizedwith the specified functions.- Definition Classes
- Synchronized → ZRef
-
final
def
dimapZIO[RC <: RA, RD <: RB, EC >: EA, ED >: EB, C, D](f: (C) ⇒ ZIO[RC, EC, A], g: (B) ⇒ ZIO[RD, ED, D]): Synchronized[RC, RD, EC, ED, C, D]
Transforms both the
setandgetvalues of theZRef.Synchronizedwith the specified effectual functions. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
filterInput[A1 <: A](f: (A1) ⇒ Boolean): Synchronized[RA, RB, Option[EA], EB, A1, B]
Filters the
setvalue of theZRef.Synchronizedwith the specified predicate, returning aZRef.Synchronizedwith asetvalue that succeeds if the predicate is satisfied or else fails withNone.Filters the
setvalue of theZRef.Synchronizedwith the specified predicate, returning aZRef.Synchronizedwith asetvalue that succeeds if the predicate is satisfied or else fails withNone.- Definition Classes
- Synchronized → ZRef
-
final
def
filterInputZIO[RC <: RA, EC >: EA, A1 <: A](f: (A1) ⇒ ZIO[RC, EC, Boolean]): Synchronized[RC, RB, Option[EC], EB, A1, B]
Filters the
setvalue of theZRef.Synchronizedwith the specified effectual predicate, returning aZRef.Synchronizedwith asetvalue that succeeds if the predicate is satisfied or else fails withNone. -
final
def
filterOutput(f: (B) ⇒ Boolean): Synchronized[RA, RB, EA, Option[EB], A, B]
Filters the
getvalue of theZRef.Synchronizedwith the specified predicate, returning aZRef.Synchronizedwith agetvalue that succeeds if the predicate is satisfied or else fails withNone.Filters the
getvalue of theZRef.Synchronizedwith the specified predicate, returning aZRef.Synchronizedwith agetvalue that succeeds if the predicate is satisfied or else fails withNone.- Definition Classes
- Synchronized → ZRef
-
final
def
filterOutputZIO[RC <: RB, EC >: EB](f: (B) ⇒ ZIO[RC, EC, Boolean]): Synchronized[RA, RC, EA, Option[EC], A, B]
Filters the
getvalue of theZRef.Synchronizedwith the specified effectual predicate, returning aZRef.Synchronizedwith agetvalue that succeeds if the predicate is satisfied or else fails withNone. -
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
fold[EC, ED, C, D](ea: (EA) ⇒ EC, eb: (EB) ⇒ ED, ca: (C) ⇒ Either[EC, A], bd: (B) ⇒ Either[ED, D]): Synchronized[RA, RB, EC, ED, C, D]
Folds over the error and value types of the
ZRef.Synchronized.Folds over the error and value types of the
ZRef.Synchronized.- Definition Classes
- Synchronized → ZRef
-
final
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]): Synchronized[RA with RB, RB, EC, ED, C, D]
Folds over the error and value types of the
ZRef.Synchronized, allowing access to the state in transforming thesetvalue but requiring unifying the error type.Folds over the error and value types of the
ZRef.Synchronized, allowing access to the state in transforming thesetvalue but requiring unifying the error type.- Definition Classes
- Synchronized → ZRef
-
final
def
foldAllZIO[RC <: RA with RB, RD <: RB, EC, ED, C, D](ea: (EA) ⇒ EC, eb: (EB) ⇒ ED, ec: (EB) ⇒ EC, ca: (C) ⇒ (B) ⇒ ZIO[RC, EC, A], bd: (B) ⇒ ZIO[RD, ED, D]): Synchronized[RC, RD, EC, ED, C, D]
Folds over the error and value types of the
ZRef.Synchronized, allowing access to the state in transforming thesetvalue.Folds over the error and value types of the
ZRef.Synchronized, allowing access to the state in transforming thesetvalue. This is a more powerful version offoldZIObut requires unifying the environment and error types. -
final
def
foldZIO[RC <: RA, RD <: RB, EC, ED, C, D](ea: (EA) ⇒ EC, eb: (EB) ⇒ ED, ca: (C) ⇒ ZIO[RC, EC, A], bd: (B) ⇒ ZIO[RD, ED, D]): Synchronized[RC, RD, EC, ED, C, D]
Folds over the error and value types of the
ZRef.Synchronized.Folds over the error and value types of the
ZRef.Synchronized. This is a highly polymorphic method that is capable of arbitrarily transforming the error and value types of theZRef.Synchronized. For most use cases one of the more specific combinators implemented in terms offoldZIOwill be more ergonomic but this method is extremely useful for implementing new combinators. -
final
def
get(implicit trace: ZTraceElement): ZIO[RB, EB, B]
Reads the value from the
ZRef.Reads the value from the
ZRef.- Definition Classes
- Synchronized → ZRef
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
map[C](f: (B) ⇒ C): Synchronized[RA, RB, EA, EB, A, C]
Transforms the
getvalue of theZRef.Synchronizedwith the specified function.Transforms the
getvalue of theZRef.Synchronizedwith the specified function.- Definition Classes
- Synchronized → ZRef
-
final
def
mapEither[EC >: EB, C](f: (B) ⇒ Either[EC, C]): Synchronized[RA, RB, EA, EC, A, C]
Transforms the
getvalue of theZRefwith the specified fallible function.Transforms the
getvalue of theZRefwith the specified fallible function.- Definition Classes
- Synchronized → ZRef
-
final
def
mapZIO[RC <: RB, EC >: EB, C](f: (B) ⇒ ZIO[RC, EC, C]): Synchronized[RA, RC, EA, EC, A, C]
Transforms the
getvalue of theZRef.Synchronizedwith the specified effectual function. -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
readOnly: Synchronized[RA, RB, EA, EB, Nothing, B]
Returns a read only view of the
ZRef.Synchronized.Returns a read only view of the
ZRef.Synchronized.- Definition Classes
- Synchronized → ZRef
-
final
def
set(a: A)(implicit trace: ZTraceElement): ZIO[RA, EA, Unit]
Writes a new value to the
ZRef, with a guarantee of immediate consistency (at some cost to performance).Writes a new value to the
ZRef, with a guarantee of immediate consistency (at some cost to performance).- Definition Classes
- Synchronized → ZRef
-
final
def
setAsync(a: A)(implicit trace: ZTraceElement): ZIO[RA, EA, Unit]
Writes a new value to the
ZRefwithout providing a guarantee of immediate consistency.Writes a new value to the
ZRefwithout providing a guarantee of immediate consistency.- Definition Classes
- Synchronized → ZRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
tapInput[RC <: RA, EC >: EA, A1 <: A](f: (A1) ⇒ ZIO[RC, EC, Any])(implicit trace: ZTraceElement): Synchronized[RC, RB, EC, EB, A1, B]
Performs the specified effect every time a value is written to this
ZRef.Synchronized. -
final
def
tapOutput[RC <: RB, EC >: EB](f: (B) ⇒ ZIO[RC, EC, Any])(implicit trace: ZTraceElement): Synchronized[RA, RC, EA, EC, A, B]
Performs the specified effect very time a value is read from this
ZRef.Synchronized. -
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
writeOnly: Synchronized[RA, RB, EA, Unit, A, Nothing]
Returns a write only view of the
ZRef.Synchronized.Returns a write only view of the
ZRef.Synchronized.- Definition Classes
- Synchronized → ZRef
Deprecated Value Members
-
final
def
collectM[RC <: RB, EC >: EB, C](pf: PartialFunction[B, ZIO[RC, EC, C]]): ZRefM[RA, RC, EA, Option[EC], A, C]
Maps and filters the
getvalue of theZRefMwith the specified effectual partial function, returning aZRefMwith agetvalue that succeeds with the result of the partial function if it is defined or else fails withNone.Maps and filters the
getvalue of theZRefMwith the specified effectual partial function, returning aZRefMwith agetvalue that succeeds with the result of the partial function if it is defined or else fails withNone.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectZIO
-
final
def
contramapM[RC <: RA, EC >: EA, C](f: (C) ⇒ ZIO[RC, EC, A])(implicit trace: ZTraceElement): ZRefM[RC, RB, EC, EB, C, B]
Transforms the
setvalue of theZRefMwith the specified effectual function.Transforms the
setvalue of theZRefMwith the specified effectual function.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use contramapZIO
-
final
def
dimapM[RC <: RA, RD <: RB, EC >: EA, ED >: EB, C, D](f: (C) ⇒ ZIO[RC, EC, A], g: (B) ⇒ ZIO[RD, ED, D]): ZRefM[RC, RD, EC, ED, C, D]
Transforms both the
setandgetvalues of theZRefMwith the specified effectual functions.Transforms both the
setandgetvalues of theZRefMwith the specified effectual functions.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use dimapZIO
-
final
def
filterInputM[RC <: RA, EC >: EA, A1 <: A](f: (A1) ⇒ ZIO[RC, EC, Boolean]): ZRefM[RC, RB, Option[EC], EB, A1, B]
Filters the
setvalue of theZRefMwith the specified effectual predicate, returning aZRefMwith asetvalue that succeeds if the predicate is satisfied or else fails withNone.Filters the
setvalue of theZRefMwith the specified effectual predicate, returning aZRefMwith asetvalue that succeeds if the predicate is satisfied or else fails withNone.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use filterInputZIO
-
final
def
filterOutputM[RC <: RB, EC >: EB](f: (B) ⇒ ZIO[RC, EC, Boolean]): ZRefM[RA, RC, EA, Option[EC], A, B]
Filters the
getvalue of theZRefMwith the specified effectual predicate, returning aZRefMwith agetvalue that succeeds if the predicate is satisfied or else fails withNone.Filters the
getvalue of theZRefMwith the specified effectual predicate, returning aZRefMwith agetvalue that succeeds if the predicate is satisfied or else fails withNone.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use filterOutputZIO
-
final
def
foldAllM[RC <: RA with RB, RD <: RB, EC, ED, C, D](ea: (EA) ⇒ EC, eb: (EB) ⇒ ED, ec: (EB) ⇒ EC, ca: (C) ⇒ (B) ⇒ ZIO[RC, EC, A], bd: (B) ⇒ ZIO[RD, ED, D]): ZRefM[RC, RD, EC, ED, C, D]
Folds over the error and value types of the
ZRefM, allowing access to the state in transforming thesetvalue.Folds over the error and value types of the
ZRefM, allowing access to the state in transforming thesetvalue. This is a more powerful version offoldMbut requires unifying the environment and error types.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foldAllZIO
-
final
def
foldM[RC <: RA, RD <: RB, EC, ED, C, D](ea: (EA) ⇒ EC, eb: (EB) ⇒ ED, ca: (C) ⇒ ZIO[RC, EC, A], bd: (B) ⇒ ZIO[RD, ED, D]): ZRefM[RC, RD, EC, ED, C, D]
Folds over the error and value types of the
ZRefM.Folds over the error and value types of the
ZRefM. This is a highly polymorphic method that is capable of arbitrarily transforming the error and value types of theZRefM. For most use cases one of the more specific combinators implemented in terms offoldMwill be more ergonomic but this method is extremely useful for implementing new combinators.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foldZIO
-
final
def
mapM[RC <: RB, EC >: EB, C](f: (B) ⇒ ZIO[RC, EC, C])(implicit trace: ZTraceElement): ZRefM[RA, RC, EA, EC, A, C]
Transforms the
getvalue of theZRefMwith the specified effectual function.Transforms the
getvalue of theZRefMwith the specified effectual function.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use mapZIO