Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
196 changes: 0 additions & 196 deletions diskann-benchmark-runner/src/any.rs

This file was deleted.

6 changes: 3 additions & 3 deletions diskann-benchmark-runner/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,12 @@ impl App {
let serialized = jobs
.iter()
.map(|job| {
serde_json::to_value(jobs::Unprocessed::new(
Ok(serde_json::to_value(jobs::Unprocessed::new(
job.tag().into(),
job.serialize()?,
))
))?)
})
.collect::<Result<Vec<_>, serde_json::Error>>()?;
.collect::<anyhow::Result<Vec<_>>>()?;
for (i, job) in jobs.iter().enumerate() {
let prefix: &str = if i != 0 { "\n\n" } else { "" };
writeln!(
Expand Down
10 changes: 6 additions & 4 deletions diskann-benchmark-runner/src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use serde::{Deserialize, Serialize};

use crate::{Any, Checkpoint, Input, Output};
use crate::{Checkpoint, Input, Output};

/// A registered benchmark.
///
Expand Down Expand Up @@ -134,6 +134,8 @@ pub enum PassFail<P, F> {
pub(crate) mod internal {
use super::*;

use crate::input::internal::Any;

use anyhow::Context;
use thiserror::Error;

Expand Down Expand Up @@ -179,7 +181,7 @@ pub(crate) mod internal {
pub(crate) type CheckedPassFail = PassFail<Checked, Checked>;

pub(crate) trait Regression {
fn tolerance(&self) -> &dyn crate::input::DynInput;
fn tolerance(&self) -> &dyn crate::input::internal::DynInput;
fn input_tag(&self) -> &'static str;
fn check(
&self,
Expand Down Expand Up @@ -228,8 +230,8 @@ pub(crate) mod internal {
where
T: super::Regression,
{
fn tolerance(&self) -> &dyn crate::input::DynInput {
&crate::input::Wrapper::<T::Tolerances>::INSTANCE
fn tolerance(&self) -> &dyn crate::input::internal::DynInput {
&crate::input::internal::Wrapper::<T::Tolerances>::INSTANCE
}

fn input_tag(&self) -> &'static str {
Expand Down
33 changes: 0 additions & 33 deletions diskann-benchmark-runner/src/checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use std::{
path::{Path, PathBuf},
};

use crate::Any;

/// Shared context for resolving input and output files paths post deserialization.
#[derive(Debug)]
pub struct Checker {
Expand All @@ -29,12 +27,6 @@ pub struct Checker {
///
/// This ensures that each job uses a distinct output directory to avoid conflicts.
current_outputs: HashSet<PathBuf>,

/// This crate-private variable is used to store the current input deserialization
/// tag and is referenced when creating new `Any` objects.
///
/// Ensure that the correct tag is present before invoking [`Input::try_deserialize`].
tag: Option<&'static str>,
}

impl Checker {
Expand All @@ -44,23 +36,9 @@ impl Checker {
search_directories,
output_directory,
current_outputs: HashSet::new(),
tag: None,
}
}

/// Invoke [`CheckDeserialization`] on `value` and if successful, package it in [`Any`].
pub fn any<T>(&mut self, mut value: T) -> anyhow::Result<Any>
where
T: serde::Serialize + CheckDeserialization + std::fmt::Debug + 'static,
{
value.check_deserialization(self)?;
#[expect(
clippy::expect_used,
reason = "crate infrastructure ensures an untagged Checker is not leaked"
)]
Ok(Any::new(value, self.tag.expect("tag must be set")))
}

/// Return the ordered list of search directories registered with the [`Checker`].
pub fn search_directories(&self) -> &[PathBuf] {
&self.search_directories
Expand Down Expand Up @@ -167,17 +145,6 @@ impl Checker {
self.search_directories(),
)))
}

pub(crate) fn set_tag(&mut self, tag: &'static str) {
let _ = self.tag.insert(tag);
}
}

/// Perform post-process resolution of input and output files paths.
pub trait CheckDeserialization {
/// Perform any necessary resolution of file paths, returning an error if a problem is
/// discovered.
fn check_deserialization(&mut self, checker: &mut Checker) -> Result<(), anyhow::Error>;
}

///////////
Expand Down
Loading
Loading