risingwave_meta_model/
hummock_version_delta.rs1use risingwave_pb::hummock::PbHummockVersionDelta;
16use sea_orm::entity::prelude::*;
17
18use crate::{Epoch, HummockVersionId};
19
20#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
21#[sea_orm(table_name = "hummock_version_delta")]
22pub struct Model {
23 #[sea_orm(primary_key, auto_increment = false)]
24 pub id: HummockVersionId,
25 pub prev_id: HummockVersionId,
26 pub max_committed_epoch: Epoch,
27 pub safe_epoch: Epoch,
28 pub trivial_move: bool,
29 pub full_version_delta: FullVersionDelta,
30}
31
32#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
33pub enum Relation {}
34
35impl ActiveModelBehavior for ActiveModel {}
36
37crate::derive_from_blob!(FullVersionDelta, PbHummockVersionDelta);
38
39impl From<Model> for PbHummockVersionDelta {
40 fn from(value: Model) -> Self {
41 let ret = value.full_version_delta.to_protobuf();
42 assert_eq!(value.id, ret.id as i64);
43 assert_eq!(value.prev_id, ret.prev_id as i64);
44 assert_eq!(value.trivial_move, ret.trivial_move);
45 ret
46 }
47}