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

Portabilityunknown
Stabilityunstable
MaintainerConrad Parker <conrad@metadecks.org>

Data.ZoomCache

Contents

Description

API for implementing ZoomCache applications

Synopsis

Types

data TrackType Source

Constructors

ZDouble 
ZInt 

data DataRateType Source

Constant or Variable datarate. For constant datarate, timestamps are implied as incrementing by 1/datarate For variable datarate, explicit timestamps are attached to each datum, encoded as a separate block of timestamps in the Raw Data packet.

Constructors

ConstantDR 
VariableDR 

Instances

data CacheFile Source

Global and track headers for a zoom-cache file

Constructors

CacheFile 

data ZoomRaw Source

Constructors

forall a . ZoomReadable a => ZoomRaw (RawData a) 

data ZoomSummary Source

Constructors

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

data Summary a Source

A recorded block of summary data

Track specification

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

Instances

The ZoomWrite class

class ZoomWrite t whereSource

The ZoomWrite class provides write, a method to write a Haskell value to an open ZoomCache file.

Methods

write :: TrackNo -> t -> ZoomW ()Source

Write a value to an open ZoomCache file.

The ZoomW monad

type ZoomW = StateT ZoomWHandle IOSource

A StateT IO monad for writing a ZoomCache file

withFileWriteSource

Arguments

:: TrackMap 
-> Bool

Whether or not to write raw data packets. If False, only summary blocks are written.

-> ZoomW () 
-> FilePath 
-> IO () 

Run a ZoomW () action on a given file handle, using the specified TrackMap specification

flush :: ZoomW ()Source

Force a flush of ZoomCache summary blocks to disk. It is not usually necessary to call this function as summary blocks are transparently written at regular intervals.

Watermarks

watermark :: TrackNo -> ZoomW (Maybe Int)Source

Query the maximum number of data points to buffer for a given track before forcing a flush of all buffered data and summaries.

setWatermark :: TrackNo -> Int -> ZoomW ()Source

Set the maximum number of data points to buffer for a given track before forcing a flush of all buffered data and summaries.

TrackSpec helpers

oneTrack :: TrackType -> DataRateType -> Rational -> ByteString -> TrackMapSource

Create a track map for a stream of a given type, as track no. 1

Iteratee parsers

Pretty printing