ps_datalake/lake/
config.rs1use crate::error::Result;
2use serde::Deserialize;
3use serde::Serialize;
4
5#[derive(Clone, Debug, Default, Deserialize, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize)]
6pub struct ConfigStoreEntry {
7 pub filename: String,
8 pub readonly: bool,
9}
10
11#[derive(Clone, Debug, Default, Deserialize, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize)]
12pub struct DataLakeConfig {
13 pub stores: Vec<ConfigStoreEntry>,
14}
15
16impl DataLakeConfig {
17 pub fn from_toml_str(config: &str) -> Result<Self> {
18 Ok(toml::de::from_str::<Self>(config)?)
19 }
20
21 pub fn to_toml_string(&self) -> Result<String> {
22 Ok(toml::ser::to_string_pretty(self)?)
23 }
24}