ReleaseMap

abstract class ReleaseMap extends Serializable

A ReleaseMap represents the finalizers associated with a scope.

The design of ReleaseMap is inspired by ResourceT, written by Michael Snoyman @snoyberg. (https://github.com/snoyberg/conduit/blob/master/resourcet/Control/Monad/Trans/Resource/Internal.hs)

Companion:
object
class Object
trait Matchable
class Any

Type members

Types

type Key

An opaque identifier for a finalizer stored in the map.

An opaque identifier for a finalizer stored in the map.

Value members

Abstract methods

def add(finalizer: Finalizer): UIO[Finalizer]

Adds a finalizer to the finalizers associated with this scope. If the finalizers associated with this scope have already been run this finalizer will be run immediately.

Adds a finalizer to the finalizers associated with this scope. If the finalizers associated with this scope have already been run this finalizer will be run immediately.

The finalizer returned from this method will remove the original finalizer from the map and run it.

def addIfOpen(finalizer: Finalizer): UIO[Option[Key]]

Adds a finalizer to the finalizers associated with this scope. If the scope is still open, a Key will be returned. This is an opaque identifier that can be used to activate this finalizer and remove it from the map. from the map. If the scope has been closed, the finalizer will be executed immediately (with the Exit value with which the scope has ended) and no Key will be returned.

Adds a finalizer to the finalizers associated with this scope. If the scope is still open, a Key will be returned. This is an opaque identifier that can be used to activate this finalizer and remove it from the map. from the map. If the scope has been closed, the finalizer will be executed immediately (with the Exit value with which the scope has ended) and no Key will be returned.

def get(key: Key): UIO[Option[Finalizer]]

Retrieves the finalizer associated with this key.

Retrieves the finalizer associated with this key.

def release(key: Key, exit: Exit[Any, Any]): UIO[Any]

Runs the specified finalizer and removes it from the finalizers associated with this scope.

Runs the specified finalizer and removes it from the finalizers associated with this scope.

def releaseAll(exit: Exit[Any, Any], execStrategy: ExecutionStrategy): UIO[Any]

Runs the finalizers associated with this scope using the specified execution strategy. After this action finishes, any finalizers added to this scope will be run immediately.

Runs the finalizers associated with this scope using the specified execution strategy. After this action finishes, any finalizers added to this scope will be run immediately.

Removes the finalizer associated with this key and returns it.

Removes the finalizer associated with this key and returns it.

def replace(key: Key, finalizer: Finalizer): UIO[Option[Finalizer]]

Replaces the finalizer associated with this key and returns it. If the finalizers associated with this scope have already been run this finalizer will be run immediately.

Replaces the finalizer associated with this key and returns it. If the finalizers associated with this scope have already been run this finalizer will be run immediately.