adk_artifact_gcs_transport behaviour (erlang_adk v0.10.0)

View Source

Narrow object operations required by the GCS artifact adapter.

This boundary is intentionally lower-level than the artifact service. A deterministic in-memory implementation can be injected in tests, while the first-party implementation maps these calls onto the fixed Google Cloud Storage JSON API. Handles are operator-trusted configuration, never values derived from an agent request.

Summary

Types

context/0

-type context() ::
          #{bucket := binary(),
            project := binary(),
            credential := {module(), term()},
            deadline := integer(),
            max_response_bytes := pos_integer()}.

handle/0

-type handle() :: term().

page/0

-type page() :: #{items := [binary()], next_cursor := binary() | undefined}.

Callbacks

delete/3

-callback delete(Handle :: handle(), Object :: binary(), Context :: context()) ->
                    ok | {error, not_found | term()}.

get/3

-callback get(Handle :: handle(), Object :: binary(), Context :: context()) ->
                 {ok, binary()} | {error, not_found | term()}.

get_range/5

-callback get_range(Handle :: handle(),
                    Object :: binary(),
                    Offset :: non_neg_integer(),
                    Length :: pos_integer(),
                    Context :: context()) ->
                       {ok, binary()} | {error, not_found | term()}.

list/5

-callback list(Handle :: handle(),
               Prefix :: binary(),
               Cursor :: binary() | undefined,
               Limit :: pos_integer(),
               Context :: context()) ->
                  {ok, page()} | {error, term()}.

put_if_absent/4

-callback put_if_absent(Handle :: handle(), Object :: binary(), Data :: binary(), Context :: context()) ->
                           ok | {error, exists | term()}.