| 1944 | } |
| 1945 | |
| 1946 | Future<> FlushAsync() { |
| 1947 | if (closed_) { |
| 1948 | return Status::Invalid("Operation on closed stream"); |
| 1949 | } |
| 1950 | // Wait for background writes to finish |
| 1951 | std::unique_lock<std::mutex> lock(upload_state_->mutex); |
| 1952 | return upload_state_->pending_uploads_completed; |
| 1953 | } |
| 1954 | |
| 1955 | // Upload-related helpers |
| 1956 |