risingwave_meta_model/
compaction_task.rs1use risingwave_pb::hummock::{CompactTask as PbCompactTask, CompactTaskAssignment};
16use sea_orm::entity::prelude::*;
17
18use crate::{CompactionTaskId, WorkerId};
19
20#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
21#[sea_orm(table_name = "compaction_task")]
22pub struct Model {
23 #[sea_orm(primary_key, auto_increment = false)]
24 pub id: CompactionTaskId,
25 pub task: CompactionTask,
26 pub context_id: WorkerId,
27}
28
29#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
30pub enum Relation {}
31
32impl ActiveModelBehavior for ActiveModel {}
33
34crate::derive_from_blob!(CompactionTask, PbCompactTask);
35
36impl From<Model> for CompactTaskAssignment {
37 fn from(value: Model) -> Self {
38 Self {
39 compact_task: Some(value.task.to_protobuf()),
40 context_id: value.context_id as _,
41 }
42 }
43}