@@ -97,6 +97,11 @@ pub async fn put_object(
9797 e
9898 } ) ?;
9999
100+ // Persist the bucket registry so the new root CID survives restarts
101+ if let Err ( e) = state. bucket_manager . persist_registry ( ) . await {
102+ tracing:: warn!( error = %e, "Failed to persist bucket registry after put_object" ) ;
103+ }
104+
100105 // Pin the BUCKET ROOT CID to ensure tree structure survives GC.
101106 // This recursively pins all tree nodes AND all referenced object data.
102107 // NOTE: Pinning is async (fire-and-forget) to avoid blocking the response.
@@ -346,6 +351,11 @@ pub async fn delete_object(
346351 bucket. delete_object ( & key) . await ?;
347352 bucket. flush ( ) . await ?;
348353
354+ // Persist the bucket registry so the updated root CID survives restarts
355+ if let Err ( e) = state. bucket_manager . persist_registry ( ) . await {
356+ tracing:: warn!( error = %e, "Failed to persist bucket registry after delete_object" ) ;
357+ }
358+
349359 Ok ( StatusCode :: NO_CONTENT . into_response ( ) )
350360}
351361
@@ -408,6 +418,11 @@ pub async fn copy_object(
408418 dest_bucket_handle. put_object ( dest_key, dest_metadata. clone ( ) ) . await ?;
409419 dest_bucket_handle. flush ( ) . await ?;
410420
421+ // Persist the bucket registry so the updated root CID survives restarts
422+ if let Err ( e) = state. bucket_manager . persist_registry ( ) . await {
423+ tracing:: warn!( error = %e, "Failed to persist bucket registry after copy_object" ) ;
424+ }
425+
411426 let xml_response = xml:: copy_object_result (
412427 dest_metadata. last_modified ,
413428 & dest_metadata. etag ,
0 commit comments