SmolBox.Store.Memory (SmolBox v0.1.0)

Copy Markdown View Source

Explicitly ephemeral, bounded store for tests and local development.

The GenServer serializes transactions in one BEAM. Stopping it loses identities, claims, reservations and cleanup work; worker machines may remain. Never use it as a fallback for unavailable durable storage. Completed records are retained, so the configured record/serialized-byte limits can eventually reject new work. The byte limit bounds encoded record data, not total BEAM RSS or caller copies.

Summary

Functions

Returns a specification to start this module under a supervisor.

Start an ephemeral store, optionally registered with :name.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(options \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Start an ephemeral store, optionally registered with :name.

:max_records defaults to 256 (maximum 10,000); :max_bytes defaults to 64 MiB (maximum 1 GiB). Both must be positive. The byte limit covers encoded records, not total process memory. Use the PID or registered name as the store context: {SmolBox.Store.Memory, store}. A runtime using it must set mode: :ephemeral. Completed identities are retained and count toward these limits.