Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type Key = NibbleString
- type Val = RLPObject
- data MPDB = MPDB {}
- newtype StateRoot = StateRoot ByteString
- data NodeData
- = EmptyNodeData
- | FullNodeData { }
- | ShortcutNodeData { }
- openMPDB :: String -> ResourceT IO MPDB
- emptyTriePtr :: StateRoot
- sha2StateRoot :: Digest Keccak_256 -> StateRoot
- unboxStateRoot :: StateRoot -> ByteString
- unsafePutKeyVal :: MonadResource m => MPDB -> Key -> Val -> m MPDB
- unsafeGetKeyVals :: MonadResource m => MPDB -> Key -> m [(Key, Val)]
- unsafeGetAllKeyVals :: MonadResource m => MPDB -> m [(Key, Val)]
- unsafeDeleteKey :: MonadResource m => MPDB -> Key -> m MPDB
- getNodeData :: MonadResource m => MPDB -> NodeRef -> m NodeData
- putNodeData :: MonadResource m => MPDB -> NodeData -> m StateRoot
- keyToSafeKey :: NibbleString -> NibbleString
- getCommonPrefix :: Eq a => [a] -> [a] -> ([a], [a], [a])
- replace :: Integral i => [a] -> i -> a -> [a]
- prependToKey :: Key -> (Key, Val) -> (Key, Val)
Documentation
type Key = NibbleString Source #
The type of the database key
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.
(Monad m, MonadBaseControl IO m, MonadThrow m, MonadIO m) => PointedKeyValDB (KeyValMPLevelDB m) Key Val MPDB String 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.
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.
unboxStateRoot :: StateRoot -> ByteString Source #
unsafePutKeyVal :: MonadResource m => MPDB -> Key -> Val -> m MPDB Source #
unsafeGetKeyVals :: MonadResource m => MPDB -> Key -> m [(Key, Val)] Source #
unsafeGetAllKeyVals :: MonadResource m => MPDB -> m [(Key, Val)] Source #
unsafeDeleteKey :: MonadResource m => MPDB -> Key -> m MPDB Source #
getNodeData :: MonadResource m => MPDB -> NodeRef -> m NodeData Source #
putNodeData :: MonadResource m => MPDB -> NodeData -> m StateRoot Source #
getCommonPrefix :: Eq a => [a] -> [a] -> ([a], [a], [a]) Source #