Skip to main content

Module codec

Module codec 

Source
Expand description

The C ABI for wire formats and metered-link packing.

These functions wrap [pamoja_codec] for callers that reach the SDK through the flat C boundary. The Codec trait is generic over the value being carried and so cannot cross a C ABI; what crosses instead is the concrete work a caller with an untyped payload actually needs. Converting a document between JSON and CBOR, and packing a batch of readings small enough for a metered link.

Encoded output is bytes and comes back as a PamojaBuffer. Decoded output is a typed series, so it comes back as PamojaSamples (int64) or PamojaReadings (float) rather than bytes the caller would have to reinterpret.

Structs§

PamojaReadings
An opaque handle to a decoded series of float readings.
PamojaSamples
An opaque handle to a decoded series of integer samples.

Functions§

pamoja_codec_cbor_to_json
Converts a CBOR document into its JSON encoding.
pamoja_codec_decode_deltas
Decodes a delta-encoded buffer back into its integer samples.
pamoja_codec_encode_deltas
Delta-encodes a series of integer samples into a compact buffer.
pamoja_codec_json_to_cbor
Converts a JSON document into its CBOR encoding.
pamoja_codec_quantizer_decode
Decodes a quantized batch back into float readings.
pamoja_codec_quantizer_encode
Quantizes and delta-encodes a batch of float readings.
pamoja_readings_data
Returns a pointer to a decoded series of float readings.
pamoja_readings_free
Releases a decoded reading series.
pamoja_readings_len
Returns the number of float readings in a decoded series.
pamoja_samples_data
Returns a pointer to a decoded series of integer samples.
pamoja_samples_free
Releases a decoded sample series.
pamoja_samples_len
Returns the number of integer samples in a decoded series.