Portability | unknown |
---|---|
Stability | unstable |
Maintainer | Conrad Parker <conrad@metadecks.org> |
Safe Haskell | Safe-Infered |
ZoomCache packet and summary types and interfaces
- data Codec = forall a . ZoomReadable a => Codec a
- type TrackMap = IntMap TrackSpec
- data TrackSpec = TrackSpec {
- specType :: !Codec
- specDeltaEncode :: !Bool
- specZlibCompress :: !Bool
- specSRType :: !SampleRateType
- specRate :: !Rational
- specName :: !ByteString
- type IdentifyCodec = ByteString -> Maybe Codec
- class Timestampable a where
- before :: Timestampable a => Maybe TimeStamp -> a -> Bool
- class UTCTimestampable a where
- utcTimestamp :: a -> Maybe UTCTime
- beforeUTC :: UTCTimestampable a => Maybe UTCTime -> a -> Bool
- class Typeable a => ZoomReadable a where
- data SummaryData a :: *
- trackIdentifier :: a -> ByteString
- readRaw :: (Functor m, Monad m) => Iteratee ByteString m a
- readSummary :: (Functor m, Monad m) => Iteratee ByteString m (SummaryData a)
- prettyRaw :: a -> String
- prettySummaryData :: SummaryData a -> String
- deltaDecodeRaw :: [a] -> [a]
- class ZoomReadable a => ZoomWritable a where
- data SummaryWork a :: *
- fromRaw :: a -> Builder
- fromSummaryData :: SummaryData a -> Builder
- initSummaryWork :: SampleOffset -> SummaryWork a
- updateSummaryData :: SampleOffset -> a -> SummaryWork a -> SummaryWork a
- toSummaryData :: SampleOffsetDiff -> SummaryWork a -> SummaryData a
- appendSummaryData :: SampleOffsetDiff -> SummaryData a -> SampleOffsetDiff -> SummaryData a -> SummaryData a
- deltaEncodeRaw :: SummaryWork a -> a -> a
- data ZoomRaw = forall a . ZoomReadable a => ZoomRaw [a]
- data ZoomSummary = forall a . ZoomReadable a => ZoomSummary (Summary a)
- data ZoomSummaryUTC = forall a . ZoomReadable a => ZoomSummaryUTC (SummaryUTC a)
- data ZoomSummarySO = forall a . ZoomReadable a => ZoomSummarySO (SummarySO a)
- data ZoomWork = forall a . (Typeable a, ZoomWritable a) => ZoomWork {}
- data Packet = Packet {
- packetTrack :: !TrackNo
- packetEntry :: !TimeStamp
- packetExit :: !TimeStamp
- packetCount :: !Int
- packetData :: !ZoomRaw
- packetTimeStamps :: ![TimeStamp]
- packetFromPacketSO :: Rational -> PacketSO -> Packet
- data Summary a = Summary {
- summaryTrack :: !TrackNo
- summaryLevel :: !Int
- summaryEntry :: !TimeStamp
- summaryExit :: !TimeStamp
- summaryData :: !(SummaryData a)
- summaryFromSummarySO :: Rational -> SummarySO a -> Summary a
- data PacketUTC = PacketUTC {
- packetUTCTrack :: !TrackNo
- packetUTCEntry :: !UTCTime
- packetUTCExit :: !UTCTime
- packetUTCCount :: !Int
- packetUTCData :: !ZoomRaw
- packetUTCTimeStamps :: ![UTCTime]
- packetUTCFromPacket :: UTCTime -> Packet -> PacketUTC
- packetUTCFromPacketSO :: UTCTime -> Rational -> PacketSO -> PacketUTC
- data SummaryUTC a = SummaryUTC {
- summaryUTCTrack :: !TrackNo
- summaryUTCLevel :: !Int
- summaryUTCEntry :: !UTCTime
- summaryUTCExit :: !UTCTime
- summaryUTCData :: !(SummaryData a)
- summaryUTCFromSummary :: UTCTime -> Summary a -> SummaryUTC a
- summaryUTCFromSummarySO :: UTCTime -> Rational -> SummarySO a -> SummaryUTC a
- data PacketSO = PacketSO {}
- data SummarySO a = SummarySO {
- summarySOTrack :: !TrackNo
- summarySOLevel :: !Int
- summarySOEntry :: !SampleOffset
- summarySOExit :: !SampleOffset
- summarySOData :: !(SummaryData a)
- summarySODuration :: SummarySO a -> SampleOffsetDiff
- data CacheFile = CacheFile {}
- mkCacheFile :: Global -> CacheFile
- fiFull :: CacheFile -> Bool
Track types and specification
A specification of the type and name of each track
TrackSpec | |
|
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
.
Classes
class Timestampable a whereSource
Timestampable ZoomSummary | |
Timestampable Packet | |
Timestampable Block | |
Timestampable a => Timestampable [a] | |
Timestampable a => Timestampable (Offset a) | |
Timestampable (Summary a) | |
Timestampable (TimeStamp, a) |
class UTCTimestampable a whereSource
utcTimestamp :: a -> Maybe UTCTimeSource
class Typeable a => ZoomReadable a whereSource
A codec instance must specify a SummaryData
type,
and implement all methods of this class.
data SummaryData a :: *Source
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 :: (Functor m, Monad m) => Iteratee ByteString m aSource
An iteratee to read one value of type a
from a stream of ByteString
.
readSummary :: (Functor m, Monad m) => Iteratee ByteString m (SummaryData a)Source
An iteratee to read one value of type 'SummaryData a' from a stream
of 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'.
deltaDecodeRaw :: [a] -> [a]Source
Delta-decode a list of values
class ZoomReadable a => ZoomWritable a whereSource
A codec instance must additionally specify a SummaryWork
type
data SummaryWork a :: *Source
Intermediate calculations
Serialize a value of type a
fromSummaryData :: SummaryData a -> BuilderSource
Serialize a 'SummaryData a'
initSummaryWork :: SampleOffset -> SummaryWork aSource
Generate a new 'SummaryWork a', given an initial timestamp.
updateSummaryData :: SampleOffset -> a -> SummaryWork a -> SummaryWork aSource
Update a SummaryData
with the value of a
occuring at the
given SampleOffset
.
toSummaryData :: SampleOffsetDiff -> SummaryWork a -> SummaryData aSource
Finalize a 'SummaryWork a', generating a 'SummaryData a'.
appendSummaryData :: SampleOffsetDiff -> SummaryData a -> SampleOffsetDiff -> SummaryData a -> SummaryData aSource
Append two SummaryData
deltaEncodeRaw :: SummaryWork a -> a -> aSource
Delta-encode a value.
forall a . ZoomReadable a => ZoomRaw [a] |
data ZoomSummary Source
forall a . ZoomReadable a => ZoomSummary (Summary a) |
data ZoomSummaryUTC Source
forall a . ZoomReadable a => ZoomSummaryUTC (SummaryUTC a) |
data ZoomSummarySO Source
forall a . ZoomReadable a => ZoomSummarySO (SummarySO a) |
forall a . (Typeable a, ZoomWritable a) => ZoomWork | |
Types
Packet | |
|
packetFromPacketSO :: Rational -> PacketSO -> PacketSource
A summary block with samplecounts converted to TimeStamp
Summary | |
|
summaryFromSummarySO :: Rational -> SummarySO a -> Summary aSource
Convert a SummarySo to a Summary, given a samplerate
PacketUTC | |
|
packetUTCFromPacket :: UTCTime -> Packet -> PacketUTCSource
data SummaryUTC a Source
A summary block with timestamps converted to UTCTime
SummaryUTC | |
|
summaryUTCFromSummary :: UTCTime -> Summary a -> SummaryUTC aSource
Convert a Summary to a SummaryUTC, given a UTC base time
summaryUTCFromSummarySO :: UTCTime -> Rational -> SummarySO a -> SummaryUTC aSource
PacketSO | |
|
A recorded block of summary data
SummarySO | |
|
summarySODuration :: SummarySO a -> SampleOffsetDiffSource
The duration covered by a summary, in units of 1 / the track's datarate
CacheFile
Global and track headers for a zoom-cache file