[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: wallet-core: operation status
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: wallet-core: operation status for recoup |
Date: |
Tue, 13 Feb 2024 11:46:33 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 3a62b8522 wallet-core: operation status for recoup
3a62b8522 is described below
commit 3a62b8522e6b7cb587bbb0c3ce606527e918e06d
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Feb 13 11:46:34 2024 +0100
wallet-core: operation status for recoup
---
packages/taler-wallet-core/src/db.ts | 18 ++++++++++++++++--
packages/taler-wallet-core/src/operations/recoup.ts | 11 +++++++----
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/packages/taler-wallet-core/src/db.ts
b/packages/taler-wallet-core/src/db.ts
index 705df48b1..3b53bbf35 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -151,7 +151,7 @@ export const CURRENT_DB_CONFIG_KEY = "currentMainDbName";
* backwards-compatible way or object stores and indices
* are added.
*/
-export const WALLET_DB_MINOR_VERSION = 5;
+export const WALLET_DB_MINOR_VERSION = 6;
declare const symDbProtocolTimestamp: unique symbol;
@@ -1561,6 +1561,14 @@ export interface BankWithdrawUriRecord {
reservePub: string;
}
+export enum RecoupOperationStatus {
+ Pending = 0x0100_0000,
+ Suspended = 0x0110_0000,
+
+ Finished = 0x0500_000,
+ Failed = 0x0501_000,
+}
+
/**
* Status of recoup operations that were grouped together.
*
@@ -1575,6 +1583,8 @@ export interface RecoupGroupRecord {
exchangeBaseUrl: string;
+ operationStatus: RecoupOperationStatus;
+
timestampStarted: DbPreciseTimestamp;
timestampFinished: DbPreciseTimestamp | undefined;
@@ -2471,7 +2481,11 @@ export const WalletStoresV1 = {
describeContents<RecoupGroupRecord>({
keyPath: "recoupGroupId",
}),
- {},
+ {
+ byStatus: describeIndex("byStatus", "operationStatus", {
+ versionAdded: 6,
+ }),
+ },
),
purchases: describeStore(
"purchases",
diff --git a/packages/taler-wallet-core/src/operations/recoup.ts
b/packages/taler-wallet-core/src/operations/recoup.ts
index a6270783e..2dd88b614 100644
--- a/packages/taler-wallet-core/src/operations/recoup.ts
+++ b/packages/taler-wallet-core/src/operations/recoup.ts
@@ -43,6 +43,7 @@ import {
CoinRecord,
CoinSourceType,
RecoupGroupRecord,
+ RecoupOperationStatus,
RefreshCoinSource,
WalletStoresV1,
WithdrawCoinSource,
@@ -51,6 +52,7 @@ import {
timestampPreciseToDb,
} from "../db.js";
import { InternalWalletState } from "../internal-wallet-state.js";
+import { PendingTaskType } from "../pending-types.js";
import { checkDbInvariant } from "../util/invariants.js";
import { GetReadWriteAccess } from "../util/query.js";
import {
@@ -59,9 +61,8 @@ import {
constructTaskIdentifier,
} from "./common.js";
import { createRefreshGroup } from "./refresh.js";
-import { internalCreateWithdrawalGroup } from "./withdraw.js";
import { constructTransactionIdentifier } from "./transactions.js";
-import { PendingTaskType } from "../pending-types.js";
+import { internalCreateWithdrawalGroup } from "./withdraw.js";
const logger = new Logger("operations/recoup.ts");
@@ -316,7 +317,7 @@ export async function processRecoupGroup(
}
const ps = recoupGroup.coinPubs.map(async (x, i) => {
try {
- await processRecoup(ws, recoupGroupId, i);
+ await processRecoupForCoin(ws, recoupGroupId, i);
} catch (e) {
logger.warn(`processRecoup failed: ${e}`);
throw e;
@@ -406,6 +407,7 @@ export async function processRecoupGroup(
return;
}
rg2.timestampFinished =
timestampPreciseToDb(TalerPreciseTimestamp.now());
+ rg2.operationStatus = RecoupOperationStatus.Finished;
if (rg2.scheduleRefreshCoins.length > 0) {
await createRefreshGroup(
ws,
@@ -479,6 +481,7 @@ export async function createRecoupGroup(
timestampStarted: timestampPreciseToDb(TalerPreciseTimestamp.now()),
recoupFinishedPerCoin: coinPubs.map(() => false),
scheduleRefreshCoins: [],
+ operationStatus: RecoupOperationStatus.Pending,
};
for (let coinIdx = 0; coinIdx < coinPubs.length; coinIdx++) {
@@ -499,7 +502,7 @@ export async function createRecoupGroup(
/**
* Run the recoup protocol for a single coin in a recoup group.
*/
-async function processRecoup(
+async function processRecoupForCoin(
ws: InternalWalletState,
recoupGroupId: string,
coinIdx: number,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: wallet-core: operation status for recoup,
gnunet <=