halfs-0.2: Haskell File SystemSource codeContentsIndex
Halfs.FSState
Description
Convenience module for exporting usually useful stuff ALL unsafe* functions must be deleted and turned into primitives in this module.
Synopsis
data StateHandle = StateHandle {
stateFineMVar :: MVar FSRoot
stateCoarseMVar :: Maybe (MVar ())
}
data FSWrite a
unsafeLiftIOWrite :: IO a -> FSWrite a
runFSWrite :: FSWrite a -> FSState a
evalFSWriteIO :: FSWrite a -> FSRoot -> IO a
evalFSWriteIOMV :: FSWrite a -> StateHandle -> IO a
runFSWriteIO :: FSWrite a -> FSRoot -> IO (a, FSRoot)
readToWrite :: FSRead a -> FSWrite a
readToWriteCont :: ((forall s. m s -> FSRead a) -> FSRead a) -> (forall s. m s -> FSWrite a) -> FSWrite a
writeToBuffer :: Binary a => BinHandle -> a -> FSWrite ()
unsafeLiftIOWriteWithRoot :: (FSRoot -> IO a) -> FSWrite a
unsafeWriteGet :: FSWrite FSRoot
putStrLnWriteRead :: String -> FSWrite ()
updateInodeCacheWrite :: Inode -> FSWrite ()
modifyFSWrite :: (FSRoot -> FSWrite (FSRoot, a)) -> FSWrite a
data FSRead a
unsafeLiftIORead :: IO a -> FSRead a
runFSRead :: FSRead a -> FSState a
runFSReadIO :: FSRead a -> FSRoot -> (IOError -> IO (a, FSRoot)) -> IO (a, FSRoot)
evalFSReadIOMV :: FSRead a -> StateHandle -> IO a
unsafeReadGet :: FSRead FSRoot
unsafeModifyFSRead :: (FSRoot -> (FSRoot, a)) -> FSRead a
unsafeWriteToRead :: FSWrite a -> FSRead a
newReadRef :: a -> FSRead (ReadRef a)
readReadRef :: ReadRef a -> FSRead a
modifyReadRef :: ReadRef a -> (a -> a) -> FSRead ()
writeReadRef :: ReadRef a -> a -> FSRead ()
takeMVarRW :: FSRW m => MVar a -> m a
readMVarRW :: FSRW m => MVar a -> m a
putMVarRW :: FSRW m => MVar a -> a -> m ()
modifyMVarRW_ :: FSRW m => MVar a -> (a -> IO a) -> m ()
modifyMVarRW_' :: (FSRW m, MonadError IOError m) => MVar a -> (a -> m a) -> m ()
module Control.Monad.Trans
module Control.Monad.Error
module Control.Monad.State
class Monad m => FSRW m where
unsafeLiftIORW :: IO a -> m a
put
get
alreadyExistsEx :: FilePath -> IOError
doesNotExistEx :: FilePath -> IOError
eofEx :: FilePath -> IOError
illegalOpEx :: FilePath -> IOError
decLinksForInode :: Inode -> FSWrite ()
forkWithMVar :: (StateHandle -> FSWrite ()) -> FSWrite ThreadId
forkFSWrite :: FSWrite () -> FSWrite ThreadId
Documentation
data StateHandle Source
Read-write state
Constructors
StateHandle
stateFineMVar :: MVar FSRoot
stateCoarseMVar :: Maybe (MVar ())
show/hide Instances
data FSWrite a Source
show/hide Instances
unsafeLiftIOWrite :: IO a -> FSWrite aSource
FIX: Delete this function; it's temporary during refactoring. It violates safety requirements.
runFSWrite :: FSWrite a -> FSState aSource
Make this write-only monad into a read-write monad.
evalFSWriteIO :: FSWrite a -> FSRoot -> IO aSource
evalFSWriteIOMV :: FSWrite a -> StateHandle -> IO aSource
runFSWriteIO :: FSWrite a -> FSRoot -> IO (a, FSRoot)Source
readToWrite :: FSRead a -> FSWrite aSource
Safe since writers can be readers.
readToWriteCont :: ((forall s. m s -> FSRead a) -> FSRead a) -> (forall s. m s -> FSWrite a) -> FSWrite aSource
Safe since writers can be readers.
writeToBuffer :: Binary a => BinHandle -> a -> FSWrite ()Source
unsafeLiftIOWriteWithRoot :: (FSRoot -> IO a) -> FSWrite aSource
unsafeWriteGet :: FSWrite FSRootSource
Unsafe since it uses readMVar. For get-only situations, for reading and not writing; no mvar block.
putStrLnWriteRead :: String -> FSWrite ()Source
updateInodeCacheWrite :: Inode -> FSWrite ()Source
modifyFSWrite :: (FSRoot -> FSWrite (FSRoot, a)) -> FSWrite aSource
FIX: This f should probably be in the FSRW monad, since that doesn't have state.
data FSRead a Source
show/hide Instances
unsafeLiftIORead :: IO a -> FSRead aSource
FIX: Delete this function; it's temporary during refactoring. It violates safety requirements.
runFSRead :: FSRead a -> FSState aSource
Make this read-only monad into a read-write monad.
runFSReadIO :: FSRead a -> FSRoot -> (IOError -> IO (a, FSRoot)) -> IO (a, FSRoot)Source
evalFSReadIOMV :: FSRead a -> StateHandle -> IO aSource
unsafeReadGet :: FSRead FSRootSource
Unsafe because it uses readMVar.
unsafeModifyFSRead :: (FSRoot -> (FSRoot, a)) -> FSRead aSource
FIX: Unsafe?
unsafeWriteToRead :: FSWrite a -> FSRead aSource
unsafe since this allows a reader to write.
newReadRef :: a -> FSRead (ReadRef a)Source
readReadRef :: ReadRef a -> FSRead aSource
modifyReadRef :: ReadRef a -> (a -> a) -> FSRead ()Source
writeReadRef :: ReadRef a -> a -> FSRead ()Source
takeMVarRW :: FSRW m => MVar a -> m aSource
readMVarRW :: FSRW m => MVar a -> m aSource
putMVarRW :: FSRW m => MVar a -> a -> m ()Source
modifyMVarRW_ :: FSRW m => MVar a -> (a -> IO a) -> m ()Source
modifyMVarRW_' :: (FSRW m, MonadError IOError m) => MVar a -> (a -> m a) -> m ()Source
module Control.Monad.Trans
module Control.Monad.Error
module Control.Monad.State
class Monad m => FSRW m whereSource
Methods
unsafeLiftIORW :: IO a -> m aSource
show/hide Instances
put
get
alreadyExistsEx :: FilePath -> IOErrorSource
doesNotExistEx :: FilePath -> IOErrorSource
eofEx :: FilePath -> IOErrorSource
illegalOpEx :: FilePath -> IOErrorSource
decLinksForInode :: Inode -> FSWrite ()Source
forkWithMVar :: (StateHandle -> FSWrite ()) -> FSWrite ThreadIdSource
forkFSWrite :: FSWrite () -> FSWrite ThreadIdSource
Produced by Haddock version 2.4.2