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

Method _StatInternal

serving/processor/framework/filesystem/oss_file_system.cc:686–726  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

684}
685
686Status OSSFileSystem::_StatInternal(aos_pool_t* pool,
687 const oss_request_options_t* options,
688 const std::string& bucket,
689 const std::string& object,
690 FileStatistics* stat) {
691 Status s = _RetrieveObjectMetadata(pool, options, bucket, object, stat);
692 if (s.ok()) {
693 VLOG(1) << "RetrieveObjectMetadata for object: " << object
694 << " file success";
695 return s;
696 }
697
698 // add suffix
699 std::string objectName = object + kDelim;
700 s = _RetrieveObjectMetadata(pool, options, bucket, objectName, stat);
701 if (s.ok()) {
702 VLOG(1) << "RetrieveObjectMetadata for object: " << objectName
703 << " directory success";
704 stat->is_directory = true;
705 return s;
706 }
707
708 // check list if it has children
709 std::vector<std::string> listing;
710 s = _ListObjects(pool, options, bucket, object, &listing, true, false, false,
711 10);
712
713 if (s == Status::OK() && !listing.empty()) {
714 if (str_util::EndsWith(object, "/")) {
715 stat->is_directory = true;
716 }
717 stat->length = 0;
718 VLOG(1) << "RetrieveObjectMetadata for object: " << object
719 << " get children success";
720 return s;
721 }
722
723 VLOG(1) << "_StatInternal for object: " << object
724 << ", failed with bucket: " << bucket;
725 return errors::NotFound("can not find ", object);
726}
727
728Status OSSFileSystem::_RetrieveObjectMetadata(
729 aos_pool_t* pool, const oss_request_options_t* options,

Callers

nothing calls this directly

Calls 4

EndsWithFunction · 0.85
NotFoundFunction · 0.85
okMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected