syntax = "proto3";

import "proto/context.proto";

package eventlog;

option go_package = "proto;eventlog";

message GetEventLogChunkRequest {
  // The request context.
  context.RequestContext request_context = 1;

  // The invocation identifier itself.
  string invocation_id = 2;

  // Optionally specify the chunk to be returned; gets the last chunk if empty
  string chunk_id = 3;

  // Specify fewest lines that may be returned; additional chunks may be read
  // to meet this requirement. If no more chunks are available to be read and
  // this requirement is still not satisfied, the buffer will instead contain as
  // many lines as are available.
  int32 min_lines = 4;
}

message GetEventLogChunkResponse {
  // The response context.
  context.ResponseContext response_context = 1;

  // The surrounding chunk ids. Empty if no such chunk exists
  string previous_chunk_id = 2;
  string next_chunk_id = 3;

  // The requested log data
  bytes buffer = 4;

  // If the chunk is "live", i.e. not yet written to disk and subject to change.
  bool live = 5;
}

message LiveEventLogChunk {
  // The chunk id that this data will eventually be written to.
  // Technically, when written the tail could span to the following chunk, but
  // that is not relevant for our purposes here.
  string chunk_id = 1;

  // The cached log data
  bytes buffer = 2;
}
