use std::sync::Arc; use std::time::Duration; use async_trait::async_trait; use common::counter::hardware_accumulator::HwMeasurementAcc; use segment::data_types::facets::{FacetParams, FacetResponse}; use segment::data_types::order_by::OrderBy; use segment::types::*; use tokio::runtime::Handle; use crate::operations::types::*; use crate::operations::universal_query::shard_query::{ShardQueryRequest, ShardQueryResponse}; use crate::operations::OperationWithClockTag; #[async_trait] pub trait ShardOperation { async fn update( &self, operation: OperationWithClockTag, wait: bool, ) -> CollectionResult; #[allow(clippy::too_many_arguments)] async fn scroll_by( &self, offset: Option, limit: usize, with_payload_interface: &WithPayloadInterface, with_vector: &WithVector, filter: Option<&Filter>, search_runtime_handle: &Handle, order_by: Option<&OrderBy>, timeout: Option, ) -> CollectionResult>; async fn info(&self) -> CollectionResult; async fn core_search( &self, request: Arc, search_runtime_handle: &Handle, timeout: Option, hw_measurement_acc: &HwMeasurementAcc, ) -> CollectionResult>>; async fn count( &self, request: Arc, search_runtime_handle: &Handle, timeout: Option, hw_measurement_acc: &HwMeasurementAcc, ) -> CollectionResult; async fn retrieve( &self, request: Arc, with_payload: &WithPayload, with_vector: &WithVector, search_runtime_handle: &Handle, timeout: Option, ) -> CollectionResult>; async fn query_batch( &self, requests: Arc>, search_runtime_handle: &Handle, timeout: Option, hw_measurement_acc: &HwMeasurementAcc, ) -> CollectionResult>; async fn facet( &self, request: Arc, search_runtime_handle: &Handle, timeout: Option, ) -> CollectionResult; } pub type ShardOperationSS = dyn ShardOperation + Send + Sync;