use std::sync::Arc;
use lance_core::Result;
use lance_io::object_store::ObjectStore;
use object_store::path::Path;
use serde::{Deserialize, Serialize};
use super::shuffler::{ShuffleReader, TwoFileShuffleReader};
#[doc(hidden)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TwoFileShuffleFixtureManifest {
pub num_partitions: usize,
pub num_flush_groups: u64,
pub partition_counts: Vec<u64>,
pub total_loss: f64,
}
#[doc(hidden)]
pub async fn open_two_file_shuffle_fixture(
output_dir: Path,
manifest: &TwoFileShuffleFixtureManifest,
) -> Result<Box<dyn ShuffleReader>> {
TwoFileShuffleReader::try_new(
Arc::new(ObjectStore::local()),
output_dir,
manifest.num_partitions,
manifest.num_flush_groups,
manifest.partition_counts.clone(),
manifest.total_loss,
)
.await
}