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

Public interface #1

Open
sz-piotr opened this issue Apr 17, 2020 · 1 comment
Open

Public interface #1

sz-piotr opened this issue Apr 17, 2020 · 1 comment

Comments

@sz-piotr
Copy link

sz-piotr commented Apr 17, 2020

setRoot -> set root - 'done'
db.get -> getRaw - 'done'
db.put -> putRaw - 'done'

class BaseTrie {
  EMPTY_TRIE_ROOT - 'ok'
  db - 'unused'
  get root() - 'done'
  set root() - 'done, though may throw for incorrectly assigned value'
  get (key, cb) - 'done'
  put (key, value, cb) - 'done'
  del (key, cb) - 'done'
  getRaw (key, cb) - 'done'
  _lookupNode (node, cb) - 'unused'
  putRaw = _putRaw - 'done'
  _putRaw (key, val, cb) - 'unused'
  delRaw (key, cb) - 'unused'
  _putNode (node, cb) - 'unused'
  _batchNodes (opStack, cb) - 'unused'
  findPath (targetKey, cb) - 'unused'
  _findNode (key, root, stack, cb) - 'unused'
  _findValueNodes (onFound, cb) - 'unused'
  _findDbNodes (onFound, cb) - 'unused'
  _updateNode (key, value, keyRemainder, stack, cb) - 'unused'
  _walkTrie (root, onNode, onDone) - 'unused'
  _saveStack (key, stack, opStack, cb) - 'unused'
  _deleteNode (key, stack, cb) - 'unused'
  _createInitialNode (key, value, cb) - 'unused'
  _formatNode (node, topLevel, remove, opStack) - 'unused'
  createReadStream () - 'done, though look at it in case of problems'
  copy () - 'done'
  batch (ops, cb) - 'unused'
  checkRoot (root, cb) - 'done'
}

class CheckpointTrie extends BaseTrie {
  static prove (trie, key, cb) - 'unused'
  static verifyProof (rootHash, key, proof, cb) - 'unused'

  _scratch = null - 'unused'
  _checkpoints = [] - 'done'
  get isCheckpoint() - 'unused'
  checkpoint () - 'done'
  commit (cb) - 'done'
  revert (cb) - 'done, callback not even called in usage...'
  _enterCpMode() - 'unused'
  _exitCpMode (commitState, cb) - 'unused'
  createScratchReadStream (scratch) - 'unused'
}

class SecureTrie extends CheckpointTrie {}
@msieczko
Copy link
Member

State after commit 8b66691

setRoot -> set root - 'done'
db.get -> getRaw - 'done'
db.put -> putRaw - 'done'

class BaseTrie {
  EMPTY_TRIE_ROOT - 'ok'
  db - 'unused'
  get root() - 'done'
  set root() - 'done, though may throw for incorrectly assigned value'
  get (key, cb) - 'done'
  put (key, value, cb) - 'done'
  del (key, cb) - 'done'
  getRaw (key, cb) - 'done'
  _lookupNode (node, cb) - 'unused'
  putRaw = _putRaw - 'done'
  _putRaw (key, val, cb) - 'unused'
  delRaw (key, cb) - 'done'
  _putNode (node, cb) - 'unused'
  _batchNodes (opStack, cb) - 'unused'
  findPath (targetKey, cb) - 'unused'
  _findNode (key, root, stack, cb) - 'unused'
  _findValueNodes (onFound, cb) - 'unused'
  _findDbNodes (onFound, cb) - 'unused'
  _updateNode (key, value, keyRemainder, stack, cb) - 'unused'
  _walkTrie (root, onNode, onDone) - 'unused'
  _saveStack (key, stack, opStack, cb) - 'unused'
  _deleteNode (key, stack, cb) - 'unused'
  _createInitialNode (key, value, cb) - 'unused'
  _formatNode (node, topLevel, remove, opStack) - 'unused'
  createReadStream () - 'done'
  copy () - 'done'
  batch (ops, cb) - 'done'
  checkRoot (root, cb) - 'done'
}

class CheckpointTrie extends BaseTrie {
  static prove (trie, key, cb) - 'done'
  static verifyProof (rootHash, key, proof, cb) - 'done'

  _scratch = null - 'unused'
  _checkpoints = [] - 'done'
  get isCheckpoint() - 'unused'
  checkpoint () - 'done'
  commit (cb) - 'done'
  revert (cb) - 'done, callback not even called in usage...'
  _enterCpMode() - 'unused'
  _exitCpMode (commitState, cb) - 'unused'
  createScratchReadStream (scratch) - 'done'
}

class SecureTrie extends CheckpointTrie {}

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