mirror of
https://github.com/qdrant/qdrant.git
synced 2026-09-29 01:17:56 -05:00
Replace the mixed read interface (internal types, explicit parameter enumeration, ad-hoc custom types) with edge-owned request structs, one file per request in src/requests/. Each has a new() constructor taking only the required parameters, a no-macro fluent builder in src/builders/, and a From conversion into the internal request type in requests/conversions/, grouped by request type. Conversions construct and destructure with full field lists, so a parameter added on either side fails compilation instead of being silently dropped. The old reexport aliases (ScrollRequest = ScrollRequestInternal, etc.) are replaced by the edge types under the same names; retrieve() takes a RetrieveRequest instead of a parameter triple. Python bindings wrap the edge types, and the published Rust examples use the builders. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
36 lines
801 B
Rust
36 lines
801 B
Rust
use bytemuck::TransparentWrapper as _;
|
|
use derive_more::Into;
|
|
use edge::CountRequest;
|
|
use pyo3::prelude::*;
|
|
use segment::types::Filter;
|
|
|
|
use crate::repr::*;
|
|
use crate::types::PyFilter;
|
|
|
|
#[pyclass(name = "CountRequest", from_py_object)]
|
|
#[derive(Clone, Debug, Into)]
|
|
pub struct PyCountRequest(CountRequest);
|
|
|
|
#[pyclass_repr]
|
|
#[pymethods]
|
|
impl PyCountRequest {
|
|
#[new]
|
|
#[pyo3(signature = (exact = true, filter = None))]
|
|
pub fn new(exact: bool, filter: Option<PyFilter>) -> Self {
|
|
Self(CountRequest {
|
|
filter: filter.map(Filter::from),
|
|
exact,
|
|
})
|
|
}
|
|
|
|
#[getter]
|
|
pub fn filter(&self) -> Option<&PyFilter> {
|
|
self.0.filter.as_ref().map(PyFilter::wrap_ref)
|
|
}
|
|
|
|
#[getter]
|
|
pub fn exact(&self) -> bool {
|
|
self.0.exact
|
|
}
|
|
}
|