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;
  // Optional shard index to rebuild. If not specified, defaults to shard 0.
  optional uint32 shard_index = 3;
}

message RebuildResponse {
  // Empty
}

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 ListInProgressJobs(ListInProgressJobsRequest) returns (ListInProgressJobsResponse) {}
  rpc GetCollectionAssignment(GetCollectionAssignmentRequest) returns (GetCollectionAssignmentResponse) {}
}
