sync-mht-0.3.6.0: Fast incremental file transfer using Merkle-Hash-Trees

Safe HaskellNone
LanguageHaskell2010

Sync.MerkleTree.Trie

Synopsis

Documentation

data Hash Source

Constructors

Hash 

Fields

unHash :: ByteString
 

data Trie a Source

Constructors

Trie 

Fields

t_hash :: !Hash
 
t_node :: !(TrieNode a)
 

Instances

Eq a => Eq (Trie a) 
Show a => Show (Trie a) 

data TrieNode a Source

Constructors

Node !(Array Int (Trie a)) 
Leave !(Set a) 

Instances

Eq a => Eq (TrieNode a) 
Show a => Show (TrieNode a) 

data TrieLocation Source

Constructors

TrieLocation 

Fields

tl_level :: Int

Must be nonnegative

tl_index :: Int

Must be between nonnegative and smaller than (degree^tl_level)

class HasDigest a where Source

Methods

digest :: a -> Digest SHA256 Source

data Fingerprint Source

Fingerprint of a Merkle-Hash-Tree node We asssume the Tree below a node is identical while synchronizing if its FingerPrint is

Constructors

Fingerprint 

mkTrie :: (Ord a, HasDigest a) => Int -> [a] -> Trie a Source

Creates a Merkle-Hash-Tree for a list of elements

groupOf :: HasDigest a => Int -> a -> Int Source

The function groupOf x eeturns a value between 0 to degree-1 for a digest with the property that groupOf forms an approximate unviversal hash familiy.

mkLeave :: (HasDigest a, Ord a) => [a] -> Trie a Source

lookup :: Monad m => Trie a -> TrieLocation -> m (Trie a) Source

querySet :: (Ord a, Monad m) => Trie a -> TrieLocation -> m (Set a) Source

getAll :: Ord a => Trie a -> Set a Source