4e57760de6
Build / build (push) Failing after 35s
Goals persist as a player attachment: load on join, write after each change, unload on leave so worlds do not leak. Dying does not wipe the list. Remote dedicated servers stay RAM-only.
50 lines
999 B
Markdown
50 lines
999 B
Markdown
# 💾 Persistence
|
||
|
||
Port used by [[▶️ Create Goal]] (and the sibling quantity / clear paths).
|
||
|
||
The domain does not know where the plan is stored (ADR-004). Infrastructure answers.
|
||
|
||
---
|
||
|
||
## Shape
|
||
|
||
```text
|
||
GoalStore
|
||
all() / find / put / remove / clear
|
||
```
|
||
|
||
Play uses `PersistingGoalStore`: RAM plus a write after each change.
|
||
|
||
`InMemoryGoalStore` remains for unit tests.
|
||
|
||
---
|
||
|
||
## Shipped implementation
|
||
|
||
Player attachment in **this world's save** (ADR-017).
|
||
|
||
| Event | Result |
|
||
|-------|--------|
|
||
| Join world | Load this player's goals |
|
||
| Create / + / − / Clear | Write the attachment |
|
||
| Leave world | Unload RAM. Do not write empty (that would wipe the save) |
|
||
| Death | Plan is copied. It is not loot |
|
||
|
||
Singleplayer and LAN host. Remote dedicated server: RAM-only this slice.
|
||
|
||
Server save and cloud remain possible later. They do not change `GoalStore`.
|
||
|
||
---
|
||
|
||
## Related Documents
|
||
|
||
[[🏛️ Architecture]]
|
||
|
||
[[📦 Packages]]
|
||
|
||
[[📝 Decisions]]
|
||
|
||
[[▶️ Create Goal]]
|
||
|
||
[[🎯 Goal]]
|