CRDT-style tombstones

This commit is contained in:
Florian Dold 2020-12-07 23:32:20 +01:00
parent 6f474a3b9d
commit 0e33e540f3
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -21,8 +21,7 @@
* as the backup schema must remain very stable and should be self-contained. * as the backup schema must remain very stable and should be self-contained.
* *
* Current limitations: * Current limitations:
* 1. Deletion tomb stones aren't supported yet * 1. Exchange/auditor trust isn't exported yet
* 2. Exchange/auditor trust isn't exported yet
* (see https://bugs.gnunet.org/view.php?id=6448) * (see https://bugs.gnunet.org/view.php?id=6448)
* *
* General considerations / decisions: * General considerations / decisions:
@ -69,12 +68,6 @@ export interface WalletBackupContentV1 {
*/ */
schema_version: 1; schema_version: 1;
/**
* Monotonically increasing clock of the wallet,
* used to determine causality when merging backups.
*/
clock: number;
/** /**
* Root public key of the wallet. This field is present as * Root public key of the wallet. This field is present as
* a sanity check if the backup content JSON is loaded from file. * a sanity check if the backup content JSON is loaded from file.
@ -89,6 +82,16 @@ export interface WalletBackupContentV1 {
*/ */
current_device_id: string; current_device_id: string;
/**
* Monotonically increasing clock of the wallet,
* used to determine causality when merging backups.
*
* Information about other clocks, used to delete
* tombstones in the hopefully rare case that multiple wallets
* are connected to the same sync server.
*/
clocks: { [device_id: string]: number };
/** /**
* Per-exchange data sorted by exchange master public key. * Per-exchange data sorted by exchange master public key.
* *
@ -137,6 +140,21 @@ export interface WalletBackupContentV1 {
* Recoup groups. * Recoup groups.
*/ */
recoup_groups: BackupRecoupGroup[]; recoup_groups: BackupRecoupGroup[];
/**
* Tombstones for deleting purchases.
*/
purchase_tombstones: {
/**
* Clock when the purchase was deleted
*/
clock_deleted: number;
/**
* Proposal ID identifying the purchase.
*/
proposal_id: string;
}[];
} }
/** /**
@ -645,6 +663,11 @@ export interface BackupPurchase {
*/ */
proposal_id: string; proposal_id: string;
/**
* Clock when this purchase was created.
*/
clock_created: number;
/** /**
* Contract terms we got from the merchant. * Contract terms we got from the merchant.
*/ */