VideoInterop.AbandonmentGuard behaviour (video_interop v0.1.0)

Copy Markdown View Source

Authenticated producer-native fallback attached to one lease holder.

The BEAM represents both ordinary references and native resource references as references, so is_reference/1 cannot prove that a value has a destructor. This envelope names the producer authority that registered the native resource. A transport can call valid?/1 before accepting it. The authority must decode its own Rustler resource type and return true.

Authorities are trusted local code, not a sandbox boundary. The callback must return quickly without blocking or taking a lock. If its module is unavailable during a code upgrade, validation returns false. The envelope remains opaque to native consumers, which save the complete term until the corresponding claim retires.

Summary

Functions

Builds an authority envelope around a producer-native resource.

Verifies the resource through its producer-specific authority.

Types

t()

@type t() :: %VideoInterop.AbandonmentGuard{
  authority: module(),
  resource: reference()
}

Callbacks

video_interop_abandonment_guard?(term)

@callback video_interop_abandonment_guard?(term()) :: boolean()

Functions

new(resource, authority)

@spec new(reference(), module()) :: t()

Builds an authority envelope around a producer-native resource.

valid?(arg1)

@spec valid?(term()) :: boolean()

Verifies the resource through its producer-specific authority.

Missing modules/functions, exceptions, exits, throws, non-boolean replies, bare references, and malformed envelopes are rejected.