@@ -89,12 +89,13 @@ pub(crate) fn get_log_commit_info_schema() -> &'static SchemaRef {
89
89
}
90
90
91
91
#[ derive( Debug , Clone , PartialEq , Eq , Schema ) ]
92
+ #[ cfg_attr( feature = "developer-visibility" , visibility:: make( pub ) ) ]
92
93
#[ cfg_attr( test, derive( Serialize ) , serde( rename_all = "camelCase" ) ) ]
93
- pub struct Format {
94
+ pub ( crate ) struct Format {
94
95
/// Name of the encoding for files in this table
95
- pub provider : String ,
96
+ pub ( crate ) provider : String ,
96
97
/// A map containing configuration options for the format
97
- pub options : HashMap < String , String > ,
98
+ pub ( crate ) options : HashMap < String , String > ,
98
99
}
99
100
100
101
impl Default for Format {
@@ -108,49 +109,63 @@ impl Default for Format {
108
109
109
110
#[ derive( Debug , Default , Clone , PartialEq , Eq , Schema ) ]
110
111
#[ cfg_attr( test, derive( Serialize ) , serde( rename_all = "camelCase" ) ) ]
111
- pub struct Metadata {
112
+ #[ cfg_attr( feature = "developer-visibility" , visibility:: make( pub ) ) ]
113
+ pub ( crate ) struct Metadata {
112
114
/// Unique identifier for this table
113
- pub id : String ,
115
+ pub ( crate ) id : String ,
114
116
/// User-provided identifier for this table
115
- pub name : Option < String > ,
117
+ pub ( crate ) name : Option < String > ,
116
118
/// User-provided description for this table
117
- pub description : Option < String > ,
119
+ pub ( crate ) description : Option < String > ,
118
120
/// Specification of the encoding for the files stored in the table
119
- pub format : Format ,
121
+ pub ( crate ) format : Format ,
120
122
/// Schema of the table
121
- pub schema_string : String ,
123
+ pub ( crate ) schema_string : String ,
122
124
/// Column names by which the data should be partitioned
123
- pub partition_columns : Vec < String > ,
125
+ pub ( crate ) partition_columns : Vec < String > ,
124
126
/// The time when this metadata action is created, in milliseconds since the Unix epoch
125
- pub created_time : Option < i64 > ,
127
+ pub ( crate ) created_time : Option < i64 > ,
126
128
/// Configuration options for the metadata action. These are parsed into [`TableProperties`].
127
- pub configuration : HashMap < String , String > ,
129
+ pub ( crate ) configuration : HashMap < String , String > ,
128
130
}
129
131
130
132
impl Metadata {
131
- pub fn try_new_from_data ( data : & dyn EngineData ) -> DeltaResult < Option < Metadata > > {
133
+ pub ( crate ) fn try_new_from_data ( data : & dyn EngineData ) -> DeltaResult < Option < Metadata > > {
132
134
let mut visitor = MetadataVisitor :: default ( ) ;
133
135
visitor. visit_rows_of ( data) ?;
134
136
Ok ( visitor. metadata )
135
137
}
136
138
137
- pub fn parse_schema ( & self ) -> DeltaResult < StructType > {
139
+ #[ cfg_attr( feature = "developer-visibility" , visibility:: make( pub ) ) ]
140
+ #[ allow( dead_code) ]
141
+ pub ( crate ) fn configuration ( & self ) -> & HashMap < String , String > {
142
+ & self . configuration
143
+ }
144
+
145
+ pub ( crate ) fn parse_schema ( & self ) -> DeltaResult < StructType > {
138
146
Ok ( serde_json:: from_str ( & self . schema_string ) ?)
139
147
}
140
148
149
+ #[ cfg_attr( feature = "developer-visibility" , visibility:: make( pub ) ) ]
150
+ #[ allow( dead_code) ]
151
+ pub ( crate ) fn partition_columns ( & self ) -> & Vec < String > {
152
+ & self . partition_columns
153
+ }
154
+
141
155
/// Parse the metadata configuration HashMap<String, String> into a TableProperties struct.
142
156
/// Note that parsing is infallible -- any items that fail to parse are simply propagated
143
157
/// through to the `TableProperties.unknown_properties` field.
144
- pub fn parse_table_properties ( & self ) -> TableProperties {
158
+ pub ( crate ) fn parse_table_properties ( & self ) -> TableProperties {
145
159
TableProperties :: from ( self . configuration . iter ( ) )
146
160
}
147
161
}
148
162
149
163
#[ derive( Default , Debug , Clone , PartialEq , Eq , Schema , Serialize , Deserialize ) ]
150
164
#[ serde( rename_all = "camelCase" ) ]
165
+ #[ cfg_attr( feature = "developer-visibility" , visibility:: make( pub ) ) ]
151
166
// TODO move to another module so that we disallow constructing this struct without using the
152
167
// try_new function.
153
- pub struct Protocol {
168
+ pub ( crate ) struct Protocol {
154
169
/// The minimum version of the Delta read protocol that a client must implement
155
170
/// in order to correctly read this table
156
171
min_reader_version : i32 ,
@@ -160,17 +175,17 @@ pub struct Protocol {
160
175
/// A collection of features that a client must implement in order to correctly
161
176
/// read this table (exist only when minReaderVersion is set to 3)
162
177
#[ serde( skip_serializing_if = "Option::is_none" ) ]
163
- reader_features : Option < Vec < String > > ,
178
+ pub ( crate ) reader_features : Option < Vec < String > > ,
164
179
/// A collection of features that a client must implement in order to correctly
165
180
/// write this table (exist only when minWriterVersion is set to 7)
166
181
#[ serde( skip_serializing_if = "Option::is_none" ) ]
167
- writer_features : Option < Vec < String > > ,
182
+ pub ( crate ) writer_features : Option < Vec < String > > ,
168
183
}
169
184
170
185
impl Protocol {
171
186
/// Try to create a new Protocol instance from reader/writer versions and table features. This
172
187
/// can fail if the protocol is invalid.
173
- pub fn try_new (
188
+ pub ( crate ) fn try_new (
174
189
min_reader_version : i32 ,
175
190
min_writer_version : i32 ,
176
191
reader_features : Option < impl IntoIterator < Item = impl Into < String > > > ,
@@ -204,48 +219,50 @@ impl Protocol {
204
219
205
220
/// Create a new Protocol by visiting the EngineData and extracting the first protocol row into
206
221
/// a Protocol instance. If no protocol row is found, returns Ok(None).
207
- pub fn try_new_from_data ( data : & dyn EngineData ) -> DeltaResult < Option < Protocol > > {
222
+ pub ( crate ) fn try_new_from_data ( data : & dyn EngineData ) -> DeltaResult < Option < Protocol > > {
208
223
let mut visitor = ProtocolVisitor :: default ( ) ;
209
224
visitor. visit_rows_of ( data) ?;
210
225
Ok ( visitor. protocol )
211
226
}
212
227
213
228
/// This protocol's minimum reader version
214
- pub fn min_reader_version ( & self ) -> i32 {
229
+ #[ cfg_attr( feature = "developer-visibility" , visibility:: make( pub ) ) ]
230
+ pub ( crate ) fn min_reader_version ( & self ) -> i32 {
215
231
self . min_reader_version
216
232
}
217
233
218
234
/// This protocol's minimum writer version
219
- pub fn min_writer_version ( & self ) -> i32 {
235
+ #[ cfg_attr( feature = "developer-visibility" , visibility:: make( pub ) ) ]
236
+ pub ( crate ) fn min_writer_version ( & self ) -> i32 {
220
237
self . min_writer_version
221
238
}
222
239
223
240
/// Get the reader features for the protocol
224
- pub fn reader_features ( & self ) -> Option < & [ String ] > {
241
+ pub ( crate ) fn reader_features ( & self ) -> Option < & [ String ] > {
225
242
self . reader_features . as_deref ( )
226
243
}
227
244
228
245
/// Get the writer features for the protocol
229
- pub fn writer_features ( & self ) -> Option < & [ String ] > {
246
+ pub ( crate ) fn writer_features ( & self ) -> Option < & [ String ] > {
230
247
self . writer_features . as_deref ( )
231
248
}
232
249
233
250
/// True if this protocol has the requested reader feature
234
- pub fn has_reader_feature ( & self , feature : & ReaderFeatures ) -> bool {
251
+ pub ( crate ) fn has_reader_feature ( & self , feature : & ReaderFeatures ) -> bool {
235
252
self . reader_features ( )
236
253
. is_some_and ( |features| features. iter ( ) . any ( |f| f == feature. as_ref ( ) ) )
237
254
}
238
255
239
256
/// True if this protocol has the requested writer feature
240
- pub fn has_writer_feature ( & self , feature : & WriterFeatures ) -> bool {
257
+ pub ( crate ) fn has_writer_feature ( & self , feature : & WriterFeatures ) -> bool {
241
258
self . writer_features ( )
242
259
. is_some_and ( |features| features. iter ( ) . any ( |f| f == feature. as_ref ( ) ) )
243
260
}
244
261
245
262
/// Check if reading a table with this protocol is supported. That is: does the kernel support
246
263
/// the specified protocol reader version and all enabled reader features? If yes, returns unit
247
264
/// type, otherwise will return an error.
248
- pub fn ensure_read_supported ( & self ) -> DeltaResult < ( ) > {
265
+ pub ( crate ) fn ensure_read_supported ( & self ) -> DeltaResult < ( ) > {
249
266
match & self . reader_features {
250
267
// if min_reader_version = 3 and all reader features are subset of supported => OK
251
268
Some ( reader_features) if self . min_reader_version == 3 => {
@@ -275,7 +292,7 @@ impl Protocol {
275
292
276
293
/// Check if writing to a table with this protocol is supported. That is: does the kernel
277
294
/// support the specified protocol writer version and all enabled writer features?
278
- pub fn ensure_write_supported ( & self ) -> DeltaResult < ( ) > {
295
+ pub ( crate ) fn ensure_write_supported ( & self ) -> DeltaResult < ( ) > {
279
296
match & self . writer_features {
280
297
Some ( writer_features) if self . min_writer_version == 7 => {
281
298
// if we're on version 7, make sure we support all the specified features
@@ -369,30 +386,31 @@ pub(crate) struct CommitInfo {
369
386
370
387
#[ derive( Debug , Clone , PartialEq , Eq , Schema ) ]
371
388
#[ cfg_attr( test, derive( Serialize , Default ) , serde( rename_all = "camelCase" ) ) ]
372
- pub struct Add {
389
+ #[ cfg_attr( feature = "developer-visibility" , visibility:: make( pub ) ) ]
390
+ pub ( crate ) struct Add {
373
391
/// A relative path to a data file from the root of the table or an absolute path to a file
374
392
/// that should be added to the table. The path is a URI as specified by
375
393
/// [RFC 2396 URI Generic Syntax], which needs to be decoded to get the data file path.
376
394
///
377
395
/// [RFC 2396 URI Generic Syntax]: https://www.ietf.org/rfc/rfc2396.txt
378
- pub path : String ,
396
+ pub ( crate ) path : String ,
379
397
380
398
/// A map from partition column to value for this logical file. This map can contain null in the
381
399
/// values meaning a partition is null. We drop those values from this map, due to the
382
400
/// `drop_null_container_values` annotation. This means an engine can assume that if a partition
383
401
/// is found in [`Metadata`] `partition_columns`, but not in this map, its value is null.
384
402
#[ drop_null_container_values]
385
- pub partition_values : HashMap < String , String > ,
403
+ pub ( crate ) partition_values : HashMap < String , String > ,
386
404
387
405
/// The size of this data file in bytes
388
- pub size : i64 ,
406
+ pub ( crate ) size : i64 ,
389
407
390
408
/// The time this logical file was created, as milliseconds since the epoch.
391
- pub modification_time : i64 ,
409
+ pub ( crate ) modification_time : i64 ,
392
410
393
411
/// When `false` the logical file must already be present in the table or the records
394
412
/// in the added file must be contained in one or more remove actions in the same version.
395
- pub data_change : bool ,
413
+ pub ( crate ) data_change : bool ,
396
414
397
415
/// Contains [statistics] (e.g., count, min/max values for columns) about the data in this logical file encoded as a JSON string.
398
416
///
@@ -424,7 +442,9 @@ pub struct Add {
424
442
}
425
443
426
444
impl Add {
427
- pub fn dv_unique_id ( & self ) -> Option < String > {
445
+ #[ cfg_attr( feature = "developer-visibility" , visibility:: make( pub ) ) ]
446
+ #[ allow( dead_code) ]
447
+ pub ( crate ) fn dv_unique_id ( & self ) -> Option < String > {
428
448
self . deletion_vector . as_ref ( ) . map ( |dv| dv. unique_id ( ) )
429
449
}
430
450
}
@@ -512,15 +532,16 @@ pub(crate) struct Cdc {
512
532
}
513
533
514
534
#[ derive( Debug , Clone , PartialEq , Eq , Schema ) ]
515
- pub struct SetTransaction {
535
+ #[ cfg_attr( feature = "developer-visibility" , visibility:: make( pub ) ) ]
536
+ pub ( crate ) struct SetTransaction {
516
537
/// A unique identifier for the application performing the transaction.
517
- pub app_id : String ,
538
+ pub ( crate ) app_id : String ,
518
539
519
540
/// An application-specific numeric identifier for this transaction.
520
- pub version : i64 ,
541
+ pub ( crate ) version : i64 ,
521
542
522
543
/// The time when this transaction action was created in milliseconds since the Unix epoch.
523
- pub last_updated : Option < i64 > ,
544
+ pub ( crate ) last_updated : Option < i64 > ,
524
545
}
525
546
526
547
/// The sidecar action references a sidecar file which provides some of the checkpoint's
0 commit comments