SwitchingChannelSetDataSource

Per-device channel-set storage backed by the current device's Room database.

Replaces the former single global channel_set.pb DataStore. The channel set now switches with DatabaseProvider.currentDb, exactly like messages and nodes, so switching between devices can no longer render one device's conversations against another device's channels (#4623).

The whole ChannelSet proto is stored in one row (see ChannelSetEntity); mutations are read-modify-write, so they are serialized through writeMutex to preserve the atomicity the old DataStore's updateData {} provided (the handshake fires overlapping updateChannelSettings calls as it downloads channels one by one).

Constructors

Link copied to clipboard
constructor(dbManager: DatabaseProvider, dispatchers: CoroutineDispatchers)

Properties

Link copied to clipboard
val channelSetFlow: Flow<ChannelSet>

Functions

Link copied to clipboard
suspend fun clearChannelSet()
Link copied to clipboard
suspend fun replaceAllSettings(settingsList: List<ChannelSettings>)

Replaces all ChannelSettings in a single atomic operation.

Link copied to clipboard
suspend fun setLoraConfig(config: Config.LoRaConfig)
Link copied to clipboard
suspend fun updateChannelSet(settingsList: List<ChannelSettings>?, loraConfig: Config.LoRaConfig?)

Atomically updates supplied ChannelSet fields while preserving fields omitted by the caller.

Link copied to clipboard
suspend fun updateChannelSettings(channel: Channel)

Places channel's settings at its index, resizing with blank channels to fill any gap (parity with legacy).