@@ -17,9 +17,8 @@ use azure_messaging_eventhubs::{
1717} ;
1818use azure_storage_blob:: {
1919 models:: {
20- BlobClientGetPropertiesResultHeaders , BlobClientSetMetadataOptions ,
21- BlobContainerClientListBlobFlatSegmentOptions , BlockBlobClientUploadOptions ,
22- BlockBlobClientUploadResultHeaders , ListBlobsIncludeItem ,
20+ BlobClientSetMetadataOptions , BlobContainerClientListBlobFlatSegmentOptions ,
21+ BlockBlobClientUploadOptions , BlockBlobClientUploadResultHeaders , ListBlobsIncludeItem ,
2322 } ,
2423 BlobContainerClient ,
2524} ;
@@ -250,18 +249,19 @@ impl CheckpointStore for BlobCheckpointStore {
250249 . map ( |pos| & name[ pos + 1 ..] )
251250 . unwrap_or_default ( )
252251 . to_string ( ) ;
253- // Since the current blob container client doesn't actually return the metadata, we
254- // get it from the blob client instead.
255- let blob = self
256- . blob_container_client
257- . blob_client ( name. clone ( ) )
258- . get_properties ( None )
259- . await ?;
260- if let Some ( offset) = blob. metadata ( ) ?. get ( OFFSET ) {
261- checkpoint. offset = Some ( offset. clone ( ) ) ;
262- }
263- if let Some ( sequence_number) = blob. metadata ( ) ?. get ( SEQUENCE_NUMBER ) {
264- checkpoint. sequence_number = Some ( sequence_number. parse ( ) ?) ;
252+ if let Some ( additional_properties) = blob
253+ . metadata
254+ . as_ref ( )
255+ . and_then ( |m| m. additional_properties . as_ref ( ) )
256+ {
257+ if let Some ( sequence_number) =
258+ additional_properties. get ( SEQUENCE_NUMBER )
259+ {
260+ checkpoint. sequence_number = Some ( sequence_number. parse ( ) ?) ;
261+ }
262+ if let Some ( offset) = additional_properties. get ( OFFSET ) {
263+ checkpoint. offset = Some ( offset. clone ( ) ) ;
264+ }
265265 }
266266 }
267267 }
@@ -318,17 +318,11 @@ impl CheckpointStore for BlobCheckpointStore {
318318 . map ( |pos| & name[ pos + 1 ..] )
319319 . unwrap_or_default ( )
320320 . to_string ( ) ;
321- // Since the current blob container client doesn't actually return the metadata, we
322- // get it from the blob client instead.
323- let blob = self
324- . blob_container_client
325- . blob_client ( name. clone ( ) )
326- . get_properties ( None )
327- . await ?;
328- let metadata = blob. metadata ( ) ?;
329- if let Some ( owner_id) = metadata. get ( OWNER_ID ) {
330- ownership. owner_id = Some ( owner_id. clone ( ) ) ;
331- }
321+ ownership. owner_id = blob
322+ . metadata
323+ . as_ref ( )
324+ . and_then ( |m| m. additional_properties . as_ref ( ) )
325+ . and_then ( |ap| ap. get ( OWNER_ID ) . cloned ( ) ) ;
332326 }
333327 }
334328 if let Some ( properties) = & blob. properties {
0 commit comments