Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify DBLayer QSM model and DB.MVar #641

Closed
4 tasks done
rvl opened this issue Aug 21, 2019 · 1 comment
Closed
4 tasks done

Unify DBLayer QSM model and DB.MVar #641

rvl opened this issue Aug 21, 2019 · 1 comment
Assignees

Comments

@rvl
Copy link
Contributor

rvl commented Aug 21, 2019

Context

To reduce maintenance burden we could either delete the MVar DBLayer, or have it share pure model code with the state-machine tests. Since the MVar DB is a useful diagnostic tool, let's keep it for now. Also its model datatype works better than the one in StateMachine.hs.

Decision

Create a module Cardano.Wallet.DB.Model and move the data types from MVar to there, and modify them for rollback.

type Database wid s t k =  Map wid (WalletDatabase s t k)
type TxHistory t = Map (Hash "Tx") (Tx t, TxMeta)
data WalletDatabase s t xprv = WalletDatabase
    { metadata :: !WalletMetadata
    , xprv :: !(Maybe xprv)
    , txHistory :: !(TxHistory t)
    , checkpoints :: ![Wallet s t]
    }

Acceptance Criteria

  1. MVar DBLayer and DBLayer QSM tests share a model and its functions.
  2. Model functions are pure and don't use MVars, IO, etc.
  3. The model supports checkpoints, but only a single checkpoint is used.

Development Plan

  • Check that key type can be a parameter of db model.
  • Set up module for DB model.
  • Change StateMachine.hs to use it.
  • Change MVar DB to use it

PR

Number Base
#660 master

QA

This is a refactor so the existing tests will cover it.

@rvl rvl added this to the Support Roll-backs milestone Aug 21, 2019
@rvl rvl self-assigned this Aug 26, 2019
@piotr-iohk
Copy link
Contributor

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants