Skip to main content

soil_cli/params/
database_params.rs

1// This file is part of Soil.
2
3// Copyright (C) Soil contributors.
4// Copyright (C) Parity Technologies (UK) Ltd.
5// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
6
7use crate::arg_enums::Database;
8use clap::Args;
9
10/// Parameters for database
11#[derive(Debug, Clone, PartialEq, Args)]
12pub struct DatabaseParams {
13	/// Select database backend to use.
14	#[arg(long, alias = "db", value_name = "DB", ignore_case = true, value_enum)]
15	pub database: Option<Database>,
16
17	/// Limit the memory the database cache can use.
18	#[arg(long = "db-cache", value_name = "MiB")]
19	pub database_cache_size: Option<usize>,
20}
21
22impl DatabaseParams {
23	/// Database backend
24	pub fn database(&self) -> Option<Database> {
25		self.database
26	}
27
28	/// Limit the memory the database cache can use.
29	pub fn database_cache_size(&self) -> Option<usize> {
30		self.database_cache_size
31	}
32}