MongoDB C++ Driver
mongocxx-3.7.0
|
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::gridfs::uploader::abort | ( | ) |
Aborts uploading the file.
mongocxx::logic_error | if the upload stream was already closed. |
mongocxx::bulk_write_exception | if an error occurs when removing chunk data from the database. |
std::int32_t mongocxx::gridfs::uploader::chunk_size | ( | ) | const |
Gets the chunk size of the file being uploaded.
result::gridfs::upload mongocxx::gridfs::uploader::close | ( | ) |
Closes the uploader stream.
mongocxx::logic_error | if the upload stream was already closed. |
mongocxx::bulk_write_exception | if an error occurs when writing chunk data or file metadata to the database. |
mongocxx::gridfs_exception | if the uploader requires more than 2^31-1 chunks to store the file at the requested chunk size. |
void mongocxx::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::logic_error | if the upload stream was already closed. |
mongocxx::bulk_write_exception | if an error occurs when writing chunk data to the database. |
mongocxx::gridfs_exception | if the uploader requires more than 2^31-1 chunks to store the file at the requested chunk size. |