DatabaseProvider
Provides multiplatform access to the current MeshtasticDatabase and a safe transactional helper. Platform implementations manage the concrete lifecycle (Room on Android, etc.).
Write policy: every one-shot DAO write (insert/upsert/update/delete/clear) must go through withDb, never currentDb.value directly. withDb registers the write with the cross-transport merge drain barrier (see DatabaseManager.associateDevice) so a merge can't snapshot a database while the write is still in flight and lose it when that database is retired. The callback is never replayed automatically after it starts: callers that need retries must make that policy explicit at a higher layer where idempotency is known.
One-shot DAO reads use withReadDb. They stay out of writer admission and the serialized containment lane; the logical-retirement guarantee in DatabaseManager keeps a captured published pool alive for the process lifetime. Long-lived DAO Flows use observeCurrentDb so each implementation must make its database-switch/recovery policy explicit. currentDb remains the synchronous ownership source and the backing latch for existing Paging factories.
Inheritors
Functions
Re-latches query whenever the active database changes. Production also recovers a wedged Room pool.
Execute one bounded read against the synchronously published current database without writer admission. The read is tracked through orderly shutdown and fails with IllegalStateException if admission starts after shutdown.