| Copyright | (c) 2015 Călin Ardelean |
|---|---|
| License | MIT |
| Maintainer | Călin Ardelean <calinucs@gmail.com> |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
| Extensions |
|
Database.Muesli.Backend.Types
Description
Generic backend interface types and classes.
This module is re-exported by other modules, like Database.Muesli.Handle.
- data TransRecord
- data LogRecord = LogRecord {
- recTransactionId :: !TransactionId
- recDocumentKey :: !DocumentKey
- recReferences :: ![(PropertyKey, DocumentKey)]
- recSortables :: ![(PropertyKey, SortableKey)]
- recUniques :: ![(PropertyKey, UniqueKey)]
- recAddress :: !DocAddress
- recSize :: !DocSize
- recDeleted :: !Bool
- class (Show a, DbHandle (LogHandleOf a), DataHandle (DataHandleOf a)) => LogState a where
- type LogHandleOf a :: *
- type DataHandleOf a :: *
- logHandle :: a -> LogHandleOf a
- logInit :: MonadIO m => LogHandleOf a -> m a
- logAppend :: MonadIO m => a -> [TransRecord] -> m a
- logRead :: MonadIO m => a -> m (Maybe TransRecord)
- class DbHandle a => DataHandle a where
- readDocument :: MonadIO m => a -> LogRecord -> m ByteString
- writeDocument :: MonadIO m => LogRecord -> ByteString -> a -> m ()
- type DbPath = String
- class DbHandle a where
Transaction log records
data TransRecord Source
This type represents a line in the transaction log file.
There can be multiple lines for a single transaction, and the last one
must be a Completed one. Other than that, the lines from multiple
transactions can be mixed.
Constructors
| Pending LogRecord | |
| Completed TransactionId |
Instances
Holds the metadata for a given document version.
Keys collected by the generic scrapper are stored in recReferences,
recSortables, and recUniques. The recDocumentKey is generated by an
IdSupply, while the recAddress and recSize
are allocated by alloc.
This work is done either by the primitive queries in Database.Muesli.Query,
or by runQuery.
Constructors
| LogRecord | |
Fields
| |
Generic backend interface
These classes are used by the machinary in Database.Muesli.State.
For an implementation, see the Database.Muesli.Backend.File module.
class (Show a, DbHandle (LogHandleOf a), DataHandle (DataHandleOf a)) => LogState a where Source
Provides stateful access to an abstract log file handle.
Methods
logHandle :: a -> LogHandleOf a Source
logInit :: MonadIO m => LogHandleOf a -> m a Source
logAppend :: MonadIO m => a -> [TransRecord] -> m a Source
logRead :: MonadIO m => a -> m (Maybe TransRecord) Source
Instances
class DbHandle a => DataHandle a where Source
Handle used to access serialized document data in the generic data file.
Methods
readDocument :: MonadIO m => a -> LogRecord -> m ByteString Source
writeDocument :: MonadIO m => LogRecord -> ByteString -> a -> m () Source
Instances