2024-03-08 11:47:05 +00:00
|
|
|
use std::str::FromStr;
|
2020-04-10 20:01:48 +00:00
|
|
|
use std::sync::Arc;
|
2020-04-17 15:09:57 +00:00
|
|
|
|
2024-02-13 11:55:41 +00:00
|
|
|
use garage_net::NetworkKey;
|
2021-10-14 09:50:12 +00:00
|
|
|
|
2022-06-08 08:01:44 +00:00
|
|
|
use garage_db as db;
|
|
|
|
|
2020-04-24 10:10:01 +00:00
|
|
|
use garage_util::background::*;
|
|
|
|
use garage_util::config::*;
|
2022-09-13 13:57:27 +00:00
|
|
|
use garage_util::error::*;
|
2023-08-30 12:51:08 +00:00
|
|
|
use garage_util::persister::PersisterShared;
|
2020-04-07 14:26:22 +00:00
|
|
|
|
2022-12-05 14:28:57 +00:00
|
|
|
use garage_rpc::replication_mode::ReplicationMode;
|
2021-10-14 09:50:12 +00:00
|
|
|
use garage_rpc::system::System;
|
2020-04-11 16:51:11 +00:00
|
|
|
|
2022-03-15 11:31:23 +00:00
|
|
|
use garage_block::manager::*;
|
2021-03-26 18:41:46 +00:00
|
|
|
use garage_table::replication::TableFullReplication;
|
|
|
|
use garage_table::replication::TableShardedReplication;
|
2020-04-24 10:10:01 +00:00
|
|
|
use garage_table::*;
|
2020-04-11 16:51:11 +00:00
|
|
|
|
2022-05-10 11:16:57 +00:00
|
|
|
use crate::s3::block_ref_table::*;
|
2023-08-30 12:51:08 +00:00
|
|
|
use crate::s3::lifecycle_worker;
|
2023-04-27 15:57:54 +00:00
|
|
|
use crate::s3::mpu_table::*;
|
2022-05-10 11:16:57 +00:00
|
|
|
use crate::s3::object_table::*;
|
|
|
|
use crate::s3::version_table::*;
|
|
|
|
|
2021-12-14 12:55:11 +00:00
|
|
|
use crate::bucket_alias_table::*;
|
2020-04-24 10:10:01 +00:00
|
|
|
use crate::bucket_table::*;
|
2022-01-03 12:58:05 +00:00
|
|
|
use crate::helper;
|
2022-06-15 18:20:28 +00:00
|
|
|
use crate::index_counter::*;
|
2020-04-24 10:10:01 +00:00
|
|
|
use crate::key_table::*;
|
2022-05-10 11:16:57 +00:00
|
|
|
|
|
|
|
#[cfg(feature = "k2v")]
|
2023-01-10 09:30:59 +00:00
|
|
|
use crate::k2v::{item_table::*, rpc::*, sub::*};
|
2020-04-11 16:51:11 +00:00
|
|
|
|
2021-03-26 20:53:28 +00:00
|
|
|
/// An entire Garage full of data
|
2020-04-08 20:00:41 +00:00
|
|
|
pub struct Garage {
|
2021-03-26 20:53:28 +00:00
|
|
|
/// The parsed configuration Garage is running
|
2020-04-23 17:05:46 +00:00
|
|
|
pub config: Config,
|
2023-01-04 12:07:13 +00:00
|
|
|
/// The set of background variables that can be viewed/modified at runtime
|
|
|
|
pub bg_vars: vars::BgVars,
|
2020-04-23 17:05:46 +00:00
|
|
|
|
2022-12-05 13:59:15 +00:00
|
|
|
/// The replication mode of this cluster
|
|
|
|
pub replication_mode: ReplicationMode,
|
|
|
|
|
2021-03-26 20:53:28 +00:00
|
|
|
/// The local database
|
2022-06-08 08:01:44 +00:00
|
|
|
pub db: db::Db,
|
2021-03-26 20:53:28 +00:00
|
|
|
/// The membership manager
|
2020-04-08 20:00:41 +00:00
|
|
|
pub system: Arc<System>,
|
2021-03-26 20:53:28 +00:00
|
|
|
/// The block manager
|
2020-04-12 11:03:55 +00:00
|
|
|
pub block_manager: Arc<BlockManager>,
|
2020-04-08 20:00:41 +00:00
|
|
|
|
2022-05-10 11:16:57 +00:00
|
|
|
/// Table containing buckets
|
2020-04-19 15:15:48 +00:00
|
|
|
pub bucket_table: Arc<Table<BucketTable, TableFullReplication>>,
|
2022-05-10 11:16:57 +00:00
|
|
|
/// Table containing bucket aliases
|
2021-12-14 12:55:11 +00:00
|
|
|
pub bucket_alias_table: Arc<Table<BucketAliasTable, TableFullReplication>>,
|
2022-05-10 11:16:57 +00:00
|
|
|
/// Table containing api keys
|
2020-04-23 20:25:45 +00:00
|
|
|
pub key_table: Arc<Table<KeyTable, TableFullReplication>>,
|
|
|
|
|
2024-02-22 11:28:21 +00:00
|
|
|
/// Lock to prevent concurrent modification of buckets and access keys
|
|
|
|
bucket_lock: tokio::sync::Mutex<()>,
|
|
|
|
|
2022-05-10 11:16:57 +00:00
|
|
|
/// Table containing S3 objects
|
2020-04-19 11:22:28 +00:00
|
|
|
pub object_table: Arc<Table<ObjectTable, TableShardedReplication>>,
|
2022-06-15 18:20:28 +00:00
|
|
|
/// Counting table containing object counters
|
|
|
|
pub object_counter_table: Arc<IndexCounter<Object>>,
|
2023-04-27 15:57:54 +00:00
|
|
|
/// Table containing S3 multipart uploads
|
|
|
|
pub mpu_table: Arc<Table<MultipartUploadTable, TableShardedReplication>>,
|
|
|
|
/// Counting table containing multipart object counters
|
|
|
|
pub mpu_counter_table: Arc<IndexCounter<MultipartUpload>>,
|
2022-05-10 11:16:57 +00:00
|
|
|
/// Table containing S3 object versions
|
2020-04-19 11:22:28 +00:00
|
|
|
pub version_table: Arc<Table<VersionTable, TableShardedReplication>>,
|
2022-05-10 11:16:57 +00:00
|
|
|
/// Table containing S3 block references (not blocks themselves)
|
2020-04-19 11:22:28 +00:00
|
|
|
pub block_ref_table: Arc<Table<BlockRefTable, TableShardedReplication>>,
|
2022-05-10 11:16:57 +00:00
|
|
|
|
2023-08-30 12:51:08 +00:00
|
|
|
/// Persister for lifecycle worker info
|
|
|
|
pub lifecycle_persister: PersisterShared<lifecycle_worker::LifecycleWorkerPersisted>,
|
|
|
|
|
2022-05-10 11:16:57 +00:00
|
|
|
#[cfg(feature = "k2v")]
|
|
|
|
pub k2v: GarageK2V,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(feature = "k2v")]
|
|
|
|
pub struct GarageK2V {
|
|
|
|
/// Table containing K2V items
|
|
|
|
pub item_table: Arc<Table<K2VItemTable, TableShardedReplication>>,
|
|
|
|
/// Indexing table containing K2V item counters
|
2022-06-15 18:20:28 +00:00
|
|
|
pub counter_table: Arc<IndexCounter<K2VItem>>,
|
2022-05-10 11:16:57 +00:00
|
|
|
/// K2V RPC handler
|
|
|
|
pub rpc: Arc<K2VRpcHandler>,
|
2020-04-08 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Garage {
|
2021-03-26 20:53:28 +00:00
|
|
|
/// Create and run garage
|
2022-12-14 11:51:16 +00:00
|
|
|
pub fn new(config: Config) -> Result<Arc<Self>, Error> {
|
2022-09-13 13:57:27 +00:00
|
|
|
// Create meta dir and data dir if they don't exist already
|
|
|
|
std::fs::create_dir_all(&config.metadata_dir)
|
|
|
|
.ok_or_message("Unable to create Garage metadata directory")?;
|
2023-09-04 12:49:49 +00:00
|
|
|
match &config.data_dir {
|
|
|
|
DataDirEnum::Single(data_dir) => {
|
|
|
|
std::fs::create_dir_all(data_dir).ok_or_message(format!(
|
|
|
|
"Unable to create Garage data directory: {}",
|
|
|
|
data_dir.to_string_lossy()
|
|
|
|
))?;
|
|
|
|
}
|
|
|
|
DataDirEnum::Multiple(data_dirs) => {
|
|
|
|
for dir in data_dirs {
|
|
|
|
std::fs::create_dir_all(&dir.path).ok_or_message(format!(
|
|
|
|
"Unable to create Garage data directory: {}",
|
|
|
|
dir.path.to_string_lossy()
|
|
|
|
))?;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-09-13 13:57:27 +00:00
|
|
|
|
2022-06-15 18:20:28 +00:00
|
|
|
info!("Opening database...");
|
2024-03-08 11:47:05 +00:00
|
|
|
let db_engine = db::Engine::from_str(&config.db_engine)
|
|
|
|
.ok_or_message("Invalid `db_engine` value in configuration file")?;
|
2022-06-15 18:20:28 +00:00
|
|
|
let mut db_path = config.metadata_dir.clone();
|
2024-03-08 11:47:05 +00:00
|
|
|
match db_engine {
|
|
|
|
db::Engine::Sled => {
|
2022-06-15 18:20:28 +00:00
|
|
|
db_path.push("db");
|
|
|
|
}
|
2024-03-08 11:47:05 +00:00
|
|
|
db::Engine::Sqlite => {
|
2022-06-15 18:20:28 +00:00
|
|
|
db_path.push("db.sqlite");
|
2022-09-06 15:09:43 +00:00
|
|
|
}
|
2024-03-08 11:47:05 +00:00
|
|
|
db::Engine::Lmdb => {
|
2022-06-15 18:20:28 +00:00
|
|
|
db_path.push("db.lmdb");
|
|
|
|
}
|
2024-03-08 11:47:05 +00:00
|
|
|
}
|
|
|
|
let db_opt = db::OpenOpt {
|
|
|
|
fsync: config.metadata_fsync,
|
|
|
|
lmdb_map_size: match config.lmdb_map_size {
|
|
|
|
v if v == usize::default() => None,
|
|
|
|
v => Some(v),
|
|
|
|
},
|
|
|
|
sled_cache_capacity: config.sled_cache_capacity,
|
|
|
|
sled_flush_every_ms: config.sled_flush_every_ms,
|
2022-06-15 18:20:28 +00:00
|
|
|
};
|
2024-03-08 11:47:05 +00:00
|
|
|
let db = db::open_db(&db_path, db_engine, &db_opt)
|
|
|
|
.ok_or_message("Unable to open metadata db")?;
|
2022-06-15 18:20:28 +00:00
|
|
|
|
2024-03-08 11:47:05 +00:00
|
|
|
info!("Initializing RPC...");
|
2023-02-03 14:27:39 +00:00
|
|
|
let network_key = hex::decode(config.rpc_secret.as_ref().ok_or_message(
|
|
|
|
"rpc_secret value is missing, not present in config file or in environment",
|
|
|
|
)?)
|
|
|
|
.ok()
|
|
|
|
.and_then(|x| NetworkKey::from_slice(&x))
|
|
|
|
.ok_or_message("Invalid RPC secret key")?;
|
2021-10-14 09:50:12 +00:00
|
|
|
|
2021-05-28 10:36:22 +00:00
|
|
|
let replication_mode = ReplicationMode::parse(&config.replication_mode)
|
2023-02-03 14:27:39 +00:00
|
|
|
.ok_or_message("Invalid replication_mode in config file.")?;
|
2021-05-28 10:36:22 +00:00
|
|
|
|
2023-08-30 12:51:08 +00:00
|
|
|
info!("Initialize background variable system...");
|
|
|
|
let mut bg_vars = vars::BgVars::new();
|
|
|
|
|
2020-04-21 12:54:55 +00:00
|
|
|
info!("Initialize membership management system...");
|
2022-12-14 11:51:16 +00:00
|
|
|
let system = System::new(network_key, replication_mode, &config)?;
|
2020-04-08 20:00:41 +00:00
|
|
|
|
2020-04-19 11:22:28 +00:00
|
|
|
let data_rep_param = TableShardedReplication {
|
2021-03-16 10:14:27 +00:00
|
|
|
system: system.clone(),
|
2021-05-28 10:36:22 +00:00
|
|
|
replication_factor: replication_mode.replication_factor(),
|
|
|
|
write_quorum: replication_mode.write_quorum(),
|
2020-04-12 11:03:55 +00:00
|
|
|
read_quorum: 1,
|
|
|
|
};
|
|
|
|
|
2020-04-19 11:22:28 +00:00
|
|
|
let meta_rep_param = TableShardedReplication {
|
2021-03-16 10:14:27 +00:00
|
|
|
system: system.clone(),
|
2021-05-28 10:36:22 +00:00
|
|
|
replication_factor: replication_mode.replication_factor(),
|
|
|
|
write_quorum: replication_mode.write_quorum(),
|
|
|
|
read_quorum: replication_mode.read_quorum(),
|
2020-04-08 20:00:41 +00:00
|
|
|
};
|
|
|
|
|
2021-03-16 10:14:27 +00:00
|
|
|
let control_rep_param = TableFullReplication {
|
|
|
|
system: system.clone(),
|
2021-05-28 10:36:22 +00:00
|
|
|
max_faults: replication_mode.control_write_max_faults(),
|
2021-03-16 10:14:27 +00:00
|
|
|
};
|
2020-04-23 17:05:46 +00:00
|
|
|
|
|
|
|
info!("Initialize block manager...");
|
2022-03-15 11:31:23 +00:00
|
|
|
let block_manager = BlockManager::new(
|
|
|
|
&db,
|
|
|
|
config.data_dir.clone(),
|
2023-06-09 14:23:21 +00:00
|
|
|
config.data_fsync,
|
2022-03-15 11:31:23 +00:00
|
|
|
config.compression_level,
|
|
|
|
data_rep_param,
|
|
|
|
system.clone(),
|
2023-09-05 13:39:21 +00:00
|
|
|
)?;
|
2023-08-30 12:51:08 +00:00
|
|
|
block_manager.register_bg_vars(&mut bg_vars);
|
2020-04-19 15:15:48 +00:00
|
|
|
|
2022-05-10 11:16:57 +00:00
|
|
|
// ---- admin tables ----
|
|
|
|
info!("Initialize bucket_table...");
|
|
|
|
let bucket_table = Table::new(BucketTable, control_rep_param.clone(), system.clone(), &db);
|
|
|
|
|
|
|
|
info!("Initialize bucket_alias_table...");
|
|
|
|
let bucket_alias_table = Table::new(
|
|
|
|
BucketAliasTable,
|
|
|
|
control_rep_param.clone(),
|
|
|
|
system.clone(),
|
|
|
|
&db,
|
|
|
|
);
|
|
|
|
info!("Initialize key_table_table...");
|
|
|
|
let key_table = Table::new(KeyTable, control_rep_param, system.clone(), &db);
|
|
|
|
|
|
|
|
// ---- S3 tables ----
|
2020-04-21 12:54:55 +00:00
|
|
|
info!("Initialize block_ref_table...");
|
2020-04-12 20:24:53 +00:00
|
|
|
let block_ref_table = Table::new(
|
2020-04-12 11:03:55 +00:00
|
|
|
BlockRefTable {
|
|
|
|
block_manager: block_manager.clone(),
|
2020-04-10 20:01:48 +00:00
|
|
|
},
|
2021-05-28 10:36:22 +00:00
|
|
|
meta_rep_param.clone(),
|
2020-04-08 20:00:41 +00:00
|
|
|
system.clone(),
|
|
|
|
&db,
|
2021-03-11 12:47:21 +00:00
|
|
|
);
|
2020-04-17 15:09:57 +00:00
|
|
|
|
2020-04-21 12:54:55 +00:00
|
|
|
info!("Initialize version_table...");
|
2020-04-12 20:24:53 +00:00
|
|
|
let version_table = Table::new(
|
2020-04-10 20:01:48 +00:00
|
|
|
VersionTable {
|
2020-04-12 11:03:55 +00:00
|
|
|
block_ref_table: block_ref_table.clone(),
|
2020-04-10 20:01:48 +00:00
|
|
|
},
|
2020-04-19 11:22:28 +00:00
|
|
|
meta_rep_param.clone(),
|
2020-04-09 21:45:07 +00:00
|
|
|
system.clone(),
|
|
|
|
&db,
|
2021-03-11 12:47:21 +00:00
|
|
|
);
|
2020-04-17 15:09:57 +00:00
|
|
|
|
2023-04-27 15:57:54 +00:00
|
|
|
info!("Initialize multipart upload counter table...");
|
|
|
|
let mpu_counter_table = IndexCounter::new(system.clone(), meta_rep_param.clone(), &db);
|
|
|
|
|
|
|
|
info!("Initialize multipart upload table...");
|
|
|
|
let mpu_table = Table::new(
|
|
|
|
MultipartUploadTable {
|
|
|
|
version_table: version_table.clone(),
|
|
|
|
mpu_counter_table: mpu_counter_table.clone(),
|
|
|
|
},
|
|
|
|
meta_rep_param.clone(),
|
|
|
|
system.clone(),
|
|
|
|
&db,
|
|
|
|
);
|
|
|
|
|
2022-06-15 18:20:28 +00:00
|
|
|
info!("Initialize object counter table...");
|
|
|
|
let object_counter_table = IndexCounter::new(system.clone(), meta_rep_param.clone(), &db);
|
|
|
|
|
2020-04-21 12:54:55 +00:00
|
|
|
info!("Initialize object_table...");
|
2022-05-10 11:16:57 +00:00
|
|
|
#[allow(clippy::redundant_clone)]
|
2020-04-12 20:24:53 +00:00
|
|
|
let object_table = Table::new(
|
2020-04-12 11:03:55 +00:00
|
|
|
ObjectTable {
|
|
|
|
version_table: version_table.clone(),
|
2023-04-27 15:57:54 +00:00
|
|
|
mpu_table: mpu_table.clone(),
|
2022-06-15 18:20:28 +00:00
|
|
|
object_counter_table: object_counter_table.clone(),
|
2020-04-10 21:11:52 +00:00
|
|
|
},
|
2022-05-10 11:16:57 +00:00
|
|
|
meta_rep_param.clone(),
|
2021-12-14 12:55:11 +00:00
|
|
|
system.clone(),
|
|
|
|
&db,
|
|
|
|
);
|
|
|
|
|
2023-08-30 12:51:08 +00:00
|
|
|
info!("Load lifecycle worker state...");
|
|
|
|
let lifecycle_persister =
|
|
|
|
PersisterShared::new(&system.metadata_dir, "lifecycle_worker_state");
|
|
|
|
lifecycle_worker::register_bg_vars(&lifecycle_persister, &mut bg_vars);
|
|
|
|
|
2022-05-10 11:16:57 +00:00
|
|
|
// ---- K2V ----
|
|
|
|
#[cfg(feature = "k2v")]
|
|
|
|
let k2v = GarageK2V::new(system.clone(), &db, meta_rep_param);
|
2020-04-23 20:25:45 +00:00
|
|
|
|
2022-06-15 18:20:28 +00:00
|
|
|
// -- done --
|
|
|
|
Ok(Arc::new(Self {
|
2020-04-23 17:05:46 +00:00
|
|
|
config,
|
2023-01-04 12:07:13 +00:00
|
|
|
bg_vars,
|
2022-12-05 13:59:15 +00:00
|
|
|
replication_mode,
|
2020-04-08 20:00:41 +00:00
|
|
|
db,
|
2021-04-23 19:57:32 +00:00
|
|
|
system,
|
|
|
|
block_manager,
|
2020-04-19 15:15:48 +00:00
|
|
|
bucket_table,
|
2021-12-14 12:55:11 +00:00
|
|
|
bucket_alias_table,
|
2020-04-23 20:25:45 +00:00
|
|
|
key_table,
|
2024-02-22 11:28:21 +00:00
|
|
|
bucket_lock: tokio::sync::Mutex::new(()),
|
2020-04-09 15:32:28 +00:00
|
|
|
object_table,
|
2022-06-15 18:20:28 +00:00
|
|
|
object_counter_table,
|
2023-04-27 15:57:54 +00:00
|
|
|
mpu_table,
|
|
|
|
mpu_counter_table,
|
2020-04-09 21:45:07 +00:00
|
|
|
version_table,
|
2020-04-10 21:11:52 +00:00
|
|
|
block_ref_table,
|
2023-08-30 12:51:08 +00:00
|
|
|
lifecycle_persister,
|
2022-05-10 11:16:57 +00:00
|
|
|
#[cfg(feature = "k2v")]
|
|
|
|
k2v,
|
2022-06-15 18:20:28 +00:00
|
|
|
}))
|
2020-04-08 20:00:41 +00:00
|
|
|
}
|
2021-10-15 09:05:09 +00:00
|
|
|
|
2023-08-30 12:51:08 +00:00
|
|
|
pub fn spawn_workers(self: &Arc<Self>, bg: &BackgroundRunner) {
|
2022-12-14 11:51:16 +00:00
|
|
|
self.block_manager.spawn_workers(bg);
|
2022-12-14 11:28:07 +00:00
|
|
|
|
2022-12-14 11:51:16 +00:00
|
|
|
self.bucket_table.spawn_workers(bg);
|
|
|
|
self.bucket_alias_table.spawn_workers(bg);
|
|
|
|
self.key_table.spawn_workers(bg);
|
2022-12-14 11:28:07 +00:00
|
|
|
|
2022-12-14 11:51:16 +00:00
|
|
|
self.object_table.spawn_workers(bg);
|
|
|
|
self.object_counter_table.spawn_workers(bg);
|
2023-05-04 09:49:23 +00:00
|
|
|
self.mpu_table.spawn_workers(bg);
|
|
|
|
self.mpu_counter_table.spawn_workers(bg);
|
2022-12-14 11:51:16 +00:00
|
|
|
self.version_table.spawn_workers(bg);
|
|
|
|
self.block_ref_table.spawn_workers(bg);
|
2022-12-14 11:28:07 +00:00
|
|
|
|
2023-08-30 12:51:08 +00:00
|
|
|
bg.spawn_worker(lifecycle_worker::LifecycleWorker::new(
|
|
|
|
self.clone(),
|
|
|
|
self.lifecycle_persister.clone(),
|
|
|
|
));
|
|
|
|
|
2022-12-14 11:28:07 +00:00
|
|
|
#[cfg(feature = "k2v")]
|
2022-12-14 11:51:16 +00:00
|
|
|
self.k2v.spawn_workers(bg);
|
2022-12-14 11:28:07 +00:00
|
|
|
}
|
|
|
|
|
2022-01-03 12:58:05 +00:00
|
|
|
pub fn bucket_helper(&self) -> helper::bucket::BucketHelper {
|
|
|
|
helper::bucket::BucketHelper(self)
|
2021-12-14 12:55:11 +00:00
|
|
|
}
|
2022-05-24 10:16:39 +00:00
|
|
|
|
|
|
|
pub fn key_helper(&self) -> helper::key::KeyHelper {
|
|
|
|
helper::key::KeyHelper(self)
|
|
|
|
}
|
2024-02-22 11:28:21 +00:00
|
|
|
|
|
|
|
pub async fn locked_helper(&self) -> helper::locked::LockedHelper {
|
|
|
|
let lock = self.bucket_lock.lock().await;
|
|
|
|
helper::locked::LockedHelper(self, lock)
|
|
|
|
}
|
2020-04-08 20:00:41 +00:00
|
|
|
}
|
2022-05-10 11:16:57 +00:00
|
|
|
|
|
|
|
#[cfg(feature = "k2v")]
|
|
|
|
impl GarageK2V {
|
2022-06-08 08:01:44 +00:00
|
|
|
fn new(system: Arc<System>, db: &db::Db, meta_rep_param: TableShardedReplication) -> Self {
|
2022-05-10 11:16:57 +00:00
|
|
|
info!("Initialize K2V counter table...");
|
|
|
|
let counter_table = IndexCounter::new(system.clone(), meta_rep_param.clone(), db);
|
2023-01-10 10:01:49 +00:00
|
|
|
|
2022-05-10 11:16:57 +00:00
|
|
|
info!("Initialize K2V subscription manager...");
|
|
|
|
let subscriptions = Arc::new(SubscriptionManager::new());
|
2023-01-10 10:01:49 +00:00
|
|
|
|
2022-05-10 11:16:57 +00:00
|
|
|
info!("Initialize K2V item table...");
|
|
|
|
let item_table = Table::new(
|
|
|
|
K2VItemTable {
|
|
|
|
counter_table: counter_table.clone(),
|
|
|
|
subscriptions: subscriptions.clone(),
|
|
|
|
},
|
|
|
|
meta_rep_param,
|
|
|
|
system.clone(),
|
|
|
|
db,
|
|
|
|
);
|
2023-01-10 10:01:49 +00:00
|
|
|
|
|
|
|
info!("Initialize K2V RPC handler...");
|
|
|
|
let rpc = K2VRpcHandler::new(system, db, item_table.clone(), subscriptions);
|
2022-05-10 11:16:57 +00:00
|
|
|
|
|
|
|
Self {
|
|
|
|
item_table,
|
|
|
|
counter_table,
|
|
|
|
rpc,
|
|
|
|
}
|
|
|
|
}
|
2022-12-14 11:28:07 +00:00
|
|
|
|
2022-12-14 11:51:16 +00:00
|
|
|
pub fn spawn_workers(&self, bg: &BackgroundRunner) {
|
|
|
|
self.item_table.spawn_workers(bg);
|
|
|
|
self.counter_table.spawn_workers(bg);
|
2022-12-14 11:28:07 +00:00
|
|
|
}
|
2022-05-10 11:16:57 +00:00
|
|
|
}
|