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