Skip to content

Commit

Permalink
Replaced redundant calls to format.
Browse files Browse the repository at this point in the history
  • Loading branch information
christos-h committed Nov 11, 2024
1 parent 57d8c7b commit c811bb2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion linera-rpc/src/grpc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ where
receiver
.for_each_concurrent(max_concurrent_tasks, |(cross_chain_request, shard_id)| {
let shard = network.shard(shard_id);
let remote_address = format!("http://{}", shard.address());
let remote_address = shard.http_address();

let pool = pool.clone();
let nickname = nickname.clone();
Expand Down
12 changes: 6 additions & 6 deletions linera-storage-service/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ impl AdminKeyValueStore for ServiceStoreClientInternal {
namespace: &str,
root_key: &[u8],
) -> Result<Self, ServiceStoreError> {
let endpoint = format!("http://{}", config.endpoint);
let endpoint = config.http_address();
let endpoint = Endpoint::from_shared(endpoint)?;
let channel = endpoint.connect_lazy();
let semaphore = config
Expand Down Expand Up @@ -426,7 +426,7 @@ impl AdminKeyValueStore for ServiceStoreClientInternal {
async fn list_all(config: &Self::Config) -> Result<Vec<String>, ServiceStoreError> {
let query = RequestListAll {};
let request = tonic::Request::new(query);
let endpoint = format!("http://{}", config.endpoint);
let endpoint = config.http_address();
let endpoint = Endpoint::from_shared(endpoint)?;
let mut client = StoreProcessorClient::connect(endpoint).await?;
let response = client.process_list_all(request).await?;
Expand All @@ -442,7 +442,7 @@ impl AdminKeyValueStore for ServiceStoreClientInternal {
async fn delete_all(config: &Self::Config) -> Result<(), ServiceStoreError> {
let query = RequestDeleteAll {};
let request = tonic::Request::new(query);
let endpoint = format!("http://{}", config.endpoint);
let endpoint = config.http_address();
let endpoint = Endpoint::from_shared(endpoint)?;
let mut client = StoreProcessorClient::connect(endpoint).await?;
let _response = client.process_delete_all(request).await?;
Expand All @@ -453,7 +453,7 @@ impl AdminKeyValueStore for ServiceStoreClientInternal {
let namespace = bcs::to_bytes(namespace)?;
let query = RequestExistsNamespace { namespace };
let request = tonic::Request::new(query);
let endpoint = format!("http://{}", config.endpoint);
let endpoint = config.http_address();
let endpoint = Endpoint::from_shared(endpoint)?;
let mut client = StoreProcessorClient::connect(endpoint).await?;
let response = client.process_exists_namespace(request).await?;
Expand All @@ -466,7 +466,7 @@ impl AdminKeyValueStore for ServiceStoreClientInternal {
let namespace = bcs::to_bytes(namespace)?;
let query = RequestCreateNamespace { namespace };
let request = tonic::Request::new(query);
let endpoint = format!("http://{}", config.endpoint);
let endpoint = config.http_address();
let endpoint = Endpoint::from_shared(endpoint)?;
let mut client = StoreProcessorClient::connect(endpoint).await?;
let _response = client.process_create_namespace(request).await?;
Expand All @@ -477,7 +477,7 @@ impl AdminKeyValueStore for ServiceStoreClientInternal {
let namespace = bcs::to_bytes(namespace)?;
let query = RequestDeleteNamespace { namespace };
let request = tonic::Request::new(query);
let endpoint = format!("http://{}", config.endpoint);
let endpoint = config.http_address();
let endpoint = Endpoint::from_shared(endpoint)?;
let mut client = StoreProcessorClient::connect(endpoint).await?;
let _response = client.process_delete_namespace(request).await?;
Expand Down
8 changes: 7 additions & 1 deletion linera-storage-service/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,17 @@ pub(crate) static LRU_STORAGE_SERVICE_METRICS: LazyLock<KeyValueStoreMetrics> =
#[derive(Debug, Clone)]
pub struct ServiceStoreConfig {
/// The endpoint used by the shared store
pub endpoint: String,
endpoint: String,
/// The common configuration of the key value store
pub common_config: CommonStoreConfig,
}

impl ServiceStoreConfig {
pub fn http_address(&self) -> String {
format!("http://{}", self.endpoint)
}
}

/// Obtains the binary of the executable.
/// The path depends whether the test are run in the directory "linera-storage-service"
/// or in the main directory
Expand Down

0 comments on commit c811bb2

Please sign in to comment.