///|
pub(all) struct Limits {
max_record_bytes : Int32
max_string_bytes : Int32
max_records : Int32
max_decompressed_bytes : Int32
} derive(Eq, @debug.Debug)
///|
pub fn default_limits() -> Limits {
{
max_record_bytes: 16 * 1024 * 1024,
max_string_bytes: 1024 * 1024,
max_records: 100000,
max_decompressed_bytes: 64 * 1024 * 1024,
}
}
///|
pub suberror McapError {
Invalid(String)
} derive(@debug.Debug)
///|
pub(all) struct Header {
profile : String
library : String
} derive(Eq, @debug.Debug)
///|
pub(all) struct Schema {
id : Int32
name : String
encoding : String
data : Bytes
} derive(Eq, @debug.Debug)
///|
pub(all) struct Channel {
id : Int32
schema_id : Int32
topic : String
message_encoding : String
metadata : Array[(String, String)]
} derive(Eq, @debug.Debug)
///|
pub(all) struct Message {
channel_id : Int32
sequence : UInt32
log_time : UInt64
publish_time : UInt64
data : Bytes
} derive(Eq, @debug.Debug)
///|
pub(all) struct Footer {
summary_start : UInt64
summary_offset_start : UInt64
summary_crc : UInt32
} derive(Eq, @debug.Debug)
///|
pub(all) struct Metadata {
name : String
entries : Array[(String, String)]
} derive(Eq, @debug.Debug)
///|
pub(all) struct Record {
opcode : Byte
offset : Int32
body : Bytes
} derive(Eq, @debug.Debug)
///|
pub(all) struct Log {
header : Header
schemas : Array[Schema]
channels : Array[Channel]
messages : Array[Message]
metadata : Array[Metadata]
attachments : Array[Attachment]
} derive(Eq, @debug.Debug)
///|
pub fn empty_log(profile~ : String = "") -> Log {
{
header: { profile, library: "moonmcap/0.17.4", },
schemas: [],
channels: [],
messages: [],
metadata: [],
attachments: [],
}
}
///|
pub fn magic() -> Bytes {
b"\x89MCAP0\r\n"
}