diskhash-0.0.1.2: Disk-based hash table

Safe HaskellNone
LanguageHaskell2010

Data.DiskHash

Synopsis

Documentation

htOpenRO :: forall a. Storable a => FilePath -> Int -> IO (DiskHashRO a) Source #

open a hash table in read-only mode

htOpenRW :: forall a. Storable a => FilePath -> Int -> IO (DiskHashRW a) Source #

open a hash table in read-write mode

withDiskHashRW :: Storable a => FilePath -> Int -> (DiskHashRW a -> IO b) -> IO b Source #

Open a hash table in read-write mode and pass it to an action

Once the action is is complete, the hashtable is closed (and sync'ed to disk).

htLookupRO :: Storable a => ByteString -> DiskHashRO a -> Maybe a Source #

Lookup by key

htLookupRW :: Storable a => ByteString -> DiskHashRW a -> IO (Maybe a) Source #

Lookup by key

htSizeRW :: DiskHashRW a -> IO Int Source #

Retrieve the size of the hash table

htSizeRO :: DiskHashRO a -> Int Source #

Retrieve the size of the hash table

htInsert Source #

Arguments

:: Storable a 
=> ByteString

key

-> a

value

-> DiskHashRW a

hash table

-> IO Bool

True if inserted, False if not

insert an element into the hash table

Returns whether an insertion took place (if an object with that key already exists, no insertion is made).

htModify :: Storable a => ByteString -> (a -> a) -> DiskHashRW a -> IO Bool Source #

Modify a value

htReserve :: Storable a => Int -> DiskHashRW a -> IO Int Source #

Reserve space in the hash table

If the operation fails, an exception is raised