PersistenceManager

Singleton persistence manager for managing persisted payloads.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val storageError: StateFlow<StorageError?>

Functions

Link copied to clipboard
fun ackFlushedDeviceGeneratedOutbound(deviceId: UInt, flushedPendingHeartbeats: List<ByteArray>, flushedPayload: List<ByteArray>): Boolean

After a successful push of persisted outbound data, removes only flushedPendingHeartbeats and flushedPayload chunk prefixes from disk. Merges that appended after the snapshot remain. Returns false if the file exists but no longer has those exact prefixes (nothing is written).

Link copied to clipboard

Delete the persisted payload from the device for a specific device ID.

Link copied to clipboard

Delete the persisted payload from the server for a specific device ID.

Link copied to clipboard

Fetch all device-generated persisted payloads.

Link copied to clipboard

Fetch all persisted server-issued payloads.

Link copied to clipboard

Fetch persisted payloads from the server for a specific device ID.

Link copied to clipboard
fun mergePersistHeartbeatFromDevice(deviceId: UInt, heartbeats: List<ByteArray>, heartbeatBridgeReceiveEpochSeconds: List<Long?> = emptyList()): StorageError?

Merges heartbeats with stored ciphertext and propagates any storage error.

Link copied to clipboard
fun mergePersistPayloadFromDevice(deviceId: UInt, additionalPayloads: List<ByteArray>): StorageError?

Merges new ciphertext with stored device data, then propagates any storage error.

Link copied to clipboard

Encodes device payloads with pending heartbeats, then propagates any storage error.

Link copied to clipboard

Encodes a server payload, then replaces its stored copy and propagates any storage error.

Link copied to clipboard

Removes stale server state updates for a device, based on its current DSC and SSC.

Link copied to clipboard

Reset all persisted data by deleting the directory contents.