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

Method Init

cpp/src/arrow/filesystem/azurefs.cc:807–832  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

805 content_length_(size) {}
806
807 Status Init() {
808 if (content_length_ != kNoSize) {
809 // When the user provides the file size we don't validate that its a file. This is
810 // only a read so its not a big deal if the user makes a mistake.
811 DCHECK_GE(content_length_, 0);
812 return Status::OK();
813 }
814 try {
815 // To open an ObjectInputFile the Blob must exist and it must not represent
816 // a directory. Additionally we need to know the file size.
817 auto properties = blob_client_->GetProperties();
818 if (MetadataIndicatesIsDirectory(properties.Value.Metadata)) {
819 return NotAFile(location_);
820 }
821 content_length_ = properties.Value.BlobSize;
822 metadata_ = PropertiesToMetadata(properties.Value);
823 return Status::OK();
824 } catch (const Core::RequestFailedException& exception) {
825 if (exception.StatusCode == Http::HttpStatusCode::NotFound) {
826 return PathNotFound(location_);
827 }
828 return ExceptionToStatus(
829 exception, "GetProperties failed for '", blob_client_->GetUrl(),
830 "'. Cannot initialise an ObjectInputFile without knowing the file size.");
831 }
832 }
833
834 Status CheckClosed(const char* action) const {
835 if (closed_) {

Callers 2

OpenInputFileMethod · 0.45
OpenAppendStreamMethod · 0.45

Calls 7

PropertiesToMetadataFunction · 0.85
ExceptionToStatusFunction · 0.85
NotAFileFunction · 0.70
PathNotFoundFunction · 0.70
OKFunction · 0.50
GetPropertiesMethod · 0.45

Tested by

no test coverage detected