diff options
author | Florian Dold <florian@dold.me> | 2022-01-11 21:00:12 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-01-11 22:15:56 +0100 |
commit | a74cdf05295764258fe9e7f66f73a442a9b46697 (patch) | |
tree | d1a662fede130abc1fa33cdbc96c081cc47b23cd /packages/taler-wallet-core/src/db.ts | |
parent | a05e891d6e1468fdd99f710301e286857a46aea3 (diff) | |
download | wallet-core-a74cdf05295764258fe9e7f66f73a442a9b46697.tar.xz |
fix DB indexing issues
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index 07e0f4b0a..772061fb9 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -42,6 +42,7 @@ import { import { RetryInfo } from "./util/retries.js"; import { PayCoinSelection } from "./util/coinSelection.js"; import { Event, IDBDatabase } from "@gnu-taler/idb-bridge"; +import { PendingTaskInfo } from "./pending-types.js"; /** * Name of the Taler database. This is effectively the major @@ -153,6 +154,8 @@ export interface ReserveRecord { */ timestampCreated: Timestamp; + operationStatus: OperationStatus; + /** * Time when the information about this reserve was posted to the bank. * @@ -914,10 +917,19 @@ export enum RefreshCoinStatus { Frozen = "frozen", } +export enum OperationStatus { + Finished = "finished", + Pending = "pending", +} + export interface RefreshGroupRecord { + operationStatus: OperationStatus; + /** * Retry info, even present when the operation isn't active to allow indexing * on the next retry timestamp. + * + * FIXME: No, this can be optional, indexing is still possible */ retryInfo: RetryInfo; @@ -1350,6 +1362,8 @@ export interface WithdrawalGroupRecord { */ timestampFinish?: Timestamp; + operationStatus: OperationStatus; + /** * Amount including fees (i.e. the amount subtracted from the * reserve to withdraw all coins in this withdrawal session). @@ -1561,6 +1575,8 @@ export interface DepositGroupRecord { timestampFinished: Timestamp | undefined; + operationStatus: OperationStatus; + lastError: TalerErrorDetails | undefined; /** @@ -1601,6 +1617,18 @@ export interface TombstoneRecord { id: string; } +export interface BalancePerCurrencyRecord { + currency: string; + + availableNow: AmountString; + + availableExpected: AmountString; + + pendingIncoming: AmountString; + + pendingOutgoing: AmountString; +} + export const WalletStoresV1 = { coins: describeStore( describeContents<CoinRecord>("coins", { @@ -1671,7 +1699,9 @@ export const WalletStoresV1 = { describeContents<RefreshGroupRecord>("refreshGroups", { keyPath: "refreshGroupId", }), - {}, + { + byStatus: describeIndex("byStatus", "operationStatus"), + }, ), recoupGroups: describeStore( describeContents<RecoupGroupRecord>("recoupGroups", { @@ -1686,6 +1716,7 @@ export const WalletStoresV1 = { "byInitialWithdrawalGroupId", "initialWithdrawalGroupId", ), + byStatus: describeIndex("byStatus", "operationStatus"), }, ), purchases: describeStore( @@ -1716,6 +1747,7 @@ export const WalletStoresV1 = { }), { byReservePub: describeIndex("byReservePub", "reservePub"), + byStatus: describeIndex("byStatus", "operationStatus"), }, ), planchets: describeStore( @@ -1753,7 +1785,9 @@ export const WalletStoresV1 = { describeContents<DepositGroupRecord>("depositGroups", { keyPath: "depositGroupId", }), - {}, + { + byStatus: describeIndex("byStatus", "operationStatus"), + }, ), tombstones: describeStore( describeContents<TombstoneRecord>("tombstones", { keyPath: "id" }), @@ -1765,6 +1799,12 @@ export const WalletStoresV1 = { }), {}, ), + balancesPerCurrency: describeStore( + describeContents<BalancePerCurrencyRecord>("balancesPerCurrency", { + keyPath: "currency", + }), + {}, + ), }; export interface MetaConfigRecord { |