Skip to content

Commit 53ce0ab

Browse files
committed
Rename to global instances
Signed-off-by: Xuanwo <github@xuanwo.io>
1 parent 17fadaf commit 53ce0ab

File tree

18 files changed

+52
-52
lines changed

18 files changed

+52
-52
lines changed

src/common/base/src/base/global_runtime.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::sync::Arc;
1616

1717
use common_exception::Result;
1818

19-
use super::Global;
19+
use super::GlobalInstance;
2020
use crate::base::Runtime;
2121

2222
pub struct GlobalIORuntime;
@@ -26,14 +26,14 @@ impl GlobalIORuntime {
2626
let thread_num = std::cmp::max(num_cpus, num_cpus::get() / 2);
2727
let thread_num = std::cmp::max(2, thread_num);
2828

29-
Global::set(Arc::new(Runtime::with_worker_threads(
29+
GlobalInstance::set(Arc::new(Runtime::with_worker_threads(
3030
thread_num,
3131
Some("IO-worker".to_owned()),
3232
)?));
3333
Ok(())
3434
}
3535

3636
pub fn instance() -> Arc<Runtime> {
37-
Global::get()
37+
GlobalInstance::get()
3838
}
3939
}

src/common/base/src/base/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub use shutdown_signal::signal_stream;
4949
pub use shutdown_signal::DummySignalStream;
5050
pub use shutdown_signal::SignalStream;
5151
pub use shutdown_signal::SignalType;
52-
pub use singleton_instance::Global;
52+
pub use singleton_instance::GlobalInstance;
5353
pub use stop_handle::StopHandle;
5454
pub use stoppable::Stoppable;
5555
pub use string_func::escape_for_key;

src/common/base/src/base/singleton_instance.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ impl Debug for Singleton {
8989
static GLOBAL: OnceCell<Singleton> = OnceCell::new();
9090

9191
/// Global is an empty struct that only used to carry associated functions.
92-
pub struct Global;
92+
pub struct GlobalInstance;
9393

94-
impl Global {
94+
impl GlobalInstance {
9595
/// init production global data registry.
9696
///
9797
/// Should only be initiated once.

src/common/storage/src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::sync::Arc;
2121
use common_auth::RefreshableToken;
2222
use common_auth::TokenFile;
2323
use common_base::base::tokio::sync::RwLock;
24-
use common_base::base::Global;
24+
use common_base::base::GlobalInstance;
2525
use serde::Deserialize;
2626
use serde::Serialize;
2727

@@ -508,7 +508,7 @@ impl ShareTableConfig {
508508
token_file: &str,
509509
default_token: String,
510510
) -> common_exception::Result<()> {
511-
Global::set(Self::try_create(
511+
GlobalInstance::set(Self::try_create(
512512
share_endpoint_address,
513513
token_file,
514514
default_token,
@@ -549,6 +549,6 @@ impl ShareTableConfig {
549549
}
550550

551551
pub fn instance() -> ShareTableConfig {
552-
Global::get()
552+
GlobalInstance::get()
553553
}
554554
}

src/common/storage/src/operator.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use std::time::Duration;
2020

2121
use anyhow::anyhow;
2222
use backon::ExponentialBackoff;
23-
use common_base::base::Global;
2423
use common_base::base::GlobalIORuntime;
24+
use common_base::base::GlobalInstance;
2525
use common_base::base::TrySpawn;
2626
use common_exception::ErrorCode;
2727
use opendal::layers::ImmutableIndexLayer;
@@ -341,7 +341,7 @@ impl DataOperator {
341341
}
342342

343343
pub async fn init(conf: &StorageConfig) -> common_exception::Result<()> {
344-
Global::set(Self::try_create(&conf.params).await?);
344+
GlobalInstance::set(Self::try_create(&conf.params).await?);
345345

346346
Ok(())
347347
}
@@ -373,7 +373,7 @@ impl DataOperator {
373373
}
374374

375375
pub fn instance() -> DataOperator {
376-
Global::get()
376+
GlobalInstance::get()
377377
}
378378
}
379379

@@ -392,7 +392,7 @@ pub struct CacheOperator {
392392

393393
impl CacheOperator {
394394
pub async fn init(conf: &CacheConfig) -> common_exception::Result<()> {
395-
Global::set(Self::try_create(conf).await?);
395+
GlobalInstance::set(Self::try_create(conf).await?);
396396

397397
Ok(())
398398
}
@@ -443,7 +443,7 @@ impl CacheOperator {
443443
}
444444

445445
pub fn instance() -> Option<Operator> {
446-
let v: CacheOperator = Global::get();
446+
let v: CacheOperator = GlobalInstance::get();
447447
v.inner()
448448
}
449449

src/common/tracing/src/logging.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::env;
1616
use std::io;
1717
use std::sync::Arc;
1818

19-
use common_base::base::Global;
19+
use common_base::base::GlobalInstance;
2020
use common_exception::Result;
2121
use opentelemetry::global;
2222
use opentelemetry::sdk::propagation::TraceContextPropagator;
@@ -261,7 +261,7 @@ impl QueryLogger {
261261
let mut _log_guards = init_logging(app_name.as_str(), config);
262262
let query_detail_dir = format!("{}/query-detail", config.file.dir);
263263

264-
Global::set(match config.file.on {
264+
GlobalInstance::set(match config.file.on {
265265
true => {
266266
let (_guards, subscriber) = init_query_logger(&app_name_shuffle, &query_detail_dir);
267267
_log_guards.extend(_guards);
@@ -281,7 +281,7 @@ impl QueryLogger {
281281
}
282282

283283
pub fn instance() -> Arc<QueryLogger> {
284-
Global::get()
284+
GlobalInstance::get()
285285
}
286286

287287
pub fn get_subscriber(&self) -> Option<Arc<dyn Subscriber + Send + Sync>> {

src/query/catalog/src/catalog/manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use std::sync::Arc;
1616

17-
use common_base::base::Global;
17+
use common_base::base::GlobalInstance;
1818
use common_exception::ErrorCode;
1919
use common_exception::Result;
2020
use dashmap::mapref::entry::Entry;
@@ -38,7 +38,7 @@ impl CatalogManager {
3838
}
3939

4040
pub fn instance() -> Arc<CatalogManager> {
41-
Global::get()
41+
GlobalInstance::get()
4242
}
4343

4444
pub fn insert_catalog(

src/query/config/src/global.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use std::sync::Arc;
1616

17-
use common_base::base::Global;
17+
use common_base::base::GlobalInstance;
1818
use common_exception::Result;
1919

2020
use crate::Config;
@@ -23,11 +23,11 @@ pub struct GlobalConfig;
2323

2424
impl GlobalConfig {
2525
pub fn init(config: Config) -> Result<()> {
26-
Global::set(Arc::new(config));
26+
GlobalInstance::set(Arc::new(config));
2727
Ok(())
2828
}
2929

3030
pub fn instance() -> Arc<Config> {
31-
Global::get()
31+
GlobalInstance::get()
3232
}
3333
}

src/query/service/src/api/rpc/exchange/exchange_manager.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use std::ops::Deref;
1919
use std::sync::Arc;
2020

2121
use common_arrow::arrow_format::flight::service::flight_service_client::FlightServiceClient;
22-
use common_base::base::Global;
2322
use common_base::base::GlobalIORuntime;
23+
use common_base::base::GlobalInstance;
2424
use common_base::base::Thread;
2525
use common_base::base::TrySpawn;
2626
use common_config::GlobalConfig;
@@ -63,15 +63,15 @@ pub struct DataExchangeManager {
6363

6464
impl DataExchangeManager {
6565
pub fn init() -> Result<()> {
66-
Global::set(Arc::new(DataExchangeManager {
66+
GlobalInstance::set(Arc::new(DataExchangeManager {
6767
queries_coordinator: ReentrantMutex::new(SyncUnsafeCell::new(HashMap::new())),
6868
}));
6969

7070
Ok(())
7171
}
7272

7373
pub fn instance() -> Arc<DataExchangeManager> {
74-
Global::get()
74+
GlobalInstance::get()
7575
}
7676

7777
// Create connections for cluster all nodes. We will push data through this connection.

src/query/service/src/catalogs/catalog_manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use std::sync::Arc;
1616

17-
use common_base::base::Global;
17+
use common_base::base::GlobalInstance;
1818
use common_catalog::catalog::Catalog;
1919
pub use common_catalog::catalog::CatalogManager;
2020
use common_catalog::catalog_kind::CATALOG_DEFAULT;
@@ -49,7 +49,7 @@ pub trait CatalogManagerHelper {
4949
#[async_trait::async_trait]
5050
impl CatalogManagerHelper for CatalogManager {
5151
async fn init(conf: &Config) -> Result<()> {
52-
Global::set(Self::try_create(conf).await?);
52+
GlobalInstance::set(Self::try_create(conf).await?);
5353

5454
Ok(())
5555
}

0 commit comments

Comments
 (0)