| Safe Haskell | None |
|---|
Database.Perdure
- module Database.Perdure.Persistent
- module Database.Perdure.Ref
- module Database.Perdure.Deref
- module Database.Perdure.Rev
- module Database.Perdure.SizeRef
- data LocalStoreFile
- withRawDeviceStoreFiles :: [FilePath] -> ([LocalStoreFile] -> IO a) -> ErrorT String IO a
- withRawDeviceStoreFile :: FilePath -> (LocalStoreFile -> IO a) -> ErrorT String IO a
- withFileStoreFile :: FilePath -> (LocalStoreFile -> IO a) -> ErrorT String IO a
- newtype ReplicatedFile = ReplicatedFile [LocalStoreFile]
- newCachedFile :: Integer -> ReplicatedFile -> IO CachedFile
- data RootLocation
- defaultRootLocation :: CachedFile -> RootLocation
- data PVar s
- openPVar :: (Typeable s, Persistent s) => RootLocation -> IO (Maybe (PVar s))
- createPVar :: (Typeable s, Persistent s) => s -> Word64 -> RootLocation -> IO (PVar s)
- updatePVar :: (Typeable s, Persistent s) => PVar s -> StateT s IO a -> IO a
- updateInspectPVar :: (Typeable s, Persistent s) => PVar s -> StateT s (ReaderT (PState s) IO) a -> IO a
Documentation
module Database.Perdure.Persistent
module Database.Perdure.Ref
module Database.Perdure.Deref
module Database.Perdure.Rev
module Database.Perdure.SizeRef
data LocalStoreFile Source
A file or raw device where we can persist bytes.
Instances
| SyncableStoreFile LocalStoreFile | |
| RawStoreFile LocalStoreFile |
withRawDeviceStoreFiles :: [FilePath] -> ([LocalStoreFile] -> IO a) -> ErrorT String IO aSource
Like nesting multiple calls to withRawDeviceStoreFile.
withRawDeviceStoreFile :: FilePath -> (LocalStoreFile -> IO a) -> ErrorT String IO aSource
Opens the specified raw device as a LocalStoreFile, runs the provided function and closes the device. Do not make concurrent calls on the same device, place concurrency in the passed function.
withFileStoreFile :: FilePath -> (LocalStoreFile -> IO a) -> ErrorT String IO aSource
Opens the specified file as a LocalStoreFile, runs the provided function and closes the file. Do not make concurrent calls on the same file, place concurrency in the passed function.
newtype ReplicatedFile Source
A list of LocalStoreFile to be used as replicates. We write to all replicates and read from the first one that reports no error.
Constructors
| ReplicatedFile [LocalStoreFile] |
newCachedFile :: Integer -> ReplicatedFile -> IO CachedFileSource
Wraps a ReplicatedFile with cache of a given size (number of dereferenced DRefs)
data RootLocation Source
The RootLocation specifies where roots are written, and provides a cache.
defaultRootLocation :: CachedFile -> RootLocationSource
At the moment this is the only way to create a rootLocation. The root of the database will be located in one of two reserved locations at the start of the specified files.
Represents a persisted database. Contains a (ram-only) lock to sequence multithreaded operations,
so only one PVar must be created per RootLocation.
openPVar :: (Typeable s, Persistent s) => RootLocation -> IO (Maybe (PVar s))Source
Attempts to open a PVar by reading at the given RootLocation. Do not open the same location multiple times, share
the PVar instead.
createPVar :: (Typeable s, Persistent s) => s -> Word64 -> RootLocation -> IO (PVar s)Source
Creates a PVar with the specified initial state. Writes at the specified location, using the given maximum usable space (in bytes).
updatePVar :: (Typeable s, Persistent s) => PVar s -> StateT s IO a -> IO aSource
Persist a state change