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

Method Run

cpp/src/arrow/filesystem/mockfs.cc:619–656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

617
618 template <typename OpFunc>
619 static Status Run(MockFileSystem::Impl* impl, const std::string& src,
620 const std::string& dest, OpFunc&& op_func) {
621 RETURN_NOT_OK(ValidatePath(src));
622 RETURN_NOT_OK(ValidatePath(dest));
623 auto src_parts = SplitAbstractPath(src);
624 auto dest_parts = SplitAbstractPath(dest);
625 RETURN_NOT_OK(ValidateAbstractPathParts(src_parts));
626 RETURN_NOT_OK(ValidateAbstractPathParts(dest_parts));
627
628 auto guard = impl->lock_guard();
629
630 // Both source and destination must have valid parents
631 Entry* src_parent = impl->FindParent(src_parts);
632 if (src_parent == nullptr || !src_parent->is_dir()) {
633 return PathNotFound(src);
634 }
635 Entry* dest_parent = impl->FindParent(dest_parts);
636 if (dest_parent == nullptr || !dest_parent->is_dir()) {
637 return PathNotFound(dest);
638 }
639 Directory& src_dir = src_parent->as_dir();
640 Directory& dest_dir = dest_parent->as_dir();
641 DCHECK_GE(src_parts.size(), 1);
642 DCHECK_GE(dest_parts.size(), 1);
643 const auto& src_name = src_parts.back();
644 const auto& dest_name = dest_parts.back();
645
646 BinaryOp op{std::move(src_parts),
647 std::move(dest_parts),
648 src_dir,
649 dest_dir,
650 src_name,
651 dest_name,
652 src_dir.Find(src_name),
653 dest_dir.Find(dest_name)};
654
655 return op_func(std::move(op));
656 }
657};
658
659} // namespace

Callers 1

TESTFunction · 0.45

Calls 10

SplitAbstractPathFunction · 0.85
lock_guardMethod · 0.80
FindParentMethod · 0.80
is_dirMethod · 0.80
backMethod · 0.80
ValidatePathFunction · 0.70
PathNotFoundFunction · 0.70
sizeMethod · 0.45
FindMethod · 0.45

Tested by 1

TESTFunction · 0.36