@@ -26,35 +26,77 @@ use crate::{Error, ErrorKind, Result};
2626
2727/// Human-readable identification of the application writing the file, along with its version. 
2828/// Example: "Trino version 381" 
29- pub ( crate )  const  CREATED_BY_PROPERTY :  & str  = "created-by" ; 
29+ pub  const  CREATED_BY_PROPERTY :  & str  = "created-by" ; 
3030
3131/// Metadata about a blob. 
3232/// For more information, see: https://iceberg.apache.org/puffin-spec/#blobmetadata 
3333#[ derive( Debug ,  PartialEq ,  Eq ,  Serialize ,  Deserialize ,  Clone ) ]  
3434#[ serde( rename_all = "kebab-case" ) ]  
35- pub ( crate )  struct  BlobMetadata  { 
36-     /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types 
35+ pub  struct  BlobMetadata  { 
3736    pub ( crate )  r#type :  String , 
38-     /// List of field IDs the blob was computed for; the order of items is used to compute sketches stored in the blob. 
3937    pub ( crate )  fields :  Vec < i32 > , 
40-     /// ID of the Iceberg table's snapshot the blob was computed from 
4138    pub ( crate )  snapshot_id :  i64 , 
42-     /// Sequence number of the Iceberg table's snapshot the blob was computed from 
4339    pub ( crate )  sequence_number :  i64 , 
44-     /// The offset in the file where the blob contents start 
4540    pub ( crate )  offset :  u64 , 
46-     /// The length of the blob stored in the file (after compression, if compressed) 
4741    pub ( crate )  length :  u64 , 
48-     /// The compression codec used to compress the data 
4942    #[ serde( skip_serializing_if = "CompressionCodec::is_none" ) ]  
5043    #[ serde( default ) ]  
5144    pub ( crate )  compression_codec :  CompressionCodec , 
52-     /// Arbitrary meta-information about the blob 
5345    #[ serde( skip_serializing_if = "HashMap::is_empty" ) ]  
5446    #[ serde( default ) ]  
5547    pub ( crate )  properties :  HashMap < String ,  String > , 
5648} 
5749
50+ impl  BlobMetadata  { 
51+     #[ inline]  
52+     /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types 
53+ pub  fn  blob_type ( & self )  -> & str  { 
54+         & self . r#type 
55+     } 
56+ 
57+     #[ inline]  
58+     /// List of field IDs the blob was computed for; the order of items is used to compute sketches stored in the blob. 
59+ pub  fn  fields ( & self )  -> & [ i32 ]  { 
60+         & self . fields 
61+     } 
62+ 
63+     #[ inline]  
64+     /// ID of the Iceberg table's snapshot the blob was computed from 
65+ pub  fn  snapshot_id ( & self )  -> i64  { 
66+         self . snapshot_id 
67+     } 
68+ 
69+     #[ inline]  
70+     /// Sequence number of the Iceberg table's snapshot the blob was computed from 
71+ pub  fn  sequence_number ( & self )  -> i64  { 
72+         self . sequence_number 
73+     } 
74+ 
75+     #[ inline]  
76+     /// The offset in the file where the blob contents start 
77+ pub  fn  offset ( & self )  -> u64  { 
78+         self . offset 
79+     } 
80+ 
81+     #[ inline]  
82+     /// The length of the blob stored in the file (after compression, if compressed) 
83+ pub  fn  length ( & self )  -> u64  { 
84+         self . length 
85+     } 
86+ 
87+     #[ inline]  
88+     /// The compression codec used to compress the data 
89+ pub  fn  compression_codec ( & self )  -> CompressionCodec  { 
90+         self . compression_codec 
91+     } 
92+ 
93+     #[ inline]  
94+     /// Arbitrary meta-information about the blob 
95+ pub  fn  properties ( & self )  -> & HashMap < String ,  String >  { 
96+         & self . properties 
97+     } 
98+ } 
99+ 
58100#[ derive( Clone ,  Copy ,  PartialEq ,  Eq ,  Hash ,  Debug ) ]  
59101pub ( crate )  enum  Flag  { 
60102    FooterPayloadCompressed  = 0 , 
@@ -91,10 +133,8 @@ impl Flag {
91133/// Metadata about a puffin file. 
92134/// For more information, see: https://iceberg.apache.org/puffin-spec/#filemetadata 
93135#[ derive( Debug ,  PartialEq ,  Eq ,  Serialize ,  Deserialize ,  Clone ) ]  
94- pub ( crate )  struct  FileMetadata  { 
95-     /// Metadata about blobs in file 
136+ pub  struct  FileMetadata  { 
96137    pub ( crate )  blobs :  Vec < BlobMetadata > , 
97-     /// Arbitrary meta-information, like writer identification/version. 
98138    #[ serde( skip_serializing_if = "HashMap::is_empty" ) ]  
99139    #[ serde( default ) ]  
100140    pub ( crate )  properties :  HashMap < String ,  String > , 
@@ -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 )  -> & [ 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