risingwave_meta_model/
actor_dispatcher.rs1use std::hash::Hash;
16
17use risingwave_pb::stream_plan::PbDispatcherType;
18use sea_orm::entity::prelude::*;
19use serde::{Deserialize, Serialize};
20
21#[derive(
22 Hash, Copy, Clone, Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize,
23)]
24#[sea_orm(rs_type = "String", db_type = "string(None)")]
25pub enum DispatcherType {
26 #[sea_orm(string_value = "HASH")]
27 Hash,
28 #[sea_orm(string_value = "BROADCAST")]
29 Broadcast,
30 #[sea_orm(string_value = "SIMPLE")]
31 Simple,
32 #[sea_orm(string_value = "NO_SHUFFLE")]
33 NoShuffle,
34}
35
36impl From<PbDispatcherType> for DispatcherType {
37 fn from(val: PbDispatcherType) -> Self {
38 match val {
39 PbDispatcherType::Unspecified => unreachable!(),
40 PbDispatcherType::Hash => DispatcherType::Hash,
41 PbDispatcherType::Broadcast => DispatcherType::Broadcast,
42 PbDispatcherType::Simple => DispatcherType::Simple,
43 PbDispatcherType::NoShuffle => DispatcherType::NoShuffle,
44 }
45 }
46}
47
48impl From<DispatcherType> for PbDispatcherType {
49 fn from(val: DispatcherType) -> Self {
50 match val {
51 DispatcherType::Hash => PbDispatcherType::Hash,
52 DispatcherType::Broadcast => PbDispatcherType::Broadcast,
53 DispatcherType::Simple => PbDispatcherType::Simple,
54 DispatcherType::NoShuffle => PbDispatcherType::NoShuffle,
55 }
56 }
57}