@@ -33,26 +33,68 @@ pub const CREATED_BY_PROPERTY: &str = "created-by";
3333#[ derive( Debug ,  PartialEq ,  Eq ,  Serialize ,  Deserialize ,  Clone ) ]  
3434#[ serde( rename_all = "kebab-case" ) ]  
3535pub  struct  BlobMetadata  { 
36+     pub ( crate )  r#type :  String , 
37+     pub ( crate )  fields :  Vec < i32 > , 
38+     pub ( crate )  snapshot_id :  i64 , 
39+     pub ( crate )  sequence_number :  i64 , 
40+     pub ( crate )  offset :  u64 , 
41+     pub ( crate )  length :  u64 , 
42+     #[ serde( skip_serializing_if = "CompressionCodec::is_none" ) ]  
43+     #[ serde( default ) ]  
44+     pub ( crate )  compression_codec :  CompressionCodec , 
45+     #[ serde( skip_serializing_if = "HashMap::is_empty" ) ]  
46+     #[ serde( default ) ]  
47+     pub ( crate )  properties :  HashMap < String ,  String > , 
48+ } 
49+ 
50+ impl  BlobMetadata  { 
51+     #[ inline]  
3652    /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types 
37- pub  r#type :  String , 
53+ pub  fn  blob_type ( & self )  -> & String  { 
54+         & self . r#type 
55+     } 
56+ 
57+     #[ inline]  
3858    /// List of field IDs the blob was computed for; the order of items is used to compute sketches stored in the blob. 
39- pub  fields :  Vec < i32 > , 
59+ pub  fn  fields ( & self )  -> & Vec < i32 >  { 
60+         & self . fields 
61+     } 
62+ 
63+     #[ inline]  
4064    /// ID of the Iceberg table's snapshot the blob was computed from 
41- pub  snapshot_id :  i64 , 
65+ pub  fn  snapshot_id ( & self )  -> & i64  { 
66+         & self . snapshot_id 
67+     } 
68+ 
69+     #[ inline]  
4270    /// Sequence number of the Iceberg table's snapshot the blob was computed from 
43- pub  sequence_number :  i64 , 
71+ pub  fn  sequence_number ( & self )  -> & i64  { 
72+         & self . r#sequence_number 
73+     } 
74+ 
75+     #[ inline]  
4476    /// The offset in the file where the blob contents start 
45- pub  offset :  u64 , 
77+ pub  fn  offset ( & self )  -> & u64  { 
78+         & self . offset 
79+     } 
80+ 
81+     #[ inline]  
4682    /// The length of the blob stored in the file (after compression, if compressed) 
47- pub  length :  u64 , 
83+ pub  fn  length ( & self )  -> & u64  { 
84+         & self . length 
85+     } 
86+ 
87+     #[ inline]  
4888    /// The compression codec used to compress the data 
49- #[ serde( skip_serializing_if = "CompressionCodec::is_none" ) ]  
50-     #[ serde( default ) ]  
51-     pub  compression_codec :  CompressionCodec , 
89+ pub  fn  compression_codec ( & self )  -> & CompressionCodec  { 
90+         & self . compression_codec 
91+     } 
92+ 
93+     #[ inline]  
5294    /// Arbitrary meta-information about the blob 
53- # [ serde ( skip_serializing_if =  " HashMap::is_empty" ) ] 
54-     # [ serde ( default ) ] 
55-     pub   properties :   HashMap < String ,   String > , 
95+ pub   fn   properties ( & self )  ->  & HashMap < String ,   String >   { 
96+          & self . properties 
97+     } 
5698} 
5799
58100#[ derive( Clone ,  Copy ,  PartialEq ,  Eq ,  Hash ,  Debug ) ]  
@@ -92,12 +134,10 @@ impl Flag {
92134/// For more information, see: https://iceberg.apache.org/puffin-spec/#filemetadata 
93135#[ derive( Debug ,  PartialEq ,  Eq ,  Serialize ,  Deserialize ,  Clone ) ]  
94136pub  struct  FileMetadata  { 
95-     /// Metadata about blobs in file 
96- pub  blobs :  Vec < BlobMetadata > , 
97-     /// Arbitrary meta-information, like writer identification/version. 
137+     pub ( crate )  blobs :  Vec < BlobMetadata > , 
98138    #[ serde( skip_serializing_if = "HashMap::is_empty" ) ]  
99139    #[ serde( default ) ]  
100-     pub  properties :  HashMap < String ,  String > , 
140+     pub ( crate )  properties :  HashMap < String ,  String > , 
101141} 
102142
103143impl  FileMetadata  { 
@@ -247,6 +287,18 @@ impl FileMetadata {
247287            FileMetadata :: extract_footer_payload_as_str ( & footer_bytes,  footer_payload_length) ?; 
248288        FileMetadata :: from_json_str ( & footer_payload_str) 
249289    } 
290+ 
291+     #[ inline]  
292+     /// Metadata about blobs in file 
293+ pub  fn  blobs ( & self )  -> & Vec < BlobMetadata >  { 
294+         & self . blobs 
295+     } 
296+ 
297+     #[ inline]  
298+     /// Arbitrary meta-information, like writer identification/version. 
299+ pub  fn  properties ( & self )  -> & HashMap < String ,  String >  { 
300+         & self . properties 
301+     } 
250302} 
251303
252304#[ cfg( test) ]  
0 commit comments