HGraphStorage-0.0.3: Graph database stored on disk

Safe HaskellNone
LanguageHaskell98

Database.Graph.HGraphStorage.FileOps

Description

Operations on the data files

Synopsis

Documentation

open :: FilePath -> GraphSettings -> IO Handles Source

Open all the file handles.

setBufferMode :: Handle -> Maybe BufferMode -> IO () Source

Set the buffer mode on the given handle, if provided.

close :: Handles -> IO () Source

Close all the file handles

readModel :: GraphUsableMonad m => Handles -> m Model Source

Read the current model from the handles generate a default model if none present (new db)

writeGeneric :: GraphUsableMonad m => (Integral a, Binary a, Default a, Binary b) => Handle -> Maybe (FreeList a) -> Int64 -> Maybe a -> b -> m a Source

Generic write operation: write the given binary using the given ID and record size if no id, we write at then end otherwise we always ensure that we write at the proper offset, which is why we have fixed length records

readGeneric :: GraphUsableMonad m => (Integral a, Binary b) => Handle -> Int64 -> a -> m b Source

Read a binary with a given ID from the given handle

readAll :: (GraphUsableMonad m, GraphIdSerializable a b) => Handles -> m [(a, b)] Source

Read all binary objects from a given handle, generating their IDs from their offset

foldAllGeneric :: GraphUsableMonad m => (Integral a, Eq b, Binary b, Default b) => Handle -> Int64 -> (c -> (a, b) -> m c) -> c -> m c Source

Read all binary objects from a given handle, generating their IDs from their offset

readProperties :: GraphUsableMonad m => Handles -> Model -> PropertyTypeID -> PropertyID -> m [(Property, PropertyValue)] Source

Read all properties, starting from a given one, with an optional filter on the Property Type

writeProperty :: GraphUsableMonad m => Handles -> PropertyTypeID -> PropertyID -> PropertyValue -> m PropertyID Source

Write a property, knowing the next one in the chain

throwIfNothing :: (MonadBase IO m, Exception e) => e -> Maybe a -> m a Source

Helper method throwing an exception if we got a Maybe, otherwise return the Just value

readPropertyValue :: GraphUsableMonad m => Handles -> DataType -> PropertyValueOffset -> PropertyValueLength -> m PropertyValue Source

Read a property value given an offset and length

class (Integral a, Binary b) => GraphIdSerializable a b where Source

A class that defines basic read and write operations for a given ID and binary object

Methods

write :: GraphUsableMonad m => Handles -> Maybe a -> b -> m a Source

readOne :: GraphUsableMonad m => Handles -> a -> m b Source

foldAll :: GraphUsableMonad m => Handles -> (c -> (a, b) -> m c) -> c -> m c Source

Instances

GraphIdSerializable PropertyTypeID PropertyType

Serialization methods for PropertyTypeID + PropertyType

GraphIdSerializable PropertyID Property

Serialization methods for PropertyID + Property

GraphIdSerializable RelationTypeID RelationType

Serialization methods for RelationTypeID + RelationType

GraphIdSerializable RelationID Relation

Serialization methods for RelationID + Relation

GraphIdSerializable ObjectTypeID ObjectType

Serialization methods for ObjectTypeID + ObjectType

GraphIdSerializable ObjectID Object

Serialization methods for ObjectID + Object