SwitchablePolicy

trait SwitchablePolicy[E] extends Policy[E]

A Policy that can be replaced safely at runtime

Companion:
object
trait Policy[E]
class Object
trait Matchable
class Any

Value members

Abstract methods

def switch[R0, E0, E2 >: E](newPolicy: ZIO[Scope & R0, E0, Policy[E2]], mode: Mode): ZIO[R0, E0, UIO[Unit]]

Switches the policy to the new policy

Switches the policy to the new policy

After completion of this effect, it is guaranteed that new calls are executed with the new policy. Calls in flight before execution of the switch will be completed with the old policy.

The old policy will be released after those in-flight calls are completed. The inner UIO signals completion of release of the old policy.

Value parameters:
mode

Transition mode: Transition = Process new calls with the new policy while completing in-flight calls with the previous policy. FinishInFlight = Wait for completion of in-flight calls with the old policy before accepting

newPolicy

The new policy to apply. Can be a policy that accepts a supertype of errors of the original policy.

Inherited methods

def apply[R, E1 <: E, A](f: ZIO[R, E1, A]): ZIO[R, PolicyError[E1], A]
Inherited from:
Policy
def compose[E2 <: E](that: Policy[PolicyError[E2]]): Policy[E2]

Apply another policy on top of this one

Apply another policy on top of this one

The other policy gets applied before this policy, i.e. policyA compose policyB means policyB { policyA { effect } }

Value parameters:
that

The other policy

Inherited from:
Policy