zoom-cache- A streamable, seekable, zoomable cache file format

MaintainerConrad Parker <conrad@metadecks.org>




ZoomCache packet and summary types and interfaces


Track types and specification

data Codec Source


forall a . ZoomReadable a => Codec a 


type TrackMap = IntMap TrackSpecSource

A map of all track numbers to their TrackSpec

data TrackSpec Source

A specification of the type and name of each track


type IdentifyCodec = ByteString -> Maybe CodecSource

Identify the tracktype corresponding to a given Codec Identifier. When parsing a zoom-cache file, the zoom-cache library will try each of a given list [IdentifyTrack].

The standard zoom-cache instances are provided in standardIdentifiers.

When developing your own codecs it is not necessary to build a composite IdentifyTrack functions; it is sufficient to generate one for each new codec type. A library of related zoom-cache codecs should export its own [IdentifyTrack] functions, usually called something like mylibIdentifiers.

These can be generated with identifyCodec.


class Typeable a => ZoomReadable a whereSource

A codec instance must specify a SummaryData type, and implement all methods of this class.

Associated Types

data SummaryData a :: *Source

Summaries of a subsequence of values of type a. In the default instances for Int and Double, this is a record containing values such as the maximum, minimum and mean of the subsequence.


trackIdentifier :: a -> ByteStringSource

The track identifier used for streams of type a. The value of the argument should be ignored by any instance of ZoomReadable, so that is safe to pass undefined as the argument.

readRaw :: (Nullable s, ListLike s Word8, Functor m, Monad m) => Iteratee s m aSource

An iteratee to read one value of type a from a stream of something like '[Word8]' or ByteString.

readSummary :: (Nullable s, ListLike s Word8, Functor m, Monad m) => Iteratee s m (SummaryData a)Source

An iteratee to read one value of type 'SummaryData a' from a stream of something like '[Word8]' or ByteString.

prettyRaw :: a -> StringSource

Pretty printing, used for dumping values of type a.

prettySummaryData :: SummaryData a -> StringSource

Pretty printing for values of type 'SummaryData a'.

class ZoomReadable a => ZoomWritable a whereSource

A codec instance must additionally specify a SummaryWork type

Associated Types

data SummaryWork a :: *Source

Intermediate calculations


fromRaw :: a -> BuilderSource

Serialize a value of type a

fromSummaryData :: SummaryData a -> BuilderSource

Serialize a 'SummaryData a'

initSummaryWork :: TimeStamp -> SummaryWork aSource

Generate a new 'SummaryWork a', given an initial timestamp.

updateSummaryData :: TimeStamp -> a -> SummaryWork a -> SummaryWork aSource

Update a SummaryData with the value of a occuring at the given TimeStamp.

toSummaryData :: TimeStampDiff -> SummaryWork a -> SummaryData aSource

Finalize a 'SummaryWork a', generating a 'SummaryData a'.

appendSummaryData :: TimeStampDiff -> SummaryData a -> TimeStampDiff -> SummaryData a -> SummaryData aSource

Append two SummaryData

data ZoomRaw Source


forall a . ZoomReadable a => ZoomRaw [a] 

data ZoomSummary Source


forall a . ZoomReadable a => ZoomSummary (Summary a) 

data ZoomWork Source


forall a . (Typeable a, ZoomWritable a) => ZoomWork 


levels :: IntMap (Summary a -> Summary a)
currWork :: Maybe (SummaryWork a)


data Summary a Source

A recorded block of summary data

summaryDuration :: Summary a -> TimeStampDiffSource

The duration covered by a summary, in units of 1 / the track's datarate


data CacheFile Source

Global and track headers for a zoom-cache file



mkCacheFile :: Global -> CacheFileSource

Create an empty CacheFile using the given Global

fiFull :: CacheFile -> BoolSource

Determine whether all tracks of a CacheFile are specified