risingwave_meta_model/
hummock_pinned_version.rs1use risingwave_pb::hummock::HummockPinnedVersion;
16use sea_orm::entity::prelude::*;
17use serde::{Deserialize, Serialize};
18
19use crate::{HummockVersionId, WorkerId};
20
21#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize, Default)]
22#[sea_orm(table_name = "hummock_pinned_version")]
23pub struct Model {
24 #[sea_orm(primary_key, auto_increment = false)]
25 pub context_id: WorkerId,
26 pub min_pinned_id: HummockVersionId,
27}
28
29#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
30pub enum Relation {}
31
32impl ActiveModelBehavior for ActiveModel {}
33
34impl From<Model> for HummockPinnedVersion {
35 fn from(value: Model) -> Self {
36 Self {
37 context_id: value.context_id as _,
38 min_pinned_id: value.min_pinned_id as _,
39 }
40 }
41}