-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This introduces `MetadataManager`, a node-level service that provides uniform access to different metadata kinds. This PR focuses on the nodes configuration only. `Metadata` is a cheaply cloneable handle that components can use to access metadata. `MetadataWriter` is only shared with components that can propose updates to the cached metadata. Additionally, this changes the node startup procedure to be one step closer to the original design. Worker attachment is only concerned with partition assignment and node IDs are directly fetched from NodesConfiguration. In this, nodes configuration will be statically created on startup if the bootstrap_cluster option is set (set by default at the moment). The server will fail to start if this is unset until we implement fetching nodes configuration from metadata store. The admin_address is not used anymore on startup but will be replaced with metadata address later for remote nodes config fetching.
- Loading branch information
1 parent
f243ab2
commit 3e9a4cb
Showing
14 changed files
with
673 additions
and
165 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) 2024 - 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 std::time::Duration; | ||
|
||
use http::Uri; | ||
use restate_types::nodes_config::AdvertisedAddress; | ||
use tokio::net::UnixStream; | ||
use tonic::transport::{Channel, Endpoint}; | ||
use tower::service_fn; | ||
|
||
pub fn create_grpc_channel_from_network_address( | ||
address: AdvertisedAddress, | ||
) -> Result<Channel, http::Error> { | ||
let channel = match address { | ||
AdvertisedAddress::Uds(uds_path) => { | ||
// dummy endpoint required to specify an uds connector, it is not used anywhere | ||
Endpoint::try_from("/") | ||
.expect("/ should be a valid Uri") | ||
.connect_with_connector_lazy(service_fn(move |_: Uri| { | ||
UnixStream::connect(uds_path.clone()) | ||
})) | ||
} | ||
AdvertisedAddress::Http(uri) => { | ||
// todo: Make the channel settings configurable | ||
Channel::builder(uri) | ||
.connect_timeout(Duration::from_secs(5)) | ||
.connect_lazy() | ||
} | ||
}; | ||
Ok(channel) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.