Skip to content

Commit 2dc150a

Browse files
authored
Merge pull request #1261 from muzarski/metadata-non-exhaustive
mark metadata public structs as `non_exhaustive`
2 parents 6ca9a7c + a572ca4 commit 2dc150a

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

scylla/src/cluster/metadata.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,12 @@ impl UntranslatedEndpoint {
152152
/// Data used to issue connections to a node.
153153
///
154154
/// Fetched from the cluster in Metadata.
155-
#[non_exhaustive] // <- so that we can add more fields in a backwards-compatible way
156155
#[derive(Clone, Debug)]
157-
pub struct PeerEndpoint {
158-
pub host_id: Uuid,
159-
pub address: NodeAddr,
160-
pub datacenter: Option<String>,
161-
pub rack: Option<String>,
156+
pub(crate) struct PeerEndpoint {
157+
pub(crate) host_id: Uuid,
158+
pub(crate) address: NodeAddr,
159+
pub(crate) datacenter: Option<String>,
160+
pub(crate) rack: Option<String>,
162161
}
163162

164163
impl Peer {
@@ -184,7 +183,9 @@ impl Peer {
184183
}
185184
}
186185

186+
/// Describes a keyspace in the cluster.
187187
#[derive(Clone, Debug, PartialEq, Eq)]
188+
#[non_exhaustive]
188189
pub struct Keyspace {
189190
pub strategy: Strategy,
190191
/// Empty HashMap may as well mean that the client disabled schema fetching in SessionConfig
@@ -195,7 +196,9 @@ pub struct Keyspace {
195196
pub user_defined_types: HashMap<String, Arc<UserDefinedType<'static>>>,
196197
}
197198

199+
/// Describes a table in the cluster.
198200
#[derive(Clone, Debug, PartialEq, Eq)]
201+
#[non_exhaustive]
199202
pub struct Table {
200203
pub columns: HashMap<String, Column>,
201204
/// Names of the column of partition key.
@@ -208,13 +211,17 @@ pub struct Table {
208211
pub(crate) pk_column_specs: Vec<ColumnSpec<'static>>,
209212
}
210213

214+
/// Describes a materialized view in the cluster.
211215
#[derive(Clone, Debug, PartialEq, Eq)]
216+
#[non_exhaustive]
212217
pub struct MaterializedView {
213218
pub view_metadata: Table,
214219
pub base_table_name: String,
215220
}
216221

222+
/// Describes a column of the table.
217223
#[derive(Clone, Debug, PartialEq, Eq)]
224+
#[non_exhaustive]
218225
pub struct Column {
219226
pub typ: ColumnType<'static>,
220227
pub kind: ColumnKind,
@@ -316,6 +323,7 @@ impl PreCollectionType {
316323
}
317324

318325
#[derive(Clone, Debug, PartialEq, Eq)]
326+
#[non_exhaustive]
319327
pub enum ColumnKind {
320328
Regular,
321329
Static,
@@ -342,6 +350,7 @@ impl std::str::FromStr for ColumnKind {
342350
}
343351

344352
#[derive(Clone, Debug, PartialEq, Eq)]
353+
#[non_exhaustive]
345354
#[allow(clippy::enum_variant_names)]
346355
pub enum Strategy {
347356
SimpleStrategy {

0 commit comments

Comments
 (0)