acid-state-0.16.0.1: Add ACID guarantees to any serializable Haskell data structure.

Safe HaskellNone
LanguageHaskell2010

Data.Acid.Archive

Synopsis

Documentation

type Entry = ByteString Source #

A bytestring that represents an entry in an archive.

data Entries Source #

Result of unpacking an archive. This is essentially a list of Entry, but may terminate in Fail if the archive format is incorrect.

Constructors

Done 
Next Entry Entries 
Fail String 
Instances
Show Entries Source # 
Instance details

Defined in Data.Acid.Archive

entriesToList :: Entries -> [Entry] Source #

Convert Entries to a normal list, calling error if there was a failure in unpacking the archive.

entriesToListNoFail :: Entries -> [Entry] Source #

Convert Entries to a normal list, silently ignoring a failure to unpack the archive and instead returning a truncated list.

data Archiver Source #

Interface for the lowest level of the serialisation layer, which handles packing lists of Entry elements (essentially just bytestrings) into a single bytestring, perhaps with error-checking.

Any Archiver{archiveWrite, archiveRead} must satisfy the round-trip property:

forall xs . entriesToList (archiveRead (archiveWrite xs)) == xs

Moreover, archiveWrite must be a monoid homomorphism, so that concatenating archives is equivalent to concatenating the lists of entries that they represent:

archiveWrite [] == empty
forall xs ys . archiveWrite xs <> archiveWrite ys == archiveWrite (xs ++ ys)

Constructors

Archiver 

Fields

defaultArchiver :: Archiver Source #

Standard (and historically the only) implementation of the Archiver interface. This represents each entry in the following format:

| entry length | crc16   | entry   |
| 8 bytes      | 2 bytes | n bytes |