H.Submission (H v0.3.0)

Copy Markdown View Source

Idempotent command receipt keyed by request_id with deterministic payload fingerprinting and status transitions (queued, placed, done, unanswered, withdrawn).

Summary

Functions

Computes a deterministic SHA-256 fingerprint over a command payload (excluding request_id).

Normalizes a stored submission map (atom or string keys after file reload).

Transitions a submission to done with its answer entry ID.

Transitions a submission to placed with its concrete entry ID.

Transitions a submission to unanswered with a failure reason.

Transitions a queued submission to withdrawn.

Constructs a new submission map for durable storage.

Formats a submission into a wire command receipt.

Types

status()

@type status() :: String.t()

Functions

fingerprint(command, conversation_id, args)

@spec fingerprint(String.t(), pos_integer(), map()) :: String.t()

Computes a deterministic SHA-256 fingerprint over a command payload (excluding request_id).

from_storage(raw)

@spec from_storage(map()) :: map()

Normalizes a stored submission map (atom or string keys after file reload).

mark_done(sub, answer_entry_id, now \\ System.system_time(:millisecond))

@spec mark_done(map(), pos_integer(), integer()) :: map()

Transitions a submission to done with its answer entry ID.

mark_placed(sub, entry_id, now \\ System.system_time(:millisecond))

@spec mark_placed(map(), pos_integer(), integer()) :: map()

Transitions a submission to placed with its concrete entry ID.

mark_unanswered(sub, reason, now \\ System.system_time(:millisecond))

@spec mark_unanswered(map(), String.t(), integer()) :: map()

Transitions a submission to unanswered with a failure reason.

mark_withdrawn(sub, now \\ System.system_time(:millisecond))

@spec mark_withdrawn(map(), integer()) :: map()

Transitions a queued submission to withdrawn.

new(attrs)

@spec new(map()) :: map()

Constructs a new submission map for durable storage.

to_receipt(sub, current_seq)

@spec to_receipt(map(), non_neg_integer()) :: map()

Formats a submission into a wire command receipt.