Skip to content

Commit

Permalink
Cluster state types
Browse files Browse the repository at this point in the history
Summary:
Types used by nodes to share cluster state
  • Loading branch information
muhamadazmy committed Dec 20, 2024
1 parent 9a553d2 commit cba8ee9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions crates/types/protobuf/restate/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ enum TargetName {
// Node
NODE_GET_PARTITIONS_PROCESSORS_STATE_REQUEST = 60;
NODE_GET_PARTITIONS_PROCESSORS_STATE_RESPONSE = 61;
NODE_PING = 62;
NODE_PONG = 63;

// Remote Scanner
REMOTE_QUERY_SCANNER_OPEN = 80;
Expand Down
1 change: 0 additions & 1 deletion crates/types/src/cluster/cluster_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ impl ClusterState {
})
}

#[cfg(any(test, feature = "test-util"))]
pub fn empty() -> Self {
ClusterState {
last_refreshed: None,
Expand Down
28 changes: 28 additions & 0 deletions crates/types/src/net/cluster_state.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) 2023 - 2025 Restate Software, Inc., Restate GmbH.
// All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0.

use super::{define_rpc, TargetName};
use serde::{Deserialize, Serialize};

define_rpc! {
@request= NodePing,
@response= NodePong,
@request_target=TargetName::NodePing,
@response_target=TargetName::NodePong,
}

/// Gossip Push message. Is pushed from each node to every other known node
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NodePing {
//todo(azmy): share latest metadata versions?
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NodePong {}
1 change: 1 addition & 0 deletions crates/types/src/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0.

pub mod cluster_state;
pub mod codec;
mod error;
pub mod log_server;
Expand Down

0 comments on commit cba8ee9

Please sign in to comment.