syntax = "proto3";

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

import "snapshots_service.proto";

service ShardSnapshots {
  // Create shard snapshot
  rpc Create(CreateShardSnapshotRequest) returns (CreateSnapshotResponse) {}
  // List shard snapshots
  rpc List(ListShardSnapshotsRequest) returns (ListSnapshotsResponse) {}
  // Delete shard snapshot
  rpc Delete(DeleteShardSnapshotRequest) returns (DeleteSnapshotResponse) {}
  // Recover shard snapshot
  rpc Recover(RecoverShardSnapshotRequest) returns (RecoverSnapshotResponse) {}
}

message CreateShardSnapshotRequest {
  // Name of the collection
  string collection_name = 1;
  // Id of the shard
  uint32 shard_id = 2;
}

message ListShardSnapshotsRequest {
  // Name of the collection
  string collection_name = 1;
  // Id of the shard
  uint32 shard_id = 2;
}

message DeleteShardSnapshotRequest {
  // Name of the collection
  string collection_name = 1;
  // Id of the shard
  uint32 shard_id = 2;
  // Name of the shard snapshot
  string snapshot_name = 3;
}

message RecoverShardSnapshotRequest {
  // Name of the collection
  string collection_name = 1;
  // Id of the shard
  uint32 shard_id = 2;
  // Location of the shard snapshot
  ShardSnapshotLocation snapshot_location = 3;
  // Priority of the shard snapshot
  ShardSnapshotPriority snapshot_priority = 4;
  // SHA256 checksum for verifying snapshot integrity
  optional string checksum = 5;
  // Optional API key used when fetching the snapshot from a remote URL
  optional string api_key = 6;
}

message ShardSnapshotLocation {
  oneof location {
    // URL of the remote shard snapshot
    string url = 1;
    // Path of the local shard snapshot
    string path = 2;
  }
}

enum ShardSnapshotPriority {
  // Restore snapshot without *any* additional synchronization
  ShardSnapshotPriorityNoSync = 0;
  // Prefer snapshot data over the current state
  ShardSnapshotPrioritySnapshot = 1;
  // Prefer existing data over the snapshot
  ShardSnapshotPriorityReplica = 2;
  // Internal priority to use during snapshot shard transfer
  ShardSnapshotPriorityShardTransfer = 3;
}

message RecoverSnapshotResponse {
  // Time in seconds spent to process request
  double time = 1;
}
