pub trait BenchmarkRepositoryPort: Send + Sync {
// Required methods
fn create_run<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
run_type: BenchmarkRunType,
model_ids: &'life1 [i64],
prompt_text: Option<&'life2 str>,
system_prompt: Option<&'life3 str>,
config_json: Option<&'life4 str>,
) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn complete_run<'life0, 'async_trait>(
&'life0 self,
run_id: i64,
) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn fail_run<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: i64,
error: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn save_compare_result<'life0, 'life1, 'async_trait>(
&'life0 self,
result: &'life1 ModelCompareResult,
run_id: i64,
) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn save_perf_result<'life0, 'life1, 'async_trait>(
&'life0 self,
result: &'life1 ModelPerfResult,
run_id: i64,
) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_runs<'life0, 'async_trait>(
&'life0 self,
limit: i64,
offset: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<BenchmarkRun>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_run<'life0, 'async_trait>(
&'life0 self,
run_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<BenchmarkRun>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_model_compare_history<'life0, 'async_trait>(
&'life0 self,
model_id: i64,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelCompareResult>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_model_perf_history<'life0, 'async_trait>(
&'life0 self,
model_id: i64,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelPerfResult>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_model_summary<'life0, 'async_trait>(
&'life0 self,
model_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<ModelBenchmarkSummary>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn save_tune_result<'life0, 'life1, 'async_trait>(
&'life0 self,
result: &'life1 TuneCandidateResult,
run_id: i64,
model_id: i64,
) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_model_tune_history<'life0, 'async_trait>(
&'life0 self,
model_id: i64,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<TuneCandidateResult>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Repository interface for benchmark persistence.
Implementations are responsible for:
- Creating and updating run records
- Storing per-model compare and perf results
- Upserting
model_benchmark_summariesin the same transaction as each result save, so the model list query always has fresh summary data without extra round-trips
Required Methods§
Sourcefn create_run<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
run_type: BenchmarkRunType,
model_ids: &'life1 [i64],
prompt_text: Option<&'life2 str>,
system_prompt: Option<&'life3 str>,
config_json: Option<&'life4 str>,
) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn create_run<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
run_type: BenchmarkRunType,
model_ids: &'life1 [i64],
prompt_text: Option<&'life2 str>,
system_prompt: Option<&'life3 str>,
config_json: Option<&'life4 str>,
) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Create a new benchmark run record in Running status.
Returns the auto-assigned run ID.
Sourcefn complete_run<'life0, 'async_trait>(
&'life0 self,
run_id: i64,
) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete_run<'life0, 'async_trait>(
&'life0 self,
run_id: i64,
) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Mark a run as Complete and record the completion timestamp.
Sourcefn fail_run<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: i64,
error: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fail_run<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: i64,
error: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Mark a run as Failed and record the error message.
Sourcefn save_compare_result<'life0, 'life1, 'async_trait>(
&'life0 self,
result: &'life1 ModelCompareResult,
run_id: i64,
) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_compare_result<'life0, 'life1, 'async_trait>(
&'life0 self,
result: &'life1 ModelCompareResult,
run_id: i64,
) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persist a compare result and upsert the model’s benchmark summary.
Both the result INSERT and the summary upsert happen in the same database transaction to keep the denormalised summary consistent.
Returns the auto-assigned result ID.
Sourcefn save_perf_result<'life0, 'life1, 'async_trait>(
&'life0 self,
result: &'life1 ModelPerfResult,
run_id: i64,
) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_perf_result<'life0, 'life1, 'async_trait>(
&'life0 self,
result: &'life1 ModelPerfResult,
run_id: i64,
) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persist a perf result and upsert the model’s benchmark summary.
Both the result INSERT and the summary upsert happen in the same database transaction to keep the denormalised summary consistent.
Returns the auto-assigned result ID.
Sourcefn list_runs<'life0, 'async_trait>(
&'life0 self,
limit: i64,
offset: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<BenchmarkRun>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_runs<'life0, 'async_trait>(
&'life0 self,
limit: i64,
offset: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<BenchmarkRun>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List benchmark runs, most recent first.
Sourcefn get_run<'life0, 'async_trait>(
&'life0 self,
run_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<BenchmarkRun>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_run<'life0, 'async_trait>(
&'life0 self,
run_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<BenchmarkRun>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get a single benchmark run by ID.
Sourcefn get_model_compare_history<'life0, 'async_trait>(
&'life0 self,
model_id: i64,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelCompareResult>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_model_compare_history<'life0, 'async_trait>(
&'life0 self,
model_id: i64,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelCompareResult>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get compare results for one model, most recent first.
Sourcefn get_model_perf_history<'life0, 'async_trait>(
&'life0 self,
model_id: i64,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelPerfResult>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_model_perf_history<'life0, 'async_trait>(
&'life0 self,
model_id: i64,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelPerfResult>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get perf results for one model, most recent first.
Sourcefn get_model_summary<'life0, 'async_trait>(
&'life0 self,
model_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<ModelBenchmarkSummary>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_model_summary<'life0, 'async_trait>(
&'life0 self,
model_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<ModelBenchmarkSummary>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the denormalised benchmark summary for one model.
Returns None if no benchmark has been run for this model.
Sourcefn save_tune_result<'life0, 'life1, 'async_trait>(
&'life0 self,
result: &'life1 TuneCandidateResult,
run_id: i64,
model_id: i64,
) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_tune_result<'life0, 'life1, 'async_trait>(
&'life0 self,
result: &'life1 TuneCandidateResult,
run_id: i64,
model_id: i64,
) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persist one tune candidate’s result.
Unlike compare/perf, tune results do not upsert
model_benchmark_summaries — a candidate’s composite_score is only
meaningful relative to the other candidates in the same run, so it is
not a useful cross-run “best” figure to denormalise.
Returns the auto-assigned result ID.
Sourcefn get_model_tune_history<'life0, 'async_trait>(
&'life0 self,
model_id: i64,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<TuneCandidateResult>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_model_tune_history<'life0, 'async_trait>(
&'life0 self,
model_id: i64,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<TuneCandidateResult>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get tune candidate results for one model, most recent first.