syntax = "proto3";

package qdrant;
option csharp_namespace = "Qdrant.Client.Grpc";

import "telemetry_internal.proto";

service QdrantInternal {
  // Get current commit and term on the target peer.
  rpc GetConsensusCommit(GetConsensusCommitRequest)
      returns (GetConsensusCommitResponse) {}

  // Wait until the target peer reached the given commit ID.
  rpc WaitOnConsensusCommit(WaitOnConsensusCommitRequest)
      returns (WaitOnConsensusCommitResponse) {}

  // Get telemetry
  rpc GetTelemetry(GetTelemetryRequest) returns (GetTelemetryResponse) {}
}

message GetConsensusCommitRequest {}

message GetConsensusCommitResponse {
  // Raft commit as u64
  int64 commit = 1;
  // Raft term as u64
  int64 term = 2;
}

message WaitOnConsensusCommitRequest {
  // Raft commit as u64
  int64 commit = 1;
  // Raft term as u64
  int64 term = 2;
  // Timeout in seconds
  int64 timeout = 3;
}

message WaitOnConsensusCommitResponse {
  // False if commit/term is diverged and never reached or if timed out.
  bool ok = 1;
}
