Skip to content

Commit 52d290a

Browse files
committed
Fix update_stats and add all tests
1 parent 43e66c3 commit 52d290a

File tree

4 files changed

+221
-65
lines changed

4 files changed

+221
-65
lines changed

optd-persistent/init.db

-144 KB
Binary file not shown.

optd-persistent/src/cost_model/interface.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ pub enum StatType {
4242
Max,
4343
}
4444

45+
#[derive(PartialEq)]
46+
pub enum EpochOption {
47+
// TODO(lanlou): Could I make i32 -> EpochId?
48+
Existed(i32),
49+
New(String, String),
50+
}
51+
52+
#[derive(Clone)]
4553
pub struct Stat {
4654
pub stat_type: i32,
4755
pub stat_value: Json,
@@ -72,7 +80,11 @@ pub trait CostModelStorageLayer {
7280
epoch_id: Self::EpochId,
7381
) -> StorageResult<()>;
7482

75-
async fn update_stats(&self, stat: Stat, epoch_id: Self::EpochId) -> StorageResult<()>;
83+
async fn update_stats(
84+
&mut self,
85+
stat: Stat,
86+
epoch_option: EpochOption,
87+
) -> StorageResult<Option<Self::EpochId>>;
7688

7789
async fn store_cost(
7890
&self,

0 commit comments

Comments
 (0)