32#include <unordered_map>
42class SupportsStorageCredentials;
156 std::optional<size_t> length);
170 return NotImplemented(
"DeleteFile not implemented");
190 virtual const std::unordered_map<std::string, std::string>&
properties()
const {
191 static const std::unordered_map<std::string, std::string> kEmpty;
205 const std::vector<StorageCredential>& storage_credentials) = 0;
217 const std::vector<StorageCredential>& storage_credentials,
218 std::shared_ptr<StorageCredentialProvider> provider) {
220 return NotSupported(
"Credential refresh is not supported");
222 return SetStorageCredentials(storage_credentials);
Pluggable module for reading, writing, and deleting files.
Definition file_io.h:130
virtual Result< std::unique_ptr< InputFile > > NewInputFile(std::string file_location, size_t length)
Create an input file handle for the given location with a known length.
virtual Result< std::unique_ptr< OutputFile > > NewOutputFile(std::string file_location)
Create an output file handle for the given location.
virtual const std::unordered_map< std::string, std::string > & properties() const
Return the configuration used to create this FileIO.
Definition file_io.h:190
virtual SupportsStorageCredentials * AsSupportsStorageCredentials()
Return storage-credential support when implemented by this FileIO.
Definition file_io.h:184
virtual Status WriteFile(const std::string &file_location, std::string_view content)
Write the given content to the file at the given location.
virtual Result< std::unique_ptr< InputFile > > NewInputFile(std::string file_location)
Create an input file handle for the given location.
virtual Result< std::string > ReadFile(const std::string &file_location, std::optional< size_t > length)
Read the content of the file at the given location.
virtual Status DeleteFile(const std::string &)
Delete a file at the given location.
Definition file_io.h:169
virtual Status DeleteFiles(const std::vector< std::string > &file_locations)
Delete files at the given locations.
Handle for creating a writable file.
Definition file_io.h:109
virtual Result< std::unique_ptr< PositionOutputStream > > CreateOrOverwrite()=0
Create a new output stream, replacing any existing file.
virtual std::string_view location() const =0
File location represented by this handle.
virtual Result< std::unique_ptr< PositionOutputStream > > Create()=0
Create a new output stream and fail if the file already exists.
Positioned byte stream for writing file contents.
Definition file_io.h:70
virtual Result< int64_t > Position() const =0
Return the current write position.
virtual Status Write(std::span< const std::byte > data)=0
Write all bytes in data at the current position.
virtual Status Flush()=0
Flush buffered data to the underlying store.
virtual Status Close()=0
Close the stream. Implementations should allow repeated Close calls.
virtual Result< int64_t > StoredLength() const
Return the current stored length of the output.
Definition file_io.h:81
Mix-in for FileIO implementations that route object paths to per-prefix file systems built from vende...
Definition file_io.h:199
virtual Status SetStorageCredentials(const std::vector< StorageCredential > &storage_credentials)=0
Install vended storage credentials.
virtual std::vector< StorageCredential > credentials() const =0
Return the storage credentials this FileIO holds.
virtual Status InitializeStorageCredentials(const std::vector< StorageCredential > &storage_credentials, std::shared_ptr< StorageCredentialProvider > provider)
Install initial credentials and their refresh source before first use.
Definition file_io.h:216
Definition expected.h:1199
Define symbol visibility macros for core Iceberg APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:34
Define Result, Status, and error helpers.
Define storage credential metadata.