Fiber

object Fiber
Companion:
class
class Object
trait Matchable
class Any
Fiber.type

Type members

Classlikes

sealed abstract class Descriptor
Companion:
object
object Descriptor
Companion:
class
sealed abstract class Dump extends Serializable
Companion:
object
object Dump
Companion:
class
final case class Id(startTimeMillis: Long, seqNumber: Long) extends Serializable

The identity of a Fiber, described by the time it began life, and a monotonically increasing sequence number generated from an atomic counter.

The identity of a Fiber, described by the time it began life, and a monotonically increasing sequence number generated from an atomic counter.

Companion:
object
object Id
Companion:
class
sealed abstract class Runtime[+E, +A] extends Fiber[E, A]

A runtime fiber that is executing an effect. Runtime fibers have an identity and a trace.

A runtime fiber that is executing an effect. Runtime fibers have an identity and a trace.

sealed abstract class Status extends Serializable with Product
Companion:
object
object Status
Companion:
class
sealed abstract class Synthetic[+E, +A] extends Fiber[E, A]

A synthetic fiber that is created from a pure value or that combines existing fibers.

A synthetic fiber that is created from a pure value or that combines existing fibers.

Value members

Concrete methods

def awaitAll(fs: Iterable[Fiber[Any, Any]]): UIO[Unit]

Awaits on all fibers to be completed, successfully or not.

Awaits on all fibers to be completed, successfully or not.

Value parameters:
fs

Iterable of fibers to be awaited

Returns:

UIO[Unit]

def collectAll[E, A, Collection <: (Iterable)](fibers: Collection[Fiber[E, A]])(implicit bf: BuildFrom[Collection[Fiber[E, A]], A, Collection[A]]): Synthetic[E, Collection[A]]

Collects all fibers into a single fiber producing an in-order list of the results.

Collects all fibers into a single fiber producing an in-order list of the results.

def done[E, A](exit: => Exit[E, A]): Synthetic[E, A]

A fiber that is done with the specified zio.Exit value.

A fiber that is done with the specified zio.Exit value.

Type parameters:
A

type of the fiber

E

error type

Value parameters:
exit

zio.Exit value

Returns:

Fiber[E, A]

def dump(fibers: Runtime[_, _]*): UIO[Iterable[Dump]]

Collects a complete dump of the specified fibers and all children of the fibers.

Collects a complete dump of the specified fibers and all children of the fibers.

def dumpStr(fibers: Runtime[_, _]*): UIO[String]

Collects a complete dump of the specified fibers and all children of the fibers and renders it as a string.

Collects a complete dump of the specified fibers and all children of the fibers and renders it as a string.

def fail[E](e: E): Synthetic[E, Nothing]

A fiber that has already failed with the specified value.

A fiber that has already failed with the specified value.

Type parameters:
E

error type

Value parameters:
e

failure value

Returns:

Fiber[E, Nothing] failed fiber

def fromEffect[E, A](io: IO[E, A]): UIO[Synthetic[E, A]]

Lifts an zio.IO into a Fiber.

Lifts an zio.IO into a Fiber.

Type parameters:
A

type of the fiber

E

error type

Value parameters:
io

IO[E, A] to turn into a Fiber

Returns:

UIO[Fiber[E, A]]

def fromFuture[A](thunk: => Future[A]): Synthetic[Throwable, A]

Returns a Fiber that is backed by the specified Future.

Returns a Fiber that is backed by the specified Future.

Type parameters:
A

type of the Fiber

Value parameters:
thunk

Future[A] backing the Fiber

Returns:

Fiber[Throwable, A]

def halt[E](cause: Cause[E]): Synthetic[E, Nothing]

Creates a Fiber that is halted with the specified cause.

Creates a Fiber that is halted with the specified cause.

def interruptAll(fs: Iterable[Fiber[Any, Any]]): UIO[Unit]

Interrupts all fibers, awaiting their interruption.

Interrupts all fibers, awaiting their interruption.

Value parameters:
fs

Iterable of fibers to be interrupted

Returns:

UIO[Unit]

def interruptAllAs(fiberId: Id)(fs: Iterable[Fiber[Any, Any]]): UIO[Unit]

Interrupts all fibers as by the specified fiber, awaiting their interruption.

Interrupts all fibers as by the specified fiber, awaiting their interruption.

Value parameters:
fiberId

The identity of the fiber to interrupt as.

fs

Iterable of fibers to be interrupted

Returns:

UIO[Unit]

def interruptAs(id: Id): Synthetic[Nothing, Nothing]

A fiber that is already interrupted.

A fiber that is already interrupted.

Returns:

Fiber[Nothing, Nothing] interrupted fiber

def joinAll[E](fs: Iterable[Fiber[E, Any]]): IO[E, Unit]

Joins all fibers, awaiting their successful completion. Attempting to join a fiber that has erred will result in a catchable error, if that error does not result from interruption.

Joins all fibers, awaiting their successful completion. Attempting to join a fiber that has erred will result in a catchable error, if that error does not result from interruption.

Value parameters:
fs

Iterable of fibers to be joined

Returns:

UIO[Unit]

def putDumpStr(label: String, fibers: Runtime[_, _]*): ZIO[Console, IOException, Unit]

Collects a complete dump of the specified fibers and all children of the fibers and renders it to the console.

Collects a complete dump of the specified fibers and all children of the fibers and renders it to the console.

def succeed[A](a: A): Synthetic[Nothing, A]

Returns a fiber that has already succeeded with the specified value.

Returns a fiber that has already succeeded with the specified value.

Type parameters:
A

type of the fiber

E

error type

Value parameters:
a

success value

Returns:

Fiber[E, A] succeeded fiber

def unsafeCurrentFiber(): Option[Fiber[Any, Any]]

Retrieves the fiber currently executing on this thread, if any. This will always be None unless called from within an executing effect.

Retrieves the fiber currently executing on this thread, if any. This will always be None unless called from within an executing effect.

Inherited methods

Inherited from:
FiberPlatformSpecific
def fromFutureJava[A](thunk: => Future[A]): Fiber[Throwable, A]

WARNING: this uses the blocking Future#get, consider using fromCompletionStage

WARNING: this uses the blocking Future#get, consider using fromCompletionStage

Inherited from:
FiberPlatformSpecific

Concrete fields

A FiberRef that stores the name of the fiber, which defaults to None.

A FiberRef that stores the name of the fiber, which defaults to None.

val never: Synthetic[Nothing, Nothing]

A fiber that never fails or succeeds.

A fiber that never fails or succeeds.

val unit: Synthetic[Nothing, Unit]

A fiber that has already succeeded with unit.

A fiber that has already succeeded with unit.