MongoDB C++ Driver
mongocxx-3.10.2
|
Class used to upload a GridFS file. More...
#include <uploader.hpp>
Public Member Functions | |
uploader () noexcept | |
Default constructs an uploader object. More... | |
uploader (uploader &&) noexcept | |
Move constructs an uploader. | |
uploader & | operator= (uploader &&) noexcept |
Move assigns an uploader. | |
~uploader () | |
Destroys an uploader. | |
operator bool () const noexcept | |
Returns true if the uploader is valid, meaning it was not default constructed or moved from. | |
void | write (const std::uint8_t *bytes, std::size_t length) |
Writes a specified number of bytes to a GridFS file. More... | |
result::gridfs::upload | close () |
Closes the uploader stream. More... | |
void | abort () |
Aborts uploading the file. More... | |
std::int32_t | chunk_size () const |
Gets the chunk size of the file being uploaded. More... | |
Class used to upload a GridFS file.
|
noexcept |
Default constructs an uploader object.
The uploader is equivalent to the state of a moved from uploader. The only valid actions to take with a default constructed uploader are to assign to it, or destroy it.
void mongocxx::v_noabi::gridfs::uploader::abort | ( | ) |
Aborts uploading the file.
mongocxx::v_noabi::logic_error | if the upload stream was already closed. |
mongocxx::v_noabi::bulk_write_exception | if an error occurs when removing chunk data from the database. |
std::int32_t mongocxx::v_noabi::gridfs::uploader::chunk_size | ( | ) | const |
Gets the chunk size of the file being uploaded.
result::gridfs::upload mongocxx::v_noabi::gridfs::uploader::close | ( | ) |
Closes the uploader stream.
mongocxx::v_noabi::logic_error | if the upload stream was already closed. |
mongocxx::v_noabi::bulk_write_exception | if an error occurs when writing chunk data or file metadata to the database. |
mongocxx::v_noabi::gridfs_exception | if the uploader requires more than 2^31-1 chunks to store the file at the requested chunk size. |
void mongocxx::v_noabi::gridfs::uploader::write | ( | const std::uint8_t * | bytes, |
std::size_t | length | ||
) |
Writes a specified number of bytes to a GridFS file.
bytes | A pointer to the bytes to write. |
length | The number of bytes to write. |
mongocxx::v_noabi::logic_error | if the upload stream was already closed. |
mongocxx::v_noabi::bulk_write_exception | if an error occurs when writing chunk data to the database. |
mongocxx::v_noabi::gridfs_exception | if the uploader requires more than 2^31-1 chunks to store the file at the requested chunk size. |