NodeInfoDao

interface NodeInfoDao(source)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend fun backfillDenormalizedNames()

Backfills longName and shortName columns from the user protobuf for nodes where these columns are NULL. This ensures search functionality works for all nodes. Skips placeholder/default users (hwModel == UNSET).

Link copied to clipboard
abstract suspend fun clearMyNodeInfo()
Link copied to clipboard
open suspend fun clearNodeInfo(preserveFavorites: Boolean)
Link copied to clipboard
abstract suspend fun deleteAllNodes()
Link copied to clipboard
abstract suspend fun deleteDmContactSettings(oldId: String)
Link copied to clipboard
abstract suspend fun deleteMetadata(num: Int)
Link copied to clipboard
abstract suspend fun deleteMetadataForNodes(nodeNums: List<Int>)
Link copied to clipboard
abstract suspend fun deleteNode(num: Int)
Link copied to clipboard
open suspend fun deleteNodeAndMetadata(num: Int)

Atomically deletes one node and its separately stored device metadata.

Link copied to clipboard
abstract suspend fun deleteNodes(nodeNums: List<Int>)
Link copied to clipboard
open suspend fun deleteNodesAndMetadata(nodeNums: List<Int>)

Atomically deletes nodes and their metadata, chunking both IN queries below SQLite's bind-parameter limit. Every chunk participates in the same transaction, so cancellation or a query failure rolls back the whole batch.

Link copied to clipboard
abstract suspend fun deleteNonFavoriteNodes()
Link copied to clipboard
abstract suspend fun deleteReactionsForOwner(oldNum: Int)
Link copied to clipboard
abstract suspend fun doUpsert(node: NodeEntity)
Link copied to clipboard
abstract suspend fun findNodeByPublicKey(publicKey: ByteString?): NodeEntity?
Link copied to clipboard
abstract suspend fun findNodesByPublicKeys(publicKeys: List<ByteString>): List<NodeEntity>
Link copied to clipboard
abstract suspend fun getAllMetadataSnapshot(): List<MetadataEntity>

Snapshot used by DatabaseMerger to carry per-node DeviceMetadata across transports (newest timestamp wins).

Link copied to clipboard
abstract suspend fun getAllNodesSnapshot(): List<NodeEntity>
Link copied to clipboard
abstract suspend fun getMyNodeEntity(): MyNodeEntity?
Link copied to clipboard
abstract fun getMyNodeInfo(): Flow<MyNodeEntity?>
Link copied to clipboard
abstract suspend fun getNodeByNum(num: Int): NodeWithRelations?
Link copied to clipboard
abstract suspend fun getNodeEntitiesByNums(nodeNums: List<Int>): List<NodeEntity>
Link copied to clipboard
abstract fun getNodes(sort: String, includeUnknown: Boolean, hopsAwayMax: Int, lastHeardMin: Int): Flow<List<NodeWithRelations>>
Link copied to clipboard
abstract suspend fun getNodesOlderThan(lastHeard: Int): List<NodeEntity>
Link copied to clipboard
abstract suspend fun getUnknownNodes(): List<NodeEntity>
Link copied to clipboard
open suspend fun installConfig(mi: MyNodeEntity, nodes: List<NodeEntity>): List<Int>

Installs the config download from the connected device, reconciling any node-number change of the device itself (firmware 2.8 renumber, erase-and-reflash, manual re-key) before the new my_node row lands.

Link copied to clipboard
abstract fun nodeDBbyNum(): Flow<Map<Int, NodeWithRelations>>
Link copied to clipboard
abstract suspend fun nodeDBbyNumSnapshot(): Map<Int, NodeWithRelations>

One-shot snapshot of every node row in the CURRENTLY SELECTED database (not the process-wide stateIn cache). Used by session-safe cache loads (see NodeManagerImpl.loadCachedNodeDB) so a transport switch can't deliver a stale pre-switch map.

Link copied to clipboard
abstract suspend fun putAll(nodes: List<NodeEntity>)
Link copied to clipboard
abstract suspend fun remapDmContactKey(oldId: String, newId: String)

Contact keys are "$channel$userId", so a suffix match rewrites just the DM threads of one node.

Link copied to clipboard
abstract suspend fun remapDmContactSettings(oldId: String, newId: String)
Link copied to clipboard
abstract suspend fun remapPacketOwner(oldNum: Int, newNum: Int)

Re-scopes stored messages from one owning node number to another (see Packet.myNodeNum).

Link copied to clipboard
abstract suspend fun remapReactionOwner(oldNum: Int, newNum: Int)

OR IGNORE: myNodeNum is part of the reactions PK; drop the rare duplicate instead of aborting.

Link copied to clipboard
abstract suspend fun setMyNodeInfo(myInfo: MyNodeEntity)
Link copied to clipboard
abstract suspend fun setNodeNotes(num: Int, notes: String)
Link copied to clipboard
abstract suspend fun setPowerChannelLabels(num: Int, labels: List<String>)
Link copied to clipboard
open suspend fun updatePowerChannelLabel(num: Int, channelIndex: Int, label: String)

Sets a single power-channel label (0-based channelIndex) atomically: the read-modify-write runs inside a transaction that reads the current labels from the DB, so concurrent edits to different channels can't clobber each other via a stale read. Earlier channels keep their slot (blank padding); trailing blanks are dropped.

Link copied to clipboard
abstract suspend fun upsert(meta: MetadataEntity)
open suspend fun upsert(node: NodeEntity)