syntax = "proto3";
package thanos;

import "types.proto";
import "gogoproto/gogo.proto";

option go_package = "storepb";

option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.goproto_getters_all) = false;

service Store {
  /// Info returns meta information about a store e.g labels that makes that store unique.
  rpc Info(InfoRequest) returns (InfoResponse);

  rpc Series(SeriesRequest) returns (stream SeriesResponse);

  rpc LabelNames(LabelNamesRequest) returns (LabelNamesResponse);

  rpc LabelValues(LabelValuesRequest) returns (LabelValuesResponse);
}

message InfoRequest {
}

message InfoResponse {
  repeated Label labels = 1 [(gogoproto.nullable) = false];
  int64 min_time        = 2;
  int64 max_time        = 3;
}

message SeriesRequest {
  int64 min_time                 = 1;
  int64 max_time                 = 2;
  repeated LabelMatcher matchers = 3 [(gogoproto.nullable) = false];

  int64 max_resolution_window = 4;
  repeated Aggr aggregates    = 5;
}

enum Aggr {
  RAW     = 0;
  COUNT   = 1;
  SUM     = 2;
  MIN     = 3;
  MAX     = 4;
  COUNTER = 5;
}

message SeriesResponse {
  oneof result {
      Series series = 1;
      string warning = 2;
  }
}

message LabelNamesRequest {
}

message LabelNamesResponse {
  repeated string names = 1;
  repeated string warnings = 2;
}

message LabelValuesRequest {
  string label = 1;
}

message LabelValuesResponse {
  repeated string values = 1;
  repeated string warnings = 2;
}
