use std::sync::atomic::AtomicBool;
use crate::common::counter::hardware_accumulator::HwMeasurementAcc;
use crate::common::types::DeferredBehavior;
use crate::segment::common::operation_error::OperationResult;
use crate::segment::types::{ExtendedPointId, WithPayload, WithPayloadInterface, WithVector};
use crate::shard::retrieve::record_internal::RecordInternal;
use crate::shard::retrieve::retrieve_blocking::retrieve_over;
use crate::edge::read_view::{EdgeReadView, ReadSegmentHandle};
impl<H: ReadSegmentHandle> EdgeReadView<H> {
pub(crate) fn retrieve(
&self,
point_ids: &[ExtendedPointId],
with_payload: Option<WithPayloadInterface>,
with_vector: Option<WithVector>,
) -> OperationResult<Vec<RecordInternal>> {
let with_payload =
WithPayload::from(with_payload.unwrap_or(WithPayloadInterface::Bool(true)));
let with_vector = with_vector.unwrap_or(WithVector::Bool(false));
let mut points = retrieve_over(
self.segment_arcs(),
point_ids,
&with_payload,
&with_vector,
&AtomicBool::new(false),
HwMeasurementAcc::disposable_edge(),
DeferredBehavior::VisibleOnly,
)?;
let points: Vec<_> = point_ids
.iter()
.filter_map(|id| points.remove(id))
.collect();
Ok(points)
}
}