Helper to wait for the disk file changing to specific status. Will timeout after 20 seconds.
| 315 | /// Helper to wait for the disk file changing to specific status. Will timeout after 20 |
| 316 | /// seconds. |
| 317 | static bool WaitForDiskFileStatus(DiskFile* file, DiskFileStatus status) { |
| 318 | DCHECK(file != nullptr); |
| 319 | int wait_times = 20; |
| 320 | while (wait_times-- > 0) { |
| 321 | if (file->GetFileStatus() == status) { |
| 322 | return true; |
| 323 | } |
| 324 | usleep(1000 * 1000); // sleep 1s each round. |
| 325 | } |
| 326 | return false; |
| 327 | } |
| 328 | |
| 329 | /// Helper to get the remote temporary file from the temporary file group. |
| 330 | static TmpFileRemote* GetRemoteTmpFileByFileGroup(TmpFileGroup& file_group, int idx) { |
nothing calls this directly
no test coverage detected