Skip to main content

qdrant_edge/shard/operations/
operation_name.rs

1use crate::shard::operations::payload_ops::PayloadOps;
2use crate::shard::operations::point_ops::PointOperations;
3use crate::shard::operations::vector_name_ops::VectorNameOperations;
4use crate::shard::operations::vector_ops::VectorOperations;
5use crate::shard::operations::{CollectionUpdateOperations, FieldIndexOperations};
6
7impl CollectionUpdateOperations {
8    /// A stable, human-readable name for the operation, including its inner variant.
9    ///
10    /// Used for audit logging and for reporting slow operations during WAL recovery.
11    pub fn operation_name(&self) -> &'static str {
12        match self {
13            CollectionUpdateOperations::PointOperation(op) => match op {
14                PointOperations::UpsertPoints(_) => "upsert_points",
15                PointOperations::UpsertPointsConditional(_) => "upsert_points_conditional",
16                PointOperations::DeletePoints { .. } => "delete_points",
17                PointOperations::DeletePointsByFilter(_) => "delete_points_by_filter",
18                PointOperations::SyncPoints(_) => "sync_points",
19                PointOperations::UpsertPointsRaw(_) => "upsert_points_raw",
20                PointOperations::SyncPointsRaw(_) => "sync_points_raw",
21            },
22            CollectionUpdateOperations::VectorOperation(op) => match op {
23                VectorOperations::UpdateVectors(_) => "update_vectors",
24                VectorOperations::DeleteVectors(_, _) => "delete_vectors",
25                VectorOperations::DeleteVectorsByFilter(_, _) => "delete_vectors_by_filter",
26            },
27            CollectionUpdateOperations::PayloadOperation(op) => match op {
28                PayloadOps::SetPayload(_) => "set_payload",
29                PayloadOps::DeletePayload(_) => "delete_payload",
30                PayloadOps::ClearPayload { .. } => "clear_payload",
31                PayloadOps::ClearPayloadByFilter(_) => "clear_payload_by_filter",
32                PayloadOps::OverwritePayload(_) => "overwrite_payload",
33            },
34            CollectionUpdateOperations::FieldIndexOperation(op) => match op {
35                FieldIndexOperations::CreateIndex(_) => "create_field_index",
36                FieldIndexOperations::DeleteIndex(_) => "delete_field_index",
37            },
38            CollectionUpdateOperations::VectorNameOperation(op) => match op {
39                VectorNameOperations::CreateVectorName(_) => "create_vector_name",
40                VectorNameOperations::DeleteVectorName(_) => "delete_vector_name",
41            },
42            #[cfg(feature = "staging")]
43            CollectionUpdateOperations::StagingOperation(_) => "debug",
44        }
45    }
46}