25#include <unordered_map>
28#include "boost/date_time/posix_time/posix_time.hpp"
29#include "boost/iostreams/concepts.hpp"
30#include "boost/iostreams/stream.hpp"
56 std::optional<std::string>
etag;
90 const std::unordered_map<std::string, std::string> &config = {});
116 std::vector<uint8_t>
read(std::string_view path);
124 void write(std::string_view path,
const std::vector<uint8_t> &data);
140 [[deprecated(
"Use exists() instead.")]]
164 void copy(std::string_view src, std::string_view dst);
172 void rename(std::string_view src, std::string_view dst);
196 std::vector<Entry>
list(std::string_view path);
201 std::optional<rust::Box<opendal::ffi::Operator>> operator_;
214 :
public boost::iostreams::device<boost::iostreams::input_seekable> {
216 Reader(rust::Box<opendal::ffi::Reader> &&reader)
217 : raw_reader_(std::move(reader)) {}
219 std::streamsize
read(
void *s, std::streamsize n);
220 std::streampos
seek(std::streamoff off, std::ios_base::seekdir way);
223 rust::Box<opendal::ffi::Reader> raw_reader_;
237 :
public boost::iostreams::stream<boost::reference_wrapper<Reader>> {
240 : boost::iostreams::stream<boost::reference_wrapper<
Reader>>(
241 boost::ref(reader_)),
242 reader_(std::move(reader)) {}
262 Lister(rust::Box<opendal::ffi::Lister> &&lister)
263 : raw_lister_(std::move(lister)) {}
280 current_entry_ = lister_.
next();
286 if (current_entry_) {
287 current_entry_ = lister_.
next();
293 return current_entry_ != std::nullopt ||
294 other.current_entry_ != std::nullopt;
303 std::optional<Entry> current_entry_;
319 rust::Box<opendal::ffi::Lister> raw_lister_;
ListerIterator is an iterator of Lister.
Definition opendal.hpp:271
ListerIterator & operator++()
Definition opendal.hpp:285
bool operator!=(const ListerIterator &other) const
Definition opendal.hpp:292
Entry operator*()
Definition opendal.hpp:283
ListerIterator(Lister &lister, bool)
Definition opendal.hpp:299
ListerIterator(Lister &lister)
Definition opendal.hpp:279
std::ptrdiff_t difference_type
Definition opendal.hpp:275
std::input_iterator_tag iterator_category
Definition opendal.hpp:273
Lister is designed to list the entries of a directory.
Definition opendal.hpp:260
Lister(rust::Box< opendal::ffi::Lister > &&lister)
Definition opendal.hpp:262
ListerIterator end()
Definition opendal.hpp:316
ListerIterator begin()
Definition opendal.hpp:315
std::optional< Entry > next()
Get the next entry of the lister.
Operator is the entry for all public APIs.
Definition opendal.hpp:79
void rename(std::string_view src, std::string_view dst)
Rename a file from src to dst.
Operator & operator=(Operator &&)=default
Lister lister(std::string_view path)
void create_dir(std::string_view path)
Create a directory.
Operator(Operator &&)=default
void remove(std::string_view path)
Remove a file or directory.
Metadata stat(std::string_view path)
Get the metadata of a file or directory.
void write(std::string_view path, const std::vector< uint8_t > &data)
Write data to the operator.
std::vector< Entry > list(std::string_view path)
List the entries of a directory.
Operator(const Operator &)=delete
bool is_exist(std::string_view path)
Check if the path exists.
Operator(std::string_view scheme, const std::unordered_map< std::string, std::string > &config={})
Construct a new Operator object.
Operator & operator=(const Operator &)=delete
bool exists(std::string_view path)
Check if the path exists.
std::vector< uint8_t > read(std::string_view path)
Read data from the operator.
Reader reader(std::string_view path)
Read data from the operator.
void copy(std::string_view src, std::string_view dst)
Copy a file from src to dst.
bool available() const
Check if the operator is available.
ReaderStream is a stream wrapper of Reader which can provide iostream interface. It will keep a Reade...
Definition opendal.hpp:237
ReaderStream(Reader &&reader)
Definition opendal.hpp:239
Reader is designed to read data from the operator.
Definition opendal.hpp:214
std::streampos seek(std::streamoff off, std::ios_base::seekdir way)
std::streamsize read(void *s, std::streamsize n)
Reader(rust::Box< opendal::ffi::Reader > &&reader)
Definition opendal.hpp:216
Definition opendal.hpp:33
EntryMode
The mode of the entry.
Definition opendal.hpp:39
@ FILE
Definition opendal.hpp:40
@ UNKNOWN
Definition opendal.hpp:42
@ DIR
Definition opendal.hpp:41
The entry of a file or directory.
Definition opendal.hpp:66
std::string path
Definition opendal.hpp:67