commit 4f84417f1cad133cb063324dddf409ce5e01a146
parent 7ee997799c07abc3fe30a75a08b6c51d177089ff
Author: Florian Dold <dold@taler.net>
Date: Mon, 20 Jul 2026 02:26:44 +0200
db: enumerate IndexedDB stores with getAll instead of cursors
getAll() is a single request. iter().toArray() walks a cursor with one
bridge round-trip per record.
Diffstat:
1 file changed, 34 insertions(+), 36 deletions(-)
diff --git a/packages/taler-wallet-core/src/dbtx-indexeddb.ts b/packages/taler-wallet-core/src/dbtx-indexeddb.ts
@@ -149,11 +149,11 @@ export class IdbWalletTransaction implements WalletDbTransaction {
}
async listAllConfig(): Promise<ConfigRecord[]> {
- return await this.tx.config.iter().toArray();
+ return await this.tx.config.getAll();
}
async listAllCurrencyInfo(): Promise<WalletCurrencyInfoEntry[]> {
- return await this.tx.currencyInfo.iter().toArray();
+ return await this.tx.currencyInfo.getAll();
}
async upsertCurrencyInfoEntry(entry: WalletCurrencyInfoEntry): Promise<void> {
@@ -204,7 +204,7 @@ export class IdbWalletTransaction implements WalletDbTransaction {
async listContacts(): Promise<ContactEntry[]> {
const tx = this.tx;
- const records = await tx.contacts.iter().toArray();
+ const records = await tx.contacts.getAll();
return records.map((r) => ({
alias: r.alias,
aliasType: r.aliasType,
@@ -234,7 +234,7 @@ export class IdbWalletTransaction implements WalletDbTransaction {
}
async listAllMailboxConfigurations(): Promise<MailboxConfiguration[]> {
- return await this.tx.mailboxConfigurations.iter().toArray();
+ return await this.tx.mailboxConfigurations.getAll();
}
async getMailboxConfiguration(
@@ -359,7 +359,7 @@ export class IdbWalletTransaction implements WalletDbTransaction {
});
}
async listAllOperationRetries(): Promise<WalletOperationRetry[]> {
- return await this.tx.operationRetries.iter().toArray();
+ return await this.tx.operationRetries.getAll();
}
async deleteOperationRetry(taskId: string): Promise<void> {
@@ -401,7 +401,7 @@ export class IdbWalletTransaction implements WalletDbTransaction {
}
async listGlobalCurrencyExchanges(): Promise<WalletGlobalCurrencyExchange[]> {
- return await this.tx.globalCurrencyExchanges.iter().toArray();
+ return await this.tx.globalCurrencyExchanges.getAll();
}
async addGlobalCurrencyExchange(
@@ -415,7 +415,7 @@ export class IdbWalletTransaction implements WalletDbTransaction {
}
async listGlobalCurrencyAuditors(): Promise<WalletGlobalCurrencyAuditor[]> {
- return await this.tx.globalCurrencyAuditors.iter().toArray();
+ return await this.tx.globalCurrencyAuditors.getAll();
}
async addGlobalCurrencyAuditor(
@@ -460,7 +460,7 @@ export class IdbWalletTransaction implements WalletDbTransaction {
async listAllDenomLossEvents(): Promise<WalletDenomLossEvent[]> {
const tx = this.tx;
- return await tx.denomLossEvents.iter().toArray();
+ return await tx.denomLossEvents.getAll();
}
async getFreshCoinsByDenomAndAge(
@@ -493,7 +493,7 @@ export class IdbWalletTransaction implements WalletDbTransaction {
}
async listBankAccounts(): Promise<WalletBankAccount[]> {
- return await this.tx.bankAccountsV2.iter().toArray();
+ return await this.tx.bankAccountsV2.getAll();
}
async getBankAccount(
@@ -530,7 +530,7 @@ export class IdbWalletTransaction implements WalletDbTransaction {
}
async listAllCoins(): Promise<WalletCoin[]> {
- return await this.tx.coins.iter().toArray();
+ return await this.tx.coins.getAll();
}
async getCoinsByExchange(exchangeBaseUrl: string): Promise<WalletCoin[]> {
@@ -591,44 +591,44 @@ export class IdbWalletTransaction implements WalletDbTransaction {
async listAllRefreshGroups(): Promise<WalletRefreshGroup[]> {
const tx = this.tx;
- return await tx.refreshGroups.iter().toArray();
+ return await tx.refreshGroups.getAll();
}
async listAllDepositGroups(): Promise<WalletDepositGroup[]> {
const tx = this.tx;
- return await tx.depositGroups.iter().toArray();
+ return await tx.depositGroups.getAll();
}
async listAllRefundGroups(): Promise<WalletRefundGroup[]> {
- return await this.tx.refundGroups.iter().toArray();
+ return await this.tx.refundGroups.getAll();
}
async listAllWithdrawalGroups(): Promise<WalletWithdrawalGroup[]> {
- return await this.tx.withdrawalGroups.iter().toArray();
+ return await this.tx.withdrawalGroups.getAll();
}
async listAllPurchases(): Promise<WalletPurchase[]> {
- return await this.tx.purchases.iter().toArray();
+ return await this.tx.purchases.getAll();
}
async listAllPeerPullCredits(): Promise<WalletPeerPullCredit[]> {
const tx = this.tx;
- return await tx.peerPullCredit.iter().toArray();
+ return await tx.peerPullCredit.getAll();
}
async listAllPeerPullDebits(): Promise<WalletPeerPullDebit[]> {
const tx = this.tx;
- return await tx.peerPullDebit.iter().toArray();
+ return await tx.peerPullDebit.getAll();
}
async listAllPeerPushCredits(): Promise<WalletPeerPushCredit[]> {
const tx = this.tx;
- return await tx.peerPushCredit.iter().toArray();
+ return await tx.peerPushCredit.getAll();
}
async listAllPeerPushDebits(): Promise<WalletPeerPushDebit[]> {
const tx = this.tx;
- return await tx.peerPushDebit.iter().toArray();
+ return await tx.peerPushDebit.getAll();
}
async getDenominationFamilyByParams(
@@ -678,9 +678,7 @@ export class IdbWalletTransaction implements WalletDbTransaction {
// "denominations by family" on its own, so this walks the index whose
// first component is the family serial.
const all =
- await tx.denominations.indexes.byDenominationFamilySerialAndStampExpireWithdraw
- .iter()
- .toArray();
+ await tx.denominations.indexes.byDenominationFamilySerialAndStampExpireWithdraw.getAll();
const doomed = all.filter(
(d) => d.denominationFamilySerial === denominationFamilySerial,
);
@@ -705,13 +703,13 @@ export class IdbWalletTransaction implements WalletDbTransaction {
}
async listAllExchangeBaseUrlFixups(): Promise<WalletExchangeBaseUrlFixup[]> {
- return await this.tx.exchangeBaseUrlFixups.iter().toArray();
+ return await this.tx.exchangeBaseUrlFixups.getAll();
}
async listAllExchangeMigrationLogEntries(): Promise<
WalletExchangeMigrationLog[]
> {
- return await this.tx.exchangeBaseUrlMigrationLog.iter().toArray();
+ return await this.tx.exchangeBaseUrlMigrationLog.getAll();
}
async getExchangeMigrationLog(
@@ -996,31 +994,31 @@ export class IdbWalletTransaction implements WalletDbTransaction {
}
async listAllSlates(): Promise<WalletSlate[]> {
- return await this.tx.slates.iter().toArray();
+ return await this.tx.slates.getAll();
}
async listAllRecoupGroups(): Promise<WalletRecoupGroup[]> {
- return await this.tx.recoupGroups.iter().toArray();
+ return await this.tx.recoupGroups.getAll();
}
async listAllDonationPlanchets(): Promise<WalletDonationPlanchet[]> {
- return await this.tx.donationPlanchets.iter().toArray();
+ return await this.tx.donationPlanchets.getAll();
}
async listAllDonationReceipts(): Promise<WalletDonationReceipt[]> {
- return await this.tx.donationReceipts.iter().toArray();
+ return await this.tx.donationReceipts.getAll();
}
async listAllDenominationFamilies(): Promise<WalletDenominationFamily[]> {
- return await this.tx.denominationFamilies.iter().toArray();
+ return await this.tx.denominationFamilies.getAll();
}
async listAllDenominations(): Promise<WalletDenomination[]> {
- return await this.tx.denominations.iter().toArray();
+ return await this.tx.denominations.getAll();
}
async listAllContractTerms(): Promise<WalletContractTerms[]> {
- return await this.tx.contractTerms.iter().toArray();
+ return await this.tx.contractTerms.getAll();
}
async upsertTombstone(rec: WalletTombstone): Promise<void> {
@@ -1029,7 +1027,7 @@ export class IdbWalletTransaction implements WalletDbTransaction {
}
async listAllTombstones(): Promise<WalletTombstone[]> {
- return await this.tx.tombstones.iter().toArray();
+ return await this.tx.tombstones.getAll();
}
async getDonationSummary(
@@ -1271,7 +1269,7 @@ export class IdbWalletTransaction implements WalletDbTransaction {
}
async listAllReserves(): Promise<WalletReserve[]> {
- return await this.tx.reserves.iter().toArray();
+ return await this.tx.reserves.getAll();
}
async upsertReserve(rec: WalletReserve): Promise<number> {
@@ -1727,15 +1725,15 @@ export class IdbWalletTransaction implements WalletDbTransaction {
}
async getDonationSummaries(): Promise<WalletDonationSummary[]> {
- return await this.tx.donationSummaries.iter().toArray();
+ return await this.tx.donationSummaries.getAll();
}
async getExchanges(): Promise<WalletExchangeEntry[]> {
- return await this.tx.exchanges.iter().toArray();
+ return await this.tx.exchanges.getAll();
}
async getCoinAvailabilities(): Promise<WalletCoinAvailability[]> {
- return await this.tx.coinAvailability.iter().toArray();
+ return await this.tx.coinAvailability.getAll();
}
async getActiveRefreshGroups(): Promise<WalletRefreshGroup[]> {