From 73099567ae7b0e03606e4994208f1b1eed6944ef Mon Sep 17 00:00:00 2001 From: Yuhao Su <31772373+yuhao-su@users.noreply.github.com> Date: Tue, 18 Jun 2024 22:02:56 -0500 Subject: [PATCH] refactor: move SecretRef to secret.proto (#17330) --- proto/catalog.proto | 16 +++------------- proto/secret.proto | 11 +++++++++++ src/connector/src/sink/catalog/desc.rs | 2 +- src/connector/src/sink/catalog/mod.rs | 3 ++- src/frontend/src/utils/with_options.rs | 2 +- src/meta/model_v2/src/lib.rs | 3 ++- src/prost/build.rs | 2 +- 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/proto/catalog.proto b/proto/catalog.proto index c9eedf93f41b..86881c9bc547 100644 --- a/proto/catalog.proto +++ b/proto/catalog.proto @@ -6,6 +6,7 @@ import "common.proto"; import "data.proto"; import "expr.proto"; import "plan_common.proto"; +import "secret.proto"; option java_package = "com.risingwave.proto"; option optimize_for = SPEED; @@ -84,7 +85,7 @@ message StreamSourceInfo { map format_encode_options = 14; // Handle the source relies on any sceret. The key is the propertity name and the value is the secret id and type. - map secret_ref = 16; + map secret_ref = 16; } message Source { @@ -181,7 +182,7 @@ message Sink { CreateType create_type = 24; // Handle the sink relies on any sceret. The key is the propertity name and the value is the secret id and type. - map secret_ref = 25; + map secret_ref = 25; } message Subscription { @@ -450,14 +451,3 @@ message Secret { uint32 owner = 5; uint32 schema_id = 6; } - -message SecretRef { - enum RefAsType { - UNSPECIFIED = 0; - TEXT = 1; - // AS FILE - FILE = 2; - } - uint32 secret_id = 1; - RefAsType ref_as = 2; -} diff --git a/proto/secret.proto b/proto/secret.proto index f5065009519f..8e4e1b228d6c 100644 --- a/proto/secret.proto +++ b/proto/secret.proto @@ -18,3 +18,14 @@ message Secret { SecretHashicropValutBackend hashicorp_vault = 2; } } + +message SecretRef { + enum RefAsType { + UNSPECIFIED = 0; + TEXT = 1; + // AS FILE + FILE = 2; + } + uint32 secret_id = 1; + RefAsType ref_as = 2; +} diff --git a/src/connector/src/sink/catalog/desc.rs b/src/connector/src/sink/catalog/desc.rs index 380cce6a8ebe..62ea42b4727b 100644 --- a/src/connector/src/sink/catalog/desc.rs +++ b/src/connector/src/sink/catalog/desc.rs @@ -19,7 +19,7 @@ use risingwave_common::catalog::{ ColumnCatalog, ConnectionId, CreateType, DatabaseId, SchemaId, TableId, UserId, }; use risingwave_common::util::sort_util::ColumnOrder; -use risingwave_pb::catalog::PbSecretRef; +use risingwave_pb::secret::PbSecretRef; use risingwave_pb::stream_plan::PbSinkDesc; use super::{SinkCatalog, SinkFormatDesc, SinkId, SinkType}; diff --git a/src/connector/src/sink/catalog/mod.rs b/src/connector/src/sink/catalog/mod.rs index 206236970d91..5adda694703c 100644 --- a/src/connector/src/sink/catalog/mod.rs +++ b/src/connector/src/sink/catalog/mod.rs @@ -25,8 +25,9 @@ use risingwave_common::catalog::{ use risingwave_common::util::epoch::Epoch; use risingwave_common::util::sort_util::ColumnOrder; use risingwave_pb::catalog::{ - PbCreateType, PbSecretRef, PbSink, PbSinkFormatDesc, PbSinkType, PbStreamJobStatus, + PbCreateType, PbSink, PbSinkFormatDesc, PbSinkType, PbStreamJobStatus, }; +use risingwave_pb::secret::PbSecretRef; use super::{ SinkError, CONNECTOR_TYPE_KEY, SINK_TYPE_APPEND_ONLY, SINK_TYPE_DEBEZIUM, SINK_TYPE_OPTION, diff --git a/src/frontend/src/utils/with_options.rs b/src/frontend/src/utils/with_options.rs index 8f372b58b17e..92c65786afde 100644 --- a/src/frontend/src/utils/with_options.rs +++ b/src/frontend/src/utils/with_options.rs @@ -19,7 +19,7 @@ use risingwave_connector::source::kafka::private_link::{ insert_privatelink_broker_rewrite_map, CONNECTION_NAME_KEY, PRIVATELINK_ENDPOINT_KEY, }; use risingwave_connector::WithPropertiesExt; -use risingwave_pb::catalog::PbSecretRef; +use risingwave_pb::secret::PbSecretRef; use risingwave_sqlparser::ast::{ CreateConnectionStatement, CreateSinkStatement, CreateSourceStatement, CreateSubscriptionStatement, SqlOption, Statement, Value, diff --git a/src/meta/model_v2/src/lib.rs b/src/meta/model_v2/src/lib.rs index 116cb66cab1d..751ae99b64a1 100644 --- a/src/meta/model_v2/src/lib.rs +++ b/src/meta/model_v2/src/lib.rs @@ -14,8 +14,9 @@ use std::collections::BTreeMap; -use risingwave_pb::catalog::{PbCreateType, PbSecretRef, PbStreamJobStatus}; +use risingwave_pb::catalog::{PbCreateType, PbStreamJobStatus}; use risingwave_pb::meta::table_fragments::PbState as PbStreamJobState; +use risingwave_pb::secret::PbSecretRef; use risingwave_pb::stream_plan::PbStreamNode; use sea_orm::entity::prelude::*; use sea_orm::{DeriveActiveEnum, EnumIter, FromJsonQueryResult}; diff --git a/src/prost/build.rs b/src/prost/build.rs index 4e939f46abb6..6d31201fa473 100644 --- a/src/prost/build.rs +++ b/src/prost/build.rs @@ -112,7 +112,7 @@ fn main() -> Result<(), Box> { // The requirement is from Source node -> SourceCatalog -> WatermarkDesc -> expr .type_attribute("catalog.WatermarkDesc", "#[derive(Eq, Hash)]") .type_attribute("catalog.StreamSourceInfo", "#[derive(Eq, Hash)]") - .type_attribute("catalog.SecretRef", "#[derive(Eq, Hash)]") + .type_attribute("secret.SecretRef", "#[derive(Eq, Hash)]") .type_attribute("catalog.IndexColumnProperties", "#[derive(Eq, Hash)]") .type_attribute("expr.ExprNode", "#[derive(Eq, Hash)]") .type_attribute("data.DataType", "#[derive(Eq, Hash)]")