Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Re-generate docs
Browse files Browse the repository at this point in the history
Signed-off-by: Sina Mahmoodi <itz.s1na@gmail.com>
  • Loading branch information
s1na committed Jan 15, 2019
1 parent 86165f4 commit 5f89177
Showing 1 changed file with 103 additions and 20 deletions.
123 changes: 103 additions & 20 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

## SecureTrie

[src/secure.js:10-15][1]
[src/secure.js:12-43][1]

**Extends Trie**

You can create a secure Trie where the keys are automatically hashed using **SHA3** by using `require('merkle-patricia-tree/secure')`. It has the same methods and constructor as `Trie`.
You can create a secure Trie where the keys are automatically hashed
using **keccak256** by using `require('merkle-patricia-tree/secure')`.
It has the same methods and constructor as `Trie`.

## Trie

Expand Down Expand Up @@ -232,9 +234,76 @@ Compare two 'nibble array' keys
- `keyA`
- `keyB`

[1]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/secure.js#L10-L15 "Source code on GitHub"
## isCheckpoint

[2]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/baseTrie.js#L25-L781 "Source code on GitHub"
[src/checkpoint-trie.js:27-29][30]

Is the trie during a checkpoint phase?

## put

[src/secure.js:30-37][31]

For a falsey value, use the original key
to avoid double hashing the key.

### Parameters

- `key`
- `val`
- `cb`

## checkpoint

[src/checkpoint-trie.js:38-46][32]

Creates a checkpoint that can later be reverted to or committed.
After this is called, no changes to the trie will be permanently saved
until `commit` is called. Calling `putRaw` overrides the checkpointing
mechanism and would directly write to db.

## commit

[src/checkpoint-trie.js:55-70][33]

Commits a checkpoint to disk, if current checkpoint is not nested. If
nested, only sets the parent checkpoint as current checkpoint.

### Parameters

- `cb` **[Function][10]** the callback


- Throws **any** If not during a checkpoint phase

## revert

[src/checkpoint-trie.js:78-92][34]

Reverts the trie to the state it was at when `checkpoint` was first called.
If during a nested checkpoint, only sets parent as current checkpoint.

### Parameters

- `cb` **[Function][10]** the callback

## copy

[src/checkpoint-trie.js:99-104][35]

Returns a copy of the underlying trie with the interface
of CheckpointTrie.

## createScratchReadStream

[src/checkpoint-trie.js:111-118][36]

Returns a `ScratchReadStream` based on the state updates
since checkpoint.

[1]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/secure.js#L12-L43 "Source code on GitHub"

[2]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/baseTrie.js#L25-L781 "Source code on GitHub"

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

Expand All @@ -248,44 +317,58 @@ Compare two 'nibble array' keys

[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

[9]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/baseTrie.js#L65-L77 "Source code on GitHub"
[9]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/baseTrie.js#L65-L77 "Source code on GitHub"

[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function

[11]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/baseTrie.js#L87-L111 "Source code on GitHub"
[11]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/baseTrie.js#L87-L111 "Source code on GitHub"

[12]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/baseTrie.js#L120-L136 "Source code on GitHub"
[12]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/baseTrie.js#L120-L136 "Source code on GitHub"

[13]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/baseTrie.js#L145-L162 "Source code on GitHub"
[13]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/baseTrie.js#L145-L162 "Source code on GitHub"

[14]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/baseTrie.js#L192-L201 "Source code on GitHub"
[14]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/baseTrie.js#L192-L201 "Source code on GitHub"

[15]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/baseTrie.js#L210-L218 "Source code on GitHub"
[15]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/baseTrie.js#L210-L218 "Source code on GitHub"

[16]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/baseTrie.js#L252-L298 "Source code on GitHub"
[16]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/baseTrie.js#L252-L298 "Source code on GitHub"

[17]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/baseTrie.js#L730-L732 "Source code on GitHub"
[17]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/baseTrie.js#L730-L732 "Source code on GitHub"

[18]: https://nodejs.org/api/stream.html#stream_class_stream_readable

[19]: https://nodejs.org/dist/latest-v5.x/docs/api/stream.html#stream_class_stream_readable

[20]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/baseTrie.js#L756-L766 "Source code on GitHub"
[20]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/baseTrie.js#L756-L766 "Source code on GitHub"

[21]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[22]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/baseTrie.js#L775-L780 "Source code on GitHub"
[22]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/baseTrie.js#L775-L780 "Source code on GitHub"

[23]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/proof.js#L12-L29 "Source code on GitHub"
[23]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/proof.js#L12-L29 "Source code on GitHub"

[24]: #trie

[25]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/proof.js#L39-L100 "Source code on GitHub"
[25]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/proof.js#L39-L100 "Source code on GitHub"

[26]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/trieNode.js#L164-L179 "Source code on GitHub"

[27]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/util.js#L63-L79 "Source code on GitHub"

[28]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/util.js#L37-L57 "Source code on GitHub"

[29]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/util.js#L28-L31 "Source code on GitHub"

[30]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/checkpoint-trie.js#L27-L29 "Source code on GitHub"

[31]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/secure.js#L30-L37 "Source code on GitHub"

[32]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/checkpoint-trie.js#L38-L46 "Source code on GitHub"

[26]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/trieNode.js#L164-L179 "Source code on GitHub"
[33]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/checkpoint-trie.js#L55-L70 "Source code on GitHub"

[27]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/util.js#L63-L79 "Source code on GitHub"
[34]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/checkpoint-trie.js#L78-L92 "Source code on GitHub"

[28]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/util.js#L37-L57 "Source code on GitHub"
[35]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/checkpoint-trie.js#L99-L104 "Source code on GitHub"

[29]: https://github.com/alextsg/merkle-patricia-tree/blob/c2da4c34d8001120dfc08aa45e2a9894a7927aab/src/util.js#L28-L31 "Source code on GitHub"
[36]: https://git@github.com/:ethereumjs/merkle-patricia-tree/blob/86165f43d9d82c6116ade10f76a554ed147c309e/src/checkpoint-trie.js#L111-L118 "Source code on GitHub"

0 comments on commit 5f89177

Please sign in to comment.