syntax = "proto3";

package chroma;

import "chromadb/proto/chroma.proto";

message CollectionIds {
  repeated string ids = 1;
}

message CompactRequest {
  CollectionIds ids = 1;
}

message CompactResponse {
  // Empty
}

message RebuildRequest {
  CollectionIds ids = 1;
  // Segment scopes to rebuild. If empty, rebuilds all segments (metadata + vector).
  repeated SegmentScope segment_scopes = 2;
}

message RebuildResponse {
  // Empty
}

message ListDeadJobsRequest {
  // Empty
}

message ListDeadJobsResponse {
  CollectionIds ids = 1;
}

message ListInProgressJobsRequest {
  // Empty
}

message InProgressJobInfo {
  string job_id = 1;
  string database_name = 2;
  int64 expires_at_epoch_secs = 3;
}

message ListInProgressJobsResponse {
  repeated InProgressJobInfo jobs = 1;
}

message GetCollectionAssignmentRequest {
  string collection_id = 1;
}

message GetCollectionAssignmentResponse {
  string assigned_node = 1;
  repeated string memberlist = 2;
}

service Compactor {
  rpc Compact(CompactRequest) returns (CompactResponse) {}
  rpc Rebuild(RebuildRequest) returns (RebuildResponse) {}
  rpc ListDeadJobs(ListDeadJobsRequest) returns (ListDeadJobsResponse) {}
  rpc ListInProgressJobs(ListInProgressJobsRequest) returns (ListInProgressJobsResponse) {}
  rpc GetCollectionAssignment(GetCollectionAssignmentRequest) returns (GetCollectionAssignmentResponse) {}
}
