Files
qdrant/lib/edge/python/src/utils.rs
Daniel Boros d4cb6a58d9 feat/edge segment opt (#8224)
* feat: add edge shard optimize

* feat: refactor edge optimize logic

* chore: remove unused &self

* feat: add more tests

* fix: linter

* fix: missing threshold prop

* fix: local nightly version

* fix: linter

* fix: linter issues

* fix: use of explicit from

* feat: add some notes

* fix: feature_flags call once

* [manual] review refactor

* fix:
- default_segment_number -> move shard
- rename: default_hnsw_config -> hnsw_config
- infer existing hnsw_config

* feat: add optimize to python

* feat: add python optimize example

* feat: add hnsw config load tests

* fix: linter

* feat: make unified build config

* fix: linter

* fix: openapi definition'

* fix: review comments

* fix: remove mut self & reset_temp_segments_dir

* fix: linter

* review: rename for simpler public name + use explicit strucuture deconstruction

* clipy

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2026-03-06 18:47:15 +01:00

27 lines
702 B
Rust

use edge::EdgeShard;
use segment::common::operation_error::OperationError;
use crate::{PyEdgeShard, PyError};
impl PyEdgeShard {
pub fn get_shard(&self) -> Result<&EdgeShard, PyError> {
if let Some(shard) = &self.0 {
Ok(shard)
} else {
Err(PyError::from(OperationError::service_error(
"Shard is not initialized",
)))
}
}
pub fn get_shard_mut(&mut self) -> Result<&mut EdgeShard, PyError> {
if let Some(shard) = &mut self.0 {
Ok(shard)
} else {
Err(PyError::from(OperationError::service_error(
"Shard is not initialized",
)))
}
}
}