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);
155 void copy(std::string_view src, std::string_view dst);
163 void rename(std::string_view src, std::string_view dst);
187 std::vector<Entry>
list(std::string_view path);
192 std::optional<rust::Box<opendal::ffi::Operator>> operator_;
205 :
public boost::iostreams::device<boost::iostreams::input_seekable> {
207 Reader(rust::Box<opendal::ffi::Reader> &&reader)
208 : raw_reader_(std::move(reader)) {}
210 std::streamsize
read(
void *s, std::streamsize n);
211 std::streampos
seek(std::streamoff off, std::ios_base::seekdir way);
214 rust::Box<opendal::ffi::Reader> raw_reader_;
228 :
public boost::iostreams::stream<boost::reference_wrapper<Reader>> {
231 : boost::iostreams::stream<boost::reference_wrapper<
Reader>>(
232 boost::ref(reader_)),
233 reader_(std::move(reader)) {}
253 Lister(rust::Box<opendal::ffi::Lister> &&lister)
254 : raw_lister_(std::move(lister)) {}
271 current_entry_ = lister_.
next();
277 if (current_entry_) {
278 current_entry_ = lister_.
next();
284 return current_entry_ != std::nullopt ||
285 other.current_entry_ != std::nullopt;
294 std::optional<Entry> current_entry_;
310 rust::Box<opendal::ffi::Lister> raw_lister_;
ListerIterator is an iterator of Lister.
Definition: opendal.hpp:262
bool operator!=(const ListerIterator &other) const
Definition: opendal.hpp:283
ListerIterator & operator++()
Definition: opendal.hpp:276
Entry operator*()
Definition: opendal.hpp:274
ListerIterator(Lister &lister, bool)
Definition: opendal.hpp:290
ListerIterator(Lister &lister)
Definition: opendal.hpp:270
std::ptrdiff_t difference_type
Definition: opendal.hpp:266
std::input_iterator_tag iterator_category
Definition: opendal.hpp:264
Lister is designed to list the entries of a directory.
Definition: opendal.hpp:251
Lister(rust::Box< opendal::ffi::Lister > &&lister)
Definition: opendal.hpp:253
ListerIterator end()
Definition: opendal.hpp:307
ListerIterator begin()
Definition: opendal.hpp:306
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.
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.
Operator & operator=(Operator &&)=default
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
Reader reader(std::string_view path)
Read data from the operator.
std::vector< uint8_t > read(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:228
ReaderStream(Reader &&reader)
Definition: opendal.hpp:230
Reader is designed to read data from the operator.
Definition: opendal.hpp:205
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:207
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