Ankusa.RouteResolver behaviour (ankusa v0.7.0)

Copy Markdown View Source

Maps a raw ingest request (Plug.Conn) to a Ankusa.Route. This is the seam that makes the catch-URL scheme pluggable, so the framework fits a single static server, a multi-tenant SaaS handing every customer their own path, or a product minting opaque catch URLs of its own shape at runtime — without touching the hot path.

This module is both the behaviour every resolver implements and the instance-scoped facade (resolves config.route_resolver and delegates).

A resolver does URL-scheme work only. It never reads the body, verifies signatures, or touches storage: it answers "which endpoint is this?" and hands back a Ankusa.Route. Policy (verify/sinks) still comes from the Ankusa.SourceStore keyed by the returned source_id.

Summary

Callbacks

resolve(instance, conn, opts)

@callback resolve(instance :: atom(), conn :: Plug.Conn.t(), opts :: keyword()) ::
  {:ok, Ankusa.Route.t()} | :error

Functions

resolve(instance, conn)

@spec resolve(atom(), Plug.Conn.t()) :: {:ok, Ankusa.Route.t()} | :error