DeviceStorage
Device storage backend.
Stores node information, configuration, channels, and other persistent state keyed by TransportIdentity. Implementations must be thread-safe from the perspective of the engine actor (they may use internal locks, but the SDK makes no concurrency assumptions beyond that all calls are serialized by the engine).
Audit trail and factory-reset detection: The recordOwnNode method records the device's NodeNum and firmware version. If the NodeNum changes between calls for the same identity (e.g., factory reset, radio swap, or hostname now resolves to a different physical device), the implementation must atomically clear all state before recording the new tuple. This prevents stale NodeDB rows from leaking into a new session.
Failure contract: implementations may throw MeshtasticException.StorageUnavailable (or any other Exception) to signal transient or persistent I/O failure. The SDK engine catches these uniformly, emits MeshEvent.StorageDegraded at most once per connect cycle, and continues operating entirely in-memory for the remainder of that session. The engine will re-attempt storage activation on the next RadioClient.connect. Callers must therefore not rely on writes having been durable unless they explicitly subscribe to RadioClient.events and confirm no MeshEvent.StorageDegraded was emitted.
Since
0.1.0
Functions
Load all channels.
Load the cached device configuration (all configs, moduleConfigs, myInfo, metadata).
Load all persisted last-heartbeat timestamps.
Load the persisted session passkey, or null if none is stored or the stored entry has expired (per SessionPasskey.expiresAtEpochMs).
Record the local node's NodeNum and firmware version.
Remove a node from storage.
Save all channels atomically.
Save the complete device configuration.
Persist the engine-observed last-heartbeat timestamp for nodeId.
Persist the latched session passkey for this transport identity.