Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement Deserialize for Catalog #25730

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ mockito = { version = "1.4.0", default-features = false }
mockall = { version = "0.13.0" }
num_cpus = "1.16.0"
object_store = "0.11.1"
parking_lot = "0.12.1"
parking_lot = { version = "0.12.1", features = ["serde"] }
paste = "1.0.15"
parquet = { version = "53.0.0", features = ["object_store"] }
pbjson = "0.6.0"
Expand Down
14 changes: 3 additions & 11 deletions influxdb3_catalog/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use iox_time::Time;
use observability_deps::tracing::{debug, info};
use parking_lot::RwLock;
use schema::{InfluxColumnType, InfluxFieldType, Schema, SchemaBuilder};
use serde::{Deserialize, Serialize, Serializer};
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
use std::cmp::Ordering;
use std::collections::BTreeMap;
Expand Down Expand Up @@ -159,8 +159,9 @@ impl CatalogSequenceNumber {
}
}

#[derive(Debug)]
#[derive(Debug, Deserialize, Serialize)]
pub struct Catalog {
#[serde(flatten)]
inner: RwLock<InnerCatalog>,
}

Expand All @@ -170,15 +171,6 @@ impl PartialEq for Catalog {
}
}

impl Serialize for Catalog {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
self.inner.read().serialize(serializer)
}
}

impl Catalog {
/// Limit for the number of Databases that InfluxDB 3.0 OSS can have
pub(crate) const NUM_DBS_LIMIT: usize = 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ snapshot_kind: text
}
]
],
"sequence": 0,
"db_map": [],
"host_id": "sample-host-id",
"instance_id": "instance-id",
"db_map": []
"sequence": 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ snapshot_kind: text
}
]
],
"sequence": 0,
"db_map": [],
"host_id": "sample-host-id",
"instance_id": "instance-id",
"db_map": []
"sequence": 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ snapshot_kind: text
}
]
],
"sequence": 0,
"db_map": [],
"host_id": "sample-host-id",
"instance_id": "instance-id",
"db_map": []
"sequence": 0
}
Loading