packages feed

HGraphStorage 0.0.2 → 0.0.3

raw patch · 3 files changed

+15/−9 lines, 3 files

Files

HGraphStorage.cabal view
@@ -1,5 +1,5 @@ name:           HGraphStorage-version:        0.0.2+version:        0.0.3 cabal-version:  >= 1.8 build-type:     Simple author:         JP Moresmau <jp@moresmau.fr>
src/Database/Graph/HGraphStorage/API.hs view
@@ -74,27 +74,31 @@       act  --- | Our monad transformer+-- | Our monad transformer. newtype GraphStorageT m a = Gs { unIs :: StateT GsData m a }     deriving ( Functor, Applicative, Alternative, Monad              , MonadFix, MonadPlus, MonadIO, MonadTrans              , R.MonadThrow )-+-- | Monad Resource instance. deriving instance R.MonadResource m => R.MonadResource (GraphStorageT m) +-- | Monad Base instance. instance MonadBase b m => MonadBase b (GraphStorageT m) where     liftBase = lift . liftBase +-- | Monad Trans Control instance. instance MonadTransControl GraphStorageT where     type StT GraphStorageT a = StT (StateT GsData) a     liftWith f = Gs $ liftWith (\run -> f (run . unIs))     restoreT = Gs . restoreT +-- | Monad Base Control instance. instance MonadBaseControl b m => MonadBaseControl b (GraphStorageT m) where     type StM (GraphStorageT m) a = ComposeSt GraphStorageT m a     liftBaseWith = defaultLiftBaseWith     restoreM = defaultRestoreM +-- | MonadLogger instance. instance (MonadLogger m) => MonadLogger (GraphStorageT m) where    monadLoggerLog loc src lvl msg=lift $ monadLoggerLog loc src lvl msg @@ -102,14 +106,14 @@ --data Graph = Graph [GraphObject] [GraphRelation] --  deriving (Show,Read,Eq,Ord,Typeable) --- | An object with a type and properties+-- | An object with a type and properties. data GraphObject a = GraphObject   { goID         :: a   , goType       :: T.Text   , goProperties :: DM.Map T.Text [PropertyValue]   } deriving (Show,Read,Eq,Ord,Typeable) --- | A relation between two objects, with a type and properties+-- | A relation between two objects, with a type and properties. data GraphRelation a b = GraphRelation   { grID         :: a   , grFrom       :: GraphObject b@@ -141,7 +145,7 @@ getIndices :: Monad m => GraphStorageT m [(IndexInfo,Trie Int16 ObjectID)] getIndices = gsIndexes `liftM` Gs get -+-- | The file used to store the index information. indexFile :: Monad m => GraphStorageT m FilePath indexFile = do   dir <- getDirectory@@ -511,7 +515,7 @@         return ()          - -- | (Internal) Create an index.+-- | (Internal) Create an index. createIndex :: forall k v m. (Binary k,Binary v,Default k,Default v,GraphUsableMonad m) =>                 T.Text -> GraphStorageT m (Trie k v) createIndex idxName =  do
src/Database/Graph/HGraphStorage/FileOps.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE RecordWildCards, MultiParamTypeClasses, TypeSynonymInstances,OverloadedStrings, FlexibleContexts, ConstraintKinds, ExplicitForAll, ScopedTypeVariables  #-}+-- | Operations on the data files module Database.Graph.HGraphStorage.FileOps where  import Control.Applicative@@ -26,7 +27,7 @@ import Control.Monad.IO.Class (liftIO) import Database.Graph.HGraphStorage.FreeList --- | Open all the file handles+-- | Open all the file handles. open :: FilePath -> GraphSettings -> IO Handles open dir gs = do   createDirectoryIfMissing True dir@@ -57,7 +58,8 @@           ex <- doesFileExist f           when ex $ removeFile f)           -          ++-- | Set the buffer mode on the given handle, if provided.           setBufferMode :: Handle -> Maybe BufferMode -> IO() setBufferMode _ Nothing = return () setBufferMode h (Just bm) = hSetBuffering h bm