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

Method Stat

tensorflow/core/platform/cloud/gcs_file_system.cc:1493–1525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1491}
1492
1493Status GcsFileSystem::Stat(const string& fname, FileStatistics* stat) {
1494 if (!stat) {
1495 return errors::Internal("'stat' cannot be nullptr.");
1496 }
1497 string bucket, object;
1498 TF_RETURN_IF_ERROR(ParseGcsPath(fname, true, &bucket, &object));
1499 if (object.empty()) {
1500 bool is_bucket;
1501 TF_RETURN_IF_ERROR(BucketExists(bucket, &is_bucket));
1502 if (is_bucket) {
1503 *stat = DIRECTORY_STAT;
1504 return Status::OK();
1505 }
1506 return errors::NotFound("The specified bucket ", fname, " was not found.");
1507 }
1508
1509 GcsFileStat gcs_stat;
1510 const Status status = StatForObject(fname, bucket, object, &gcs_stat);
1511 if (status.ok()) {
1512 *stat = gcs_stat.base;
1513 return Status::OK();
1514 }
1515 if (status.code() != errors::Code::NOT_FOUND) {
1516 return status;
1517 }
1518 bool is_folder;
1519 TF_RETURN_IF_ERROR(FolderExists(fname, &is_folder));
1520 if (is_folder) {
1521 *stat = DIRECTORY_STAT;
1522 return Status::OK();
1523 }
1524 return errors::NotFound("The specified path ", fname, " was not found.");
1525}
1526
1527Status GcsFileSystem::DeleteFile(const string& fname) {
1528 string bucket, object;

Callers 1

TESTFunction · 0.45

Calls 6

InternalFunction · 0.85
ParseGcsPathFunction · 0.85
NotFoundFunction · 0.85
emptyMethod · 0.45
okMethod · 0.45
codeMethod · 0.45

Tested by 1

TESTFunction · 0.36