#include <mongocxx/v1/gridfs/uploader.hpp>
Support for uploading files to a GridFS bucket.
- See also
-
- Attention
- This feature is experimental! It is not ready for use!
|
| | uploader () |
| | Default initialization.
|
| | uploader (uploader &&other) noexcept |
| | Move constructor.
|
| | uploader (uploader const &other)=delete |
| | This class is not copyable.
|
| | ~uploader () |
| | Destroy this object.
|
| void | abort () |
| | Abort uploading this GridFS file.
|
| std::int32_t | chunk_size () const |
| | Return the chunk size (in bytes) of the associated GridFS file.
|
| v1::gridfs::upload_result | close () |
| | Complete the upload of this GridFS file.
|
| void | flush () |
| | Flush the internal buffer.
|
| bool | is_open () const |
| | Return true when the underlying GridFS file stream is open for writing.
|
| | operator bool () const |
| | Return true when *this is NOT in an assign-or-destroy-only state and this->is_open() == true.
|
| uploader & | operator= (uploader &&other) noexcept |
| | Move assignment.
|
| uploader & | operator= (uploader const &other)=delete |
| | This class is not copyable.
|
| void | write (std::uint8_t const *data, std::size_t length) |
| | Write length bytes of the associated GridFS file.
|
◆ errc
Errors codes which may be returned by mongocxx::v1::gridfs::uploader.
- Attention
- This feature is experimental! It is not ready for use!
| Enumerator |
|---|
| zero | Zero.
|
| is_closed | The GridFS file upload stream is not open.
|
| too_many_chunks | The total number of chunks must be less than INT32_MAX.
|
◆ ~uploader()
| mongocxx::v1::gridfs::uploader::~uploader |
( |
| ) |
|
Destroy this object.
Calls close(). Any exceptions are caught and ignored.
- Note
- When a server-side error is encountered, already-uploaded chunks are "orphaned" and no cleanup attempt is made.
◆ uploader() [1/3]
| mongocxx::v1::gridfs::uploader::uploader |
( |
uploader && | other | ) |
|
|
noexcept |
Move constructor.
- Postconditions:
- other is in an assign-or-destroy-only state.
◆ uploader() [2/3]
| mongocxx::v1::gridfs::uploader::uploader |
( |
uploader const & | other | ) |
|
|
delete |
This class is not copyable.
◆ uploader() [3/3]
| mongocxx::v1::gridfs::uploader::uploader |
( |
| ) |
|
Default initialization.
- Postconditions:
- *this is in an assign-or-destroy-only state.
◆ abort()
| void mongocxx::v1::gridfs::uploader::abort |
( |
| ) |
|
Abort uploading this GridFS file.
- Note
- When a server-side error is encountered, already-uploaded chunks are "orphaned" and no cleanup attempt is made.
- Postconditions:
- All uploaded chunks for this GridFS file are deleted, unless a server-side error is encountered.
- Exceptions
-
◆ chunk_size()
| std::int32_t mongocxx::v1::gridfs::uploader::chunk_size |
( |
| ) |
const |
Return the chunk size (in bytes) of the associated GridFS file.
◆ close()
Complete the upload of this GridFS file.
- Note
- When a server-side error is encountered, already-uploaded chunks are "orphaned" and no cleanup attempt is made.
- Returns
- The files collection document for the successfully uploaded GridFS file.
- Exceptions
-
◆ error_category()
| std::error_category const & mongocxx::v1::gridfs::uploader::error_category |
( |
| ) |
|
|
static |
◆ flush()
| void mongocxx::v1::gridfs::uploader::flush |
( |
| ) |
|
Flush the internal buffer.
- Note
- When a server-side error is encountered, already-uploaded chunks are "orphaned" and no cleanup attempt is made.
- Exceptions
-
◆ is_open()
| bool mongocxx::v1::gridfs::uploader::is_open |
( |
| ) |
const |
Return true when the underlying GridFS file stream is open for writing.
◆ operator bool()
| mongocxx::v1::gridfs::uploader::operator bool |
( |
| ) |
const |
|
explicit |
Return true when *this is NOT in an assign-or-destroy-only state and this->is_open() == true.
◆ operator=() [1/2]
Move assignment.
- Postconditions:
- other is in an assign-or-destroy-only state.
◆ operator=() [2/2]
This class is not copyable.
◆ write()
| void mongocxx::v1::gridfs::uploader::write |
( |
std::uint8_t const * | data, |
|
|
std::size_t | length ) |
Write length bytes of the associated GridFS file.
An internal buffer is used to reduce the total number of collection write operations. Use flush() to manually flush the internal buffer.
- Note
- When a server-side error is encountered, already-uploaded chunks are "orphaned" and no cleanup attempt is made.
- Preconditions:
- data is not null.
- The size of the storage region pointed to by data must be greater than or equal to length.
- Exceptions
-
◆ make_error_code
| std::error_code make_error_code |
( |
errc | v | ) |
|
|
friend |
Support implicit conversion to std::error_code.
- Attention
- This feature is experimental! It is not ready for use!
The documentation for this class was generated from the following file: