Lockstep.PersistentTerm (Lockstep v0.1.0)

Copy Markdown View Source

Controller-aware wrappers around :persistent_term.

:persistent_term is global-process-table key/value storage, optimised for read-mostly workloads. Reads are lock-free; writes trigger a global GC. Operations are individually atomic but read-then-conditional-write composes racefully.

Per-node isolation

Under a Lockstep iteration with cluster nodes, keys are namespaced by the calling process's node. :persistent_term.put(:foo, 1) on node :n1 and :persistent_term.put(:foo, 2) on node :n2 are stored under distinct internal keys; reads from each node see only their own value. This mirrors how each real BEAM node has its own process-local persistent_term store.

Falls through to the underlying :persistent_term call when no Lockstep controller is in process dictionary.

Summary

Functions

erase(key)

Sync point + :persistent_term.erase/1.

get(key)

Sync point + :persistent_term.get/1.

get(key, default)

Sync point + :persistent_term.get/2 (with default).

info()

Sync point + :persistent_term.info/0.

put(key, value)

Sync point + :persistent_term.put/2.