CancelCheck

scalus.cardano.infra.CancelCheck
See theCancelCheck companion object
trait CancelCheck

Point-in-time cancellation probe. Callers that only need to check "has this been cancelled?" at specific points in their code accept a CancelCheck. Compared to CancelToken, this is a strictly read-only capability — no listener registration and therefore no bookkeeping cost for either side.

API authors SHOULD accept the weakest type they actually honour. An entry guard that only does if cancel.isCancelled then ... should take CancelCheck; an operation that aborts a pending Future mid-wait via a registered listener should take CancelToken. Matching the type to the capability makes the API honest: readers know "will this be observed mid-wait?" by looking at the signature.

Every CancelToken is also a CancelCheck — pass a token where a check is expected; Scala handles the promotion automatically.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait CancelToken

Members list

Value members

Abstract methods

def cause: Option[Throwable]

If cancelled, the Throwable stored on the source at cancel time — otherwise None.

If cancelled, the Throwable stored on the source at cancel time — otherwise None.

Attributes

def isCancelled: Boolean

true once the owning source has been cancelled.

true once the owning source has been cancelled.

Attributes