Documentation
¶
Overview ¶
Package counteragent is a REQUIRES_MEMORY_SNAPSHOT api.Harness: it holds an in-RAM counter whose state is, by design, NOT reconstructable from the event log. It exists to prove the REQUIRES_MEMORY_SNAPSHOT tier — memory continuity across suspend/restore that STATELESS_REPLAY cannot provide, and that a plain pod (a filesystem-only runtime) must honestly refuse via CanPlace. It is the counterpart to echoagent.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Harness ¶
type Harness struct {
// contains filtered or unexported fields
}
Harness is the in-RAM counter BYOH. Its state lives ONLY in process memory, so it survives suspend/resume solely via a memory snapshot (a substrate ResumeActor of a FULL snapshot), never via journal replay. Use a pointer (the count must persist across turns, and be captured by the memory snapshot).
func (*Harness) Describe ¶
Describe declares REQUIRES_MEMORY_SNAPSHOT: the harness holds in-process state the runtime must be able to snapshot. CanPlace refuses it on a filesystem-only backend (runtime/local, a plain pod); substrate accepts it (MemorySnapshot:true). Not ForkSafe: in-RAM state is not replay-reconstructable.
func (*Harness) Run ¶
Run performs one turn: increment the in-RAM counter and emit its value.
I4 contract (the load-bearing rule for this tier): the counter is NEVER re-initialized from s.History. The host sends the full prior log as History on every turn, also after a memory restore; replaying it into the count, or resetting the count to zero because History is empty, would DESTROY the continuity the snapshot preserved (double-apply / reset to 0). The count is pure process RAM: the Go zero value (0) on a fresh boot, the snapshot-restored value after a memory-restore. So we only ever increment — we do not read s.History for state. That a fresh boot starts at 0 (state lost, not replayed) is the honest reason this harness needs a memory snapshot at all.