Skip to content

Commit

Permalink
refactor: move SecretRef to secret.proto (#17330)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhao-su authored Jun 19, 2024
1 parent 9bea5f3 commit 7309956
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 18 deletions.
16 changes: 3 additions & 13 deletions proto/catalog.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -84,7 +85,7 @@ message StreamSourceInfo {
map<string, string> 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<string, SecretRef> secret_ref = 16;
map<string, secret.SecretRef> secret_ref = 16;
}

message Source {
Expand Down Expand Up @@ -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<string, SecretRef> secret_ref = 25;
map<string, secret.SecretRef> secret_ref = 25;
}

message Subscription {
Expand Down Expand Up @@ -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;
}
11 changes: 11 additions & 0 deletions proto/secret.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion src/connector/src/sink/catalog/desc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
3 changes: 2 additions & 1 deletion src/connector/src/sink/catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/utils/with_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/meta/model_v2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion src/prost/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// 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)]")
Expand Down

0 comments on commit 7309956

Please sign in to comment.