import { DBPeer } from "../../../db/DBPeer"; import { Initiable } from "../../sqliteDAL/Initiable"; export interface PeerDAO extends Initiable { /** * Trigger the initialization of the DAO. Called when the underlying DB is ready. */ triggerInit(): void; listAll(): Promise; withUPStatus(): Promise; /** * Saves a wallet. * @param {DBPeer} peer * @returns {Promise} */ savePeer(peer: DBPeer): Promise; /** * Find a wallet based on conditions. * @param {string} pubkey * @returns {Promise} */ getPeer(pubkey: string): Promise; /** * Find all peers with at least one endpoint matching given parameter. * @param {string} ep * @returns {Promise} */ getPeersWithEndpointsLike(ep: string): Promise; /** * Make a batch insert. * @param records The records to insert as a batch. */ insertBatch(records: DBPeer[]): Promise; /** * Remove a peer by its pubkey. * @param {string} pubkey * @returns {Promise} */ removePeerByPubkey(pubkey: string): Promise; /** * Remove all the peers. * @returns {Promise} */ removeAll(): Promise; /** * Count the number of non-WoT peers known is the DB. * @returns {Promise} The number of nonWoT peers. */ countNonWoTPeers(): Promise; /** * Remove all **non-WoT** peers whose last contact is above given time (timestamp in seconds). * @param {number} threshold * @returns {Promise} */ deleteNonWotPeersWhoseLastContactIsAbove(threshold: number): Promise; }