MCPcopy Create free account
hub / github.com/apache/arrow / Move

Method Move

cpp/src/arrow/filesystem/s3fs.cc:3399–3416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3397}
3398
3399Status S3FileSystem::Move(const std::string& src, const std::string& dest) {
3400 // XXX We don't implement moving directories as it would be too expensive:
3401 // one must copy all directory contents one by one (including object data),
3402 // then delete the original contents.
3403
3404 ARROW_ASSIGN_OR_RAISE(auto src_path, S3Path::FromString(src));
3405 RETURN_NOT_OK(ValidateFilePath(src_path));
3406 ARROW_ASSIGN_OR_RAISE(auto dest_path, S3Path::FromString(dest));
3407 RETURN_NOT_OK(ValidateFilePath(dest_path));
3408
3409 if (src_path == dest_path) {
3410 return Status::OK();
3411 }
3412 RETURN_NOT_OK(impl_->CopyObject(src_path, dest_path));
3413 RETURN_NOT_OK(impl_->DeleteObject(src_path.bucket, src_path.key));
3414 // Source parent may be implicitly deleted if it became empty, recreate it
3415 return impl_->EnsureParentExists(src_path);
3416}
3417
3418Status S3FileSystem::CopyFile(const std::string& src, const std::string& dest) {
3419 ARROW_ASSIGN_OR_RAISE(auto src_path, S3Path::FromString(src));

Callers 15

TEST_FFunction · 0.45
InitMethod · 0.45
CreateMultipartUploadMethod · 0.45
AbortMethod · 0.45
TriggerUploadRequestMethod · 0.45
GetBackendMethod · 0.45
BucketExistsMethod · 0.45
CreateBucketMethod · 0.45
CreateEmptyDirMethod · 0.45
DeleteObjectMethod · 0.45
CopyObjectMethod · 0.45

Calls 5

ValidateFilePathFunction · 0.85
CopyObjectMethod · 0.80
DeleteObjectMethod · 0.80
EnsureParentExistsMethod · 0.80
OKFunction · 0.50

Tested by 10

TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TestMoveFileMethod · 0.36
TestMoveDirMethod · 0.36
TEST_FFunction · 0.36
TestBucketFunction · 0.36
TestMoveContainerToPathFunction · 0.36
TestMovePathFunction · 0.36