Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move MetadataKind from node.proto to common.proto #2460

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions crates/core/protobuf/node_ctl_svc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ syntax = "proto3";

import "google/protobuf/empty.proto";
import "restate/common.proto";
import "restate/node.proto";

package restate.node_ctl_svc;

Expand Down Expand Up @@ -45,7 +44,7 @@ message GetMetadataRequest {
// If set, we'll first sync with metadata store to esnure we are returning the latest value.
// Otherwise, we'll return the local value on this node.
bool sync = 1;
restate.node.MetadataKind kind = 2;
restate.common.MetadataKind kind = 2;
}

message GetMetadataResponse {
Expand Down
8 changes: 8 additions & 0 deletions crates/types/protobuf/restate/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,11 @@ enum IngressStatus {
IngressStatus_READY = 1;
IngressStatus_STARTING_UP = 2;
}

enum MetadataKind {
MetadataKind_UNKNOWN = 0;
NODES_CONFIGURATION = 1;
SCHEMA = 2;
PARTITION_TABLE = 3;
LOGS = 4;
}
10 changes: 0 additions & 10 deletions crates/types/protobuf/restate/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,3 @@ message Message {
BinaryMessage encoded = 5;
}
}

// # Common node types

enum MetadataKind {
MetadataKind_UNKNOWN = 0;
NODES_CONFIGURATION = 1;
SCHEMA = 2;
PARTITION_TABLE = 3;
LOGS = 4;
}
18 changes: 10 additions & 8 deletions crates/types/src/net/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ define_message! {
IntoProto,
FromProto,
)]
#[proto(target = "crate::protobuf::node::MetadataKind")]
#[proto(target = "crate::protobuf::common::MetadataKind")]
pub enum MetadataKind {
NodesConfiguration,
Schema,
Expand All @@ -74,18 +74,20 @@ pub enum MetadataKind {
}

// todo remove once prost_dto supports TryFromProto
impl TryFrom<crate::protobuf::node::MetadataKind> for MetadataKind {
impl TryFrom<crate::protobuf::common::MetadataKind> for MetadataKind {
type Error = anyhow::Error;

fn try_from(value: crate::protobuf::node::MetadataKind) -> Result<Self, Self::Error> {
fn try_from(value: crate::protobuf::common::MetadataKind) -> Result<Self, Self::Error> {
match value {
crate::protobuf::node::MetadataKind::Unknown => bail!("unknown metadata kind"),
crate::protobuf::node::MetadataKind::NodesConfiguration => {
crate::protobuf::common::MetadataKind::Unknown => bail!("unknown metadata kind"),
crate::protobuf::common::MetadataKind::NodesConfiguration => {
Ok(MetadataKind::NodesConfiguration)
}
crate::protobuf::node::MetadataKind::Schema => Ok(MetadataKind::Schema),
crate::protobuf::node::MetadataKind::PartitionTable => Ok(MetadataKind::PartitionTable),
crate::protobuf::node::MetadataKind::Logs => Ok(MetadataKind::Logs),
crate::protobuf::common::MetadataKind::Schema => Ok(MetadataKind::Schema),
crate::protobuf::common::MetadataKind::PartitionTable => {
Ok(MetadataKind::PartitionTable)
}
crate::protobuf::common::MetadataKind::Logs => Ok(MetadataKind::Logs),
}
}
}
Expand Down
Loading