Rindle.Streaming (Rindle v0.1.7)

Copy Markdown View Source

Streaming-owned public entrypoints.

Phase 45 adds browser-to-provider direct upload creation here so the public contract stays separate from the storage broker lifecycle.

Direct upload cancel (v1.13)

cancel_direct_upload/1 accepts only the Rindle asset_id returned from create_direct_upload/2. Success is bare :ok (including idempotent re-cancel when the row is already deleted or the provider upload is already terminal).

Orchestration is FSM-first: a conditional update from pending or uploading to deleted runs before any best-effort provider cancel. Provider handles never cross the public boundary.

Summary

Functions

Cancel a direct-creator upload by Rindle asset_id.

Mint a browser-safe direct upload for a streaming-enabled profile.

Types

cancel_direct_upload_result()

@type cancel_direct_upload_result() ::
  :ok
  | {:error, :not_found}
  | {:error, :streaming_not_configured}
  | {:error, :provider_sync_failed}
  | {:error, :provider_quota_exceeded}
  | {:error, {:not_cancellable, not_cancellable_detail()}}

Result of cancel_direct_upload/1 (implementation ships Phase 65).

Success is bare :ok (idempotent re-cancel included). Provider handles never appear on this boundary.

direct_upload_result()

@type direct_upload_result() ::
  {:ok, %{upload_url: String.t(), asset_id: Ecto.UUID.t()}} | {:error, term()}

not_cancellable_detail()

@type not_cancellable_detail() ::
  %{reason: :state, state: String.t()}
  | %{reason: :ingest_mode, ingest_mode: String.t()}
  | %{reason: :missing_upload_id}

Functions

cancel_direct_upload(asset_id)

@spec cancel_direct_upload(Ecto.UUID.t()) :: cancel_direct_upload_result()

Cancel a direct-creator upload by Rindle asset_id.

FSM-first: conditionally marks the provider row deleted from pending or uploading, then best-effort calls the provider adapter. Idempotent when the row is already deleted or the provider upload is already terminal.

create_direct_upload(profile, opts \\ [])

@spec create_direct_upload(
  module(),
  keyword()
) :: direct_upload_result()

Mint a browser-safe direct upload for a streaming-enabled profile.

Creates the durable local asset + provider rows, calls the provider adapter for the one-time upload URL, persists only non-secret correlation state, and returns exactly %{upload_url, asset_id}.