Liking cljdoc? Tell your friends :D

game.gm.migration

The tools a cutover needs (mom/docs/phase-2/02-state-migration.md): prove that an import from MoM is faithful, and write the GM's state back into MoM's shape so the routed path stays a real fallback after the GM has taken writes.

  • diff-state compares a MoM export with what is in the store. It is for checking an IMPORT: protocol rows must match exactly, so run it before the GM takes writes.
  • import-checked! imports into an EMPTY store and refuses to leave a bad import unreported.
  • reverse-state rebuilds a MoM-shaped state (protocol rows, the progress token under :gm, the :idempotency map from the receipts) from the store.
  • fetch-export! / push-state! / require-frozen-and-drained! are the thin MoM calls. Anything that writes demands that MoM report the game frozen and drained first.
The tools a cutover needs (mom/docs/phase-2/02-state-migration.md): prove that an import
from MoM is faithful, and write the GM's state back into MoM's shape so the routed path
stays a real fallback after the GM has taken writes.

- `diff-state` compares a MoM export with what is in the store. It is for checking an
  IMPORT: protocol rows must match exactly, so run it before the GM takes writes.
- `import-checked!` imports into an EMPTY store and refuses to leave a bad import
  unreported.
- `reverse-state` rebuilds a MoM-shaped state (protocol rows, the progress token under
  :gm, the :idempotency map from the receipts) from the store.
- `fetch-export!` / `push-state!` / `require-frozen-and-drained!` are the thin MoM calls.
  Anything that writes demands that MoM report the game frozen and drained first.
raw docstring

diff-stateclj

(diff-state export store*)

Compares a MoM export with the store: {:ok? bool :differences [..] :summary {..}}. Both sides go through the JSON round trip a handler sees. Differences, by :kind: :missing-in-store / :extra-in-store {:protocol}, :changed {:protocol :paths [..]} (the first few differing paths), :token-behind {:export :store} (the store's progress token must be at least the export's), :receipts-missing {:ids} (every legacy :idempotency entry must have become a receipt; the store may have more).

Compares a MoM export with the store: {:ok? bool :differences [..] :summary {..}}.
Both sides go through the JSON round trip a handler sees. Differences, by :kind:
  :missing-in-store / :extra-in-store {:protocol}, :changed {:protocol :paths [..]}
  (the first few differing paths), :token-behind {:export :store} (the store's progress
  token must be at least the export's), :receipts-missing {:ids} (every legacy
  :idempotency entry must have become a receipt; the store may have more).
raw docstring

fetch-export!clj

(fetch-export! mom-url game-name)

MoM's export of the game's state (GET /api/v1/storage/game/:g/reload): the :state map. Needs the GM's own credential and a valid GM lease.

MoM's export of the game's state (`GET /api/v1/storage/game/:g/reload`): the :state map.
Needs the GM's own credential and a valid GM lease.
raw docstring

freeze-statusclj

(freeze-status mom-url game-name)

MoM's freeze status for the game: {:frozen bool :in-flight n ...}.

MoM's freeze status for the game: {:frozen bool :in-flight n ...}.
raw docstring

import-checked!clj

(import-checked! s export)

Imports a MoM export into s, which must be EMPTY (import-state! wipes the store), then diffs it. Throws {:error :store-not-empty} before touching anything, or {:error :import-mismatch :report r} if the result does not match the export. Returns the clean report.

Imports a MoM export into `s`, which must be EMPTY (import-state! wipes the store),
then diffs it. Throws {:error :store-not-empty} before touching anything, or
{:error :import-mismatch :report r} if the result does not match the export. Returns
the clean report.
raw docstring

push-state!clj

(push-state! mom-url game-name state)

Writes state as the game's state in MoM (POST /api/v1/storage/game/:g/kv, an unconditional save): the rollback write. Callers must have checked require-frozen-and-drained!.

Writes `state` as the game's state in MoM (`POST /api/v1/storage/game/:g/kv`, an
unconditional save): the rollback write. Callers must have checked
`require-frozen-and-drained!`.
raw docstring

require-frozen-and-drained!clj

(require-frozen-and-drained! mom-url game-name)

Throws unless MoM reports the game frozen with no events in flight. The in-flight count is per MoM instance: with more than one MoM task, check each. Returns the status.

Throws unless MoM reports the game frozen with no events in flight. The in-flight count is
per MoM instance: with more than one MoM task, check each. Returns the status.
raw docstring

reverse-stateclj

(reverse-state s)

The store's state in MoM's shape: protocol rows, the latest progress token under [:gm :progress-token], and :idempotency rebuilt from the receipts. What push-state! writes back to MoM for a rollback.

The store's state in MoM's shape: protocol rows, the latest progress token under
[:gm :progress-token], and :idempotency rebuilt from the receipts. What
`push-state!` writes back to MoM for a rollback.
raw docstring

store-empty?clj

(store-empty? s)

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close