syntax = "proto3";

import "google/protobuf/descriptor.proto";

package NSv;

extend google.protobuf.MessageOptions {
    // Intentionally equal to eventlog's `message_id` to support `.ev` files.
    uint32 message_id = 50001;
}

// The log is a stream of protobuf messages, prefixed with lengths coded as varints.
message TLogEvent {
    // The value of this field is always a 1-byte backreference plus the constant
    // `NSv::TLog::SyncField`. Take a pointer to the first byte of the constant and subtract
    // the backreference to get a pointer to the first byte of this `TLogEvent`'s length.
    bytes Sync = 1;
    // If the `Time` field is set, the next N messages are the event payloads of types
    // that have option `message_id` equal to the values of the `Type` field. Otherwise,
    // the next message is another `TLogEvent`.
    repeated uint64 Time = 2;
    repeated uint32 Type = 3;
    repeated uint32 Context = 4;
    repeated uint32 Current = 5;
    // If these fields are set, `LZ4` contains an LZ4-packed protobuf stream, while
    // `LZ4Time` is the `Time` of the first event in that stream.
    uint64 LZ4Time = 6;
    uint64 LZ4DecompressedSize = 8;
    bytes LZ4 = 7;
}
