diff options
author | Florian Dold <florian@dold.me> | 2024-03-13 21:07:46 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-03-27 13:06:15 +0100 |
commit | 6b9b4ba7cc1576e7cc91e2b30e9d5e75edbe0037 (patch) | |
tree | da139f91fb7cf7402420bd50cacae8e369dcf28a /packages/taler-wallet-core/src/common.ts | |
parent | 237c4e8adae997e84f5fb7a8fe5c03b1148e99dc (diff) | |
download | wallet-core-6b9b4ba7cc1576e7cc91e2b30e9d5e75edbe0037.tar.gz wallet-core-6b9b4ba7cc1576e7cc91e2b30e9d5e75edbe0037.tar.bz2 wallet-core-6b9b4ba7cc1576e7cc91e2b30e9d5e75edbe0037.zip |
wallet-core: preparations for materialzed txnsdev/dold/materialized-transactions
Diffstat (limited to 'packages/taler-wallet-core/src/common.ts')
-rw-r--r-- | packages/taler-wallet-core/src/common.ts | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/packages/taler-wallet-core/src/common.ts b/packages/taler-wallet-core/src/common.ts index 5acdeeba4..eb06b8eb0 100644 --- a/packages/taler-wallet-core/src/common.ts +++ b/packages/taler-wallet-core/src/common.ts @@ -61,11 +61,7 @@ import { timestampPreciseToDb, } from "./db.js"; import { createRefreshGroup } from "./refresh.js"; -import { - InternalWalletState, - WalletExecutionContext, - getDenomInfo, -} from "./wallet.js"; +import { WalletExecutionContext, getDenomInfo } from "./wallet.js"; const logger = new Logger("operations/common.ts"); @@ -696,11 +692,32 @@ export namespace TaskIdentifiers { /** * Result of a transaction transition. */ -export enum TransitionResult { +export enum TransitionResultType { Transition = 1, Stay = 2, + Delete = 3, } +export type TransitionResult<R> = + | { type: TransitionResultType.Stay } + | { type: TransitionResultType.Transition; rec: R } + | { type: TransitionResultType.Delete }; + +export const TransitionResult = { + stay<T>(): TransitionResult<T> { + return { type: TransitionResultType.Stay }; + }, + delete<T>(): TransitionResult<T> { + return { type: TransitionResultType.Delete }; + }, + transition<T>(rec: T): TransitionResult<T> { + return { + type: TransitionResultType.Transition, + rec, + }; + }, +}; + /** * Transaction context. * Uniform interface to all transactions. |