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

Method FromString

cpp/src/arrow/filesystem/gcsfs.cc:61–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 std::string object;
60
61 static Result<GcsPath> FromString(const std::string& s) {
62 if (internal::IsLikelyUri(s)) {
63 return Status::Invalid(
64 "Expected a GCS object path of the form 'bucket/key...', got a URI: '", s, "'");
65 }
66 const auto first_sep = s.find_first_of(internal::kSep);
67 if (first_sep == 0) {
68 return Status::Invalid("Path cannot start with a separator ('", s, "')");
69 }
70 if (first_sep == std::string::npos) {
71 return GcsPath{s, std::string(internal::RemoveTrailingSlash(s)), ""};
72 }
73 GcsPath path;
74 path.full_path = s;
75 path.bucket = s.substr(0, first_sep);
76 path.object = s.substr(first_sep + 1);
77 RETURN_NOT_OK(Validate(path));
78 return path;
79 }
80
81 static Status Validate(const GcsPath& path) {
82 auto st = internal::ValidateAbstractPath(path.full_path);

Callers

nothing calls this directly

Calls 5

IsLikelyUriFunction · 0.85
ValidateFunction · 0.85
substrMethod · 0.80
RemoveTrailingSlashFunction · 0.70
InvalidFunction · 0.50

Tested by

no test coverage detected