c

com.daml.resources

Resource

abstract class Resource[Context, +A] extends AnyRef

A Resource is a Future that can be (asynchronously) released and will also release automatically upon failure.

A

The type of value being protected as a Resource.

Self Type
Resource[Context, A]
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Resource
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Resource()(implicit arg0: HasExecutionContext[Context])

Abstract Value Members

  1. abstract def asFuture: Future[A]

    Every Resource has an underlying Future representation.

  2. abstract def release(): Future[Unit]

    Every Resource can be (asynchronously) released.

    Every Resource can be (asynchronously) released. Releasing a resource will also release all earlier resources constructed via flatMap or a for comprehension.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. def flatMap[B](f: (A) ⇒ R[B])(implicit context: Context): R[B]

    Just like Futures, Resources can be chained.

    Just like Futures, Resources can be chained. Both component Resources will be released correctly upon failure and explicit release.

  10. def flatten[B](implicit nestedEvidence: <:<[A, R[B]], context: Context): R[B]

    A nested resource can be flattened.

  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def map[B](f: (A) ⇒ B)(implicit context: Context): R[B]

    The underlying Future value in a Resource can be transformed.

  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. def transform[B](f: (Try[A]) ⇒ Try[B])(implicit context: Context): R[B]

    Creates a new Resource by applying the specified function to the result of this Resource.

    Creates a new Resource by applying the specified function to the result of this Resource. If there is any non-fatal exception thrown when 'f' is applied then that exception will be propagated to the resulting future.

  21. def transformWith[B](f: (Try[A]) ⇒ R[B])(implicit context: Context): R[B]

    Creates a new Resource by applying the specified function, which produces a Resource, to the result of this Resource.

    Creates a new Resource by applying the specified function, which produces a Resource, to the result of this Resource. If there is any non-fatal exception thrown when 'f' is applied then that exception will be propagated to the resulting future.

  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  25. def withFilter(p: (A) ⇒ Boolean)(implicit context: Context): R[A]

    A Resource's underlying value can be filtered out and result in a Resource with a failed Future.

Inherited from AnyRef

Inherited from Any

Ungrouped