ZIO contains a few data types that can help you solve complex problems in asynchronous and concurrent programming. ZIO data types categorize into these sections:
- ZIO — A
ZIOis a value that models an effectful program, which might fail or succeed.
- Exit — An
Exit[E, A]describes the result of executing an
- Cause -
Cause[E]is a description of a full story of a fiber failure.
- Runtime — A
Runtime[R]is capable of executing tasks within an environment
- Fiber — A fiber value models an
IOvalue that has started running, and is the moral equivalent of a green thread.
- FiberRef —
FiberRef[A]models a mutable reference to a value of type
A. As opposed to
Ref[A], a value is bound to an executing
Fiberonly. You can think of it as Java's
- Fiber.Status —
Fiber.Statusdescribe the current status of a Fiber.
- Fiber.Id —
Fiber.Iddescribe the unique identity of a Fiber.
- Hub - A
Hubis an asynchronous message hub that allows publishers to efficiently broadcast values to many subscribers.
- Promise — A
Promiseis a model of a variable that may be set a single time, and awaited on by many fibers.
- Semaphore — A
Semaphoreis an asynchronous (non-blocking) semaphore that plays well with ZIO's interruption.
- ZRef — A
ZRef[EA, EB, A, B]is a polymorphic, purely functional description of a mutable reference. The fundamental operations of a
- Ref —
Ref[A]models a mutable reference to a value of type
A. The two basic operations are
set, which fills the
Refwith a new value, and
get, which retrieves its current content. All operations on a
Refare atomic and thread-safe, providing a reliable foundation for synchronizing concurrent programs.
- Ref —
- ZRefM — A
ZRefM[RA, RB, EA, EB, A, B]is a polymorphic, purely functional description of a mutable reference.
- RefM —
RefM[A]models a mutable reference to a value of type
Ain which we can store immutable data, and update it atomically and effectfully.
- RefM —
- Queue — A
Queueis an asynchronous queue that never blocks, which is safe for multiple concurrent producers and consumers.
STM - An
STMrepresents an effect that can be performed transactionally resulting in a failure or success.
TArray - A
TArray[A]is an array of mutable references that can participate in transactions.
TSet - A
TSetis a mutable set that can participate in transactions.
TMap - A
TMap[A]is a mutable map that can participate in transactions.
TRef - A
TRefis a mutable reference to an immutable value that can participate in transactions.
TPriorityQueue - A
TPriorityQueue[A]is a mutable priority queue that can participate in transactions.
TPromise - A
TPromiseis a mutable reference that can be set exactly once and can participate in transactions.
TQueue - A
TQueueis a mutable queue that can participate in transactions.
TReentrantLock - A
TReentrantLockis a reentrant read / write lock that can be composed.
TSemaphore - A
TSemaphoreis a semaphore that can participate in transactions.
Managed — A
Managedis a value that describes a perishable resource that may be consumed only once inside a given scope.
The following datatypes can be found in ZIO streams library:
- ZStream — A
ZStreamis a lazy, concurrent, asynchronous source of values.
- ZSink — A
ZSinkis a consumer of values from a
ZStream, which may produces a value when it has consumed enough.
- Chunk — ZIO
Chunk: Fast, Pure Alternative to Arrays
- Schedule — A
Scheduleis a model of a recurring schedule, which can be used for repeating successful
IOvalues, or retrying failed
To learn more about these data types, please explore the pages above, or check out the Scaladoc documentation.