Fiber

zio.Fiber
See theFiber companion class
object Fiber

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Fiber.type

Members list

Type members

Classlikes

final case class Descriptor(id: Runtime, status: Running, interrupters: Set[FiberId], executor: Executor, isLocked: Boolean)

A record containing information about a Fiber.

A record containing information about a Fiber.

Value parameters

children

The fiber's forked children.

executor

The Executor executing this fiber

id

The fiber's unique identifier

interrupters

The set of fibers attempting to interrupt the fiber or its ancestors.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Dump(fiberId: Runtime, status: Status, trace: StackTrace) extends Product, Serializable

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
sealed abstract class Runtime[+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.

Attributes

Supertypes
class Fiber[E, A]
class Object
trait Matchable
class Any
Self type
Runtime[E, A]
object Status

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Status.type
sealed trait Status

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Done
trait Unfinished
class Running
class Suspended
Self type
sealed abstract class Synthetic[+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.

Attributes

Supertypes
class Fiber[E, A]
class Object
trait Matchable
class Any

Value members

Concrete methods

def awaitAll(fs: Iterable[Fiber[Any, Any]])(implicit trace: Trace): 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

Attributes

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.

Attributes

def collectAllDiscard[E, A](fibers: Iterable[Fiber[E, A]]): Synthetic[E, Unit]

Collects all fibers into a single fiber discarding their results.

Collects all fibers into a single fiber discarding their results.

Attributes

def currentFiber()(implicit unsafe: Unsafe): 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 and this feature is enabled using Runtime.enableCurrentFiber.

Retrieves the fiber currently executing on this thread, if any. This will always be None unless called from within an executing effect and this feature is enabled using Runtime.enableCurrentFiber.

Attributes

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

Attributes

Returns

Fiber[E, A]

def dumpAll(implicit trace: Trace): ZIO[Any, IOException, Unit]

Dumps all fibers to the console.

Dumps all fibers to the console.

Attributes

def dumpAllWith[R, E](f: Dump => ZIO[R, E, Any])(implicit trace: Trace): ZIO[R, E, Unit]

Dumps all fibers to the specified callback.

Dumps all fibers to the specified callback.

Attributes

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

Attributes

Returns

Fiber[E, Nothing] failed fiber

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

Creates a Fiber that has already failed with the specified cause.

Creates a Fiber that has already failed with the specified cause.

Attributes

def fromFuture[A](thunk: => Future[A])(implicit trace: Trace): 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

Attributes

Returns

Fiber[Throwable, A]

def fromZIO[E, A](io: IO[E, A])(implicit trace: Trace): UIO[Synthetic[E, A]]

Lifts an zio.ZIO into a Fiber.

Lifts an zio.ZIO into a Fiber.

Type parameters

A

type of the fiber

E

error type

Value parameters

io

IO[E, A] to turn into a Fiber

Attributes

Returns

UIO[Fiber[E, A]]

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

Interrupts all fibers, awaiting their interruption.

Interrupts all fibers, awaiting their interruption.

Value parameters

fs

Iterable of fibers to be interrupted

Attributes

Returns

UIO[Unit]

def interruptAllAs(fiberId: FiberId)(fs: Iterable[Fiber[Any, Any]])(implicit trace: Trace): 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

Attributes

Returns

UIO[Unit]

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

A fiber that is already interrupted.

A fiber that is already interrupted.

Attributes

Returns

Fiber[Nothing, Nothing] interrupted fiber

def joinAll[E](fs: Iterable[Fiber[E, Any]])(implicit trace: Trace): 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

Attributes

Returns

UIO[Unit]

def roots(implicit trace: Trace): UIO[Chunk[Runtime[_, _]]]

Returns a chunk containing all root fibers. Due to concurrency, the returned chunk is only weakly consistent.

Returns a chunk containing all root fibers. Due to concurrency, the returned chunk is only weakly consistent.

Attributes

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

Attributes

Returns

Fiber[E, A] succeeded fiber

Inherited methods

def fromCompletionStage[A](thunk: => CompletionStage[A]): Fiber[Throwable, A]

Attributes

Inherited from:
FiberPlatformSpecific (hidden)
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

Attributes

Inherited from:
FiberPlatformSpecific (hidden)

Concrete fields

val never: Synthetic[Nothing, Nothing]

A fiber that never fails or succeeds.

A fiber that never fails or succeeds.

Attributes

val unit: Synthetic[Nothing, Unit]

A fiber that has already succeeded with unit.

A fiber that has already succeeded with unit.

Attributes