taler-docs

Documentation for GNU Taler components, APIs and protocols
Log | Files | Refs | README | LICENSE

migrate-database.rst (1758B)


      1 .. ts:op:: migrateDatabase
      2 
      3   Explicitly migrate an IndexedDB-emulation wallet to the native
      4   SQLite schema.  The operation is idempotent when the wallet is
      5   already native.
      6 
      7   **Request:**
      8 
      9     The request arguments must be a `MigrateDatabaseRequest` object.
     10 
     11   **Response:**
     12 
     13     On success, the result is a `MigrateDatabaseResponse` object.
     14 
     15   **Side effects:**
     16 
     17     Converts the wallet database to the native SQLite schema.  The
     18     migration can be long-running; progress is reported via
     19     notifications when ``progressToken`` is set.
     20 
     21   **Expected errors:**
     22 
     23     The caller can handle the following errors inline:
     24     ``WALLET_DB_BACKEND_UNSUPPORTED``, ``WALLET_DB_UNAVAILABLE``,
     25     ``WALLET_CORE_REQUEST_CANCELLED``.
     26 
     27   **Details:**
     28 
     29     When the wallet already uses the native SQLite schema, the request
     30     succeeds with ``migrated`` set to false.  The optional
     31     ``progressToken`` correlates progress notifications and allows
     32     cancellation via :ts:op:`cancelProgressToken`.  If the migration
     33     itself fails, the request fails with ``WALLET_DB_UNAVAILABLE`` and
     34     the existing (IndexedDB) database remains active; a cancelled
     35     migration fails with ``WALLET_CORE_REQUEST_CANCELLED``.
     36 
     37 .. ts:def:: MigrateDatabaseRequest
     38 
     39   interface MigrateDatabaseRequest {
     40     // Enables progress correlation and cancellation through
     41     // cancelProgressToken.
     42     progressToken?: string;
     43   }
     44 
     45 .. ts:def:: MigrateDatabaseResponse
     46 
     47   interface MigrateDatabaseResponse {
     48     // Whether this request changed the active database backend.
     49     migrated: boolean;
     50 
     51     // Database backend active after the request.
     52     databaseBackend: WalletDatabaseBackend;
     53   }
     54 
     55 .. ts:def:: WalletDatabaseBackend
     56 
     57   type WalletDatabaseBackend = "indexeddb" | "sqlite";