merkle-patricia-db-0.1.0: A modified Merkle Patricia DB

Safe HaskellNone
LanguageHaskell2010

Blockchain.Database.MerklePatricia.Internal

Synopsis

Documentation

type Key = NibbleString Source #

The type of the database key

type Val = RLPObject Source #

The type of the values in the database

data MPDB Source #

This is the database reference type, contianing both the handle to the underlying database, as well as the stateRoot to the current tree holding the data.

The MPDB acts a bit like a traditional database handle, although because it contains the stateRoot, many functions act by updating its value. Because of this, it is recommended that this item be stored and modified within the state monad.

Constructors

MPDB 

Fields

newtype StateRoot Source #

Internal nodes are indexed in the underlying database by their 256-bit SHA3 hash. This types represents said hash.

The stateRoot is of this type, (ie- the pointer to the full set of key/value pairs at a particular time in history), and will be of interest if you need to refer to older or parallel version of the data.

Constructors

StateRoot ByteString 

openMPDB Source #

Arguments

:: String

The filepath with the location of the underlying database.

-> ResourceT IO MPDB 

This function is used to create an MPDB object corresponding to the blank database. After creation, the stateRoot can be changed to a previously saved version.

emptyTriePtr :: StateRoot Source #

The stateRoot of the empty database.

getCommonPrefix :: Eq a => [a] -> [a] -> ([a], [a], [a]) Source #

replace :: Integral i => [a] -> i -> a -> [a] Source #