MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ParseS3Path

Function ParseS3Path

tensorflow/core/platform/s3/s3_file_system.cc:142–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142Status ParseS3Path(const string& fname, bool empty_object_ok, string* bucket,
143 string* object) {
144 if (!bucket || !object) {
145 return errors::Internal("bucket and object cannot be null.");
146 }
147 StringPiece scheme, bucketp, objectp;
148 io::ParseURI(fname, &scheme, &bucketp, &objectp);
149 if (scheme != "s3") {
150 return errors::InvalidArgument("S3 path doesn't start with 's3://': ",
151 fname);
152 }
153 *bucket = string(bucketp);
154 if (bucket->empty() || *bucket == ".") {
155 return errors::InvalidArgument("S3 path doesn't contain a bucket name: ",
156 fname);
157 }
158 absl::ConsumePrefix(&objectp, "/");
159 *object = string(objectp);
160 if (!empty_object_ok && object->empty()) {
161 return errors::InvalidArgument("S3 path doesn't contain an object name: ",
162 fname);
163 }
164 return Status::OK();
165}
166
167class S3RandomAccessFile : public RandomAccessFile {
168 public:

Callers 9

NewRandomAccessFileMethod · 0.85
NewWritableFileMethod · 0.85
NewAppendableFileMethod · 0.85
GetChildrenMethod · 0.85
StatMethod · 0.85
DeleteFileMethod · 0.85
CreateDirMethod · 0.85
DeleteDirMethod · 0.85
RenameFileMethod · 0.85

Calls 5

InternalFunction · 0.85
ParseURIFunction · 0.85
InvalidArgumentFunction · 0.85
ConsumePrefixFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected