HGraphStorage-0.0.3: Graph database stored on disk

Safe HaskellNone
LanguageHaskell98

Database.Graph.HGraphStorage.Index

Description

Synopsis

Documentation

data Trie k v Source

Trie on disk

Constructors

Trie 

Fields

trHandle :: Handle

The disk Handle

trRecordLength :: Int64

The length of a record

newTrie :: forall k v. (Binary k, Binary v, Default k, Default v) => Handle -> Trie k v Source

Create a new trie with a given handle The limitations are: Key and Value must have a binary representation of constant length!

newFileTrie :: forall k v. (Binary k, Binary v, Default k, Default v) => FilePath -> IO (Trie k v) Source

Build a file backed trie

insertNew :: (Binary k, Eq k, Default k, Binary v, Eq v, Default v) => [k] -> v -> Trie k v -> IO (Maybe v) Source

Insert a value if it does not exist in the tree if it exists, return the old value and does nothing

insert :: (Binary k, Eq k, Default k, Binary v, Eq v, Default v) => [k] -> v -> Trie k v -> IO (Maybe v) Source

Insert a value for a key if the value existed for that key, return the old value

lookup :: (Binary k, Eq k, Binary v, Eq v, Default v) => [k] -> Trie k v -> IO (Maybe v) Source

Lookup a value from a key

prefix :: (Binary k, Eq k, Binary v, Eq v, Default v) => [k] -> Trie k v -> IO [([k], v)] Source

Return all key and values for the given prefix which may be null (in which case all mappings are returned).

delete :: forall k v. (Binary k, Eq k, Binary v, Eq v, Default v) => [k] -> Trie k v -> IO (Maybe v) Source

Delete the value associated with a key This only remove the value from the trienode, it doesn't prune the trie in any way.