Write data to a file. More...
#include "request-fs.hpp"
Public Types | |
using | on_request_t = std::function< void(write _request, buffer _buffer) > |
The function type of the callback called when data was written to the file. | |
Public Types inherited from uv::fs | |
using | uv_t = ::uv_fs_t |
Public Types inherited from uv::request | |
using | uv_t = ::uv_req_t |
using | on_destroy_t = std::function< void(void *_data) > |
The function type of the callback called when the request object is about to be destroyed. | |
Public Member Functions | |
write (const write &)=default | |
write & | operator= (const write &)=default |
write (write &&) noexcept=default | |
write & | operator= (write &&) noexcept=default |
on_request_t & | on_request () const noexcept |
file | handle () const noexcept |
The file which this write request has been running on. More... | |
int64_t | offset () const noexcept |
The offset this write request has been performed at. | |
int | run (file &_file, const buffer &_buf, int64_t _offset) |
Run the request. Write data to the _file from the buffers described by _buf object. More... | |
int | try_write (file &_file, const buffer &_buf, int64_t _offset) |
Try to execute the request synchronously if it can be completed immediately... More... | |
operator const uv_t * () const noexcept | |
operator uv_t * () noexcept | |
Public Member Functions inherited from uv::fs | |
fs (const fs &)=default | |
fs & | operator= (const fs &)=default |
fs (fs &&) noexcept=default | |
fs & | operator= (fs &&) noexcept=default |
::uv_fs_type | fs_type () const noexcept |
The tag indicating a subtype of the filesystem request. More... | |
uv::loop | loop () const noexcept |
The libuv loop that started this filesystem request and where completion will be reported. | |
operator const uv_t * () const noexcept | |
operator uv_t * () noexcept | |
Public Member Functions inherited from uv::request | |
request (const request &_that) | |
request & | operator= (const request &_that) |
request (request &&_that) noexcept | |
request & | operator= (request &&_that) noexcept |
void | swap (request &_that) noexcept |
std::uintptr_t | id () const noexcept |
long | nrefs () const noexcept |
The current number of existing references to the same object as this request variable refers to. | |
int | uv_status () const noexcept |
The status value returned by the last executed libuv API function on this request. | |
on_destroy_t & | on_destroy () const noexcept |
::uv_req_type | type () const noexcept |
The tag indicating a libuv type of the request. More... | |
const char * | type_name () const noexcept |
A string containing the name of the request type. | |
void *const & | data () const noexcept |
The pointer to the user-defined arbitrary data. libuv and uvcc does not use this field. | |
void *& | data () noexcept |
int | cancel () noexcept |
Cancel a pending request. More... | |
operator const uv_t * () const noexcept | |
operator uv_t * () noexcept | |
operator bool () const noexcept | |
Equivalent to (uv_status() >= 0) . | |
Write data to a file.
Definition at line 416 of file request-fs.hpp.
|
inlinenoexcept |
The file which this write request has been running on.
It is guaranteed that it will be a valid instance at least within the request callback.
Definition at line 471 of file request-fs.hpp.
Run the request. Write data to the _file
from the buffers described by _buf
object.
uv_fs_write()
. pwritev()
. The _offset
value of < 0 means using of the current file position.
_tell()
, _telli64()
. Definition at line 483 of file request-fs.hpp.
Try to execute the request synchronously if it can be completed immediately...
...i.e. if (_file.write_queue_size() == 0)
and without calling the request callback.
The _offset
value of < 0 means using of the current file position.
UV_EAGAIN
error code when the data can’t be written immediately. _tell()
, _telli64()
. Definition at line 561 of file request-fs.hpp.