|
uvw 2.12.1
|
#include <fs.h>


Public Member Functions | |
| void | close () |
| Async close. | |
| bool | closeSync () |
| Sync close. | |
| void | open (const std::string &path, Flags< FileOpen > flags, int mode) |
| Async open. | |
| bool | openSync (const std::string &path, Flags< FileOpen > flags, int mode) |
| Sync open. | |
| void | read (int64_t offset, unsigned int len) |
| Async read. | |
| std::pair< bool, std::pair< std::unique_ptr< const char[]>, std::size_t > > | readSync (int64_t offset, unsigned int len) |
| Sync read. | |
| void | write (std::unique_ptr< char[]> buf, unsigned int len, int64_t offset) |
| Async write. | |
| void | write (char *buf, unsigned int len, int64_t offset) |
| Async write. | |
| std::pair< bool, std::size_t > | writeSync (std::unique_ptr< char[]> buf, unsigned int len, int64_t offset) |
| Sync write. | |
| void | stat () |
| Async fstat. | |
| std::pair< bool, Stat > | statSync () |
| Sync fstat. | |
| void | sync () |
| Async fsync. | |
| bool | syncSync () |
| Sync fsync. | |
| void | datasync () |
| Async fdatasync. | |
| bool | datasyncSync () |
| Sync fdatasync. | |
| void | truncate (int64_t offset) |
| Async ftruncate. | |
| bool | truncateSync (int64_t offset) |
| Sync ftruncate. | |
| void | sendfile (FileHandle out, int64_t offset, std::size_t length) |
| Async sendfile. | |
| std::pair< bool, std::size_t > | sendfileSync (FileHandle out, int64_t offset, std::size_t length) |
| Sync sendfile. | |
| void | chmod (int mode) |
| Async fchmod. | |
| bool | chmodSync (int mode) |
| Sync fchmod. | |
| void | futime (Time atime, Time mtime) |
| Async futime. | |
| bool | futimeSync (Time atime, Time mtime) |
| Sync futime. | |
| void | chown (Uid uid, Gid gid) |
| Async fchown. | |
| bool | chownSync (Uid uid, Gid gid) |
| Sync fchown. | |
| operator FileHandle () const noexcept | |
| Cast operator to FileHandle. | |
Public Member Functions inherited from uvw::Request< FileReq, uv_fs_t > | |
| bool | cancel () |
| Cancels a pending request. | |
| std::size_t | size () const noexcept |
| Returns the size of the underlying request type. | |
Public Member Functions inherited from uvw::Resource< FileReq, uv_fs_t > | |
| std::shared_ptr< R > | data () const |
Gets user-defined data. uvw won't use this field in any case. | |
| void | data (std::shared_ptr< void > uData) |
Sets arbitrary data. uvw won't use this field in any case. | |
Public Member Functions inherited from uvw::UnderlyingType< FileReq, uv_fs_t > | |
| Loop & | loop () const noexcept |
| Gets the loop from which the resource was originated. | |
| const uv_fs_t * | raw () const noexcept |
| Gets the underlying raw data structure. | |
| uv_fs_t * | raw () noexcept |
| Gets the underlying raw data structure. | |
Public Member Functions inherited from uvw::Emitter< FileReq > | |
| Connection< E > | on (Listener< E > f) |
| Registers a long-lived listener with the event emitter. | |
| Connection< E > | once (Listener< E > f) |
| Registers a short-lived listener with the event emitter. | |
| void | erase (Connection< E > conn) noexcept |
| Disconnects a listener from the event emitter. | |
| void | clear () noexcept |
| Disconnects all the listeners for the given event type. | |
| void | clear () noexcept |
| Disconnects all the listeners. | |
| bool | empty () const noexcept |
| Checks if there are listeners registered for the specific event. | |
| bool | empty () const noexcept |
| Checks if there are listeners registered with the event emitter. | |
Additional Inherited Members | |
Static Public Member Functions inherited from uvw::UnderlyingType< FileReq, uv_fs_t > | |
| static std::shared_ptr< FileReq > | create (Args &&...args) |
| Creates a new resource of the given type. | |
The FileReq request.
Cross-platform sync and async filesystem operations.
All file operations are run on the threadpool.
To create a FileReq through a Loop, no arguments are required.
See the official documentation for further details.
| void uvw::FileReq::chmod | ( | int | mode | ) |
Async fchmod.
Emit a FsEvent<FileReq::Type::FCHMOD> event when completed.
Emit an ErrorEvent event in case of errors.
| mode | Mode, as described in the official documentation. |
| bool uvw::FileReq::chmodSync | ( | int | mode | ) |
Sync fchmod.
| mode | Mode, as described in the official documentation. |
Async fchown.
Emit a FsEvent<FileReq::Type::FCHOWN> event when completed.
Emit an ErrorEvent event in case of errors.
| uid | UID, as described in the official documentation. |
| gid | GID, as described in the official documentation. |
Sync fchown.
| uid | UID, as described in the official documentation. |
| gid | GID, as described in the official documentation. |
| void uvw::FileReq::close | ( | ) |
Async close.
Emit a FsEvent<FileReq::Type::CLOSE> event when completed.
Emit an ErrorEvent event in case of errors.
| bool uvw::FileReq::closeSync | ( | ) |
Sync close.
| void uvw::FileReq::datasync | ( | ) |
Async fdatasync.
Emit a FsEvent<FileReq::Type::FDATASYNC> event when completed.
Emit an ErrorEvent event in case of errors.
| bool uvw::FileReq::datasyncSync | ( | ) |
Sync fdatasync.
| void uvw::FileReq::futime | ( | Time | atime, |
| Time | mtime ) |
Async futime.
Emit a FsEvent<FileReq::Type::FUTIME> event when completed.
Emit an ErrorEvent event in case of errors.
| atime | std::chrono::duration<double>, having the same meaning as described in the official documentation. |
| mtime | std::chrono::duration<double>, having the same meaning as described in the official documentation. |
| bool uvw::FileReq::futimeSync | ( | Time | atime, |
| Time | mtime ) |
Sync futime.
| atime | std::chrono::duration<double>, having the same meaning as described in the official documentation. |
| mtime | std::chrono::duration<double>, having the same meaning as described in the official documentation. |
| void uvw::FileReq::open | ( | const std::string & | path, |
| Flags< FileOpen > | flags, | ||
| int | mode ) |
Async open.
Emit a FsEvent<FileReq::Type::OPEN> event when completed.
Emit an ErrorEvent event in case of errors.
Available flags are:
FileReq::FileOpen::APPENDFileReq::FileOpen::CREATFileReq::FileOpen::DIRECTFileReq::FileOpen::DIRECTORYFileReq::FileOpen::DSYNCFileReq::FileOpen::EXCLFileReq::FileOpen::EXLOCKFileReq::FileOpen::FILEMAPFileReq::FileOpen::NOATIMEFileReq::FileOpen::NOCTTYFileReq::FileOpen::NOFOLLOWFileReq::FileOpen::NONBLOCKFileReq::FileOpen::RANDOMFileReq::FileOpen::RDONLYFileReq::FileOpen::RDWRFileReq::FileOpen::SEQUENTIALFileReq::FileOpen::SHORT_LIVEDFileReq::FileOpen::SYMLINKFileReq::FileOpen::SYNCFileReq::FileOpen::TEMPORARYFileReq::FileOpen::TRUNCFileReq::FileOpen::WRONLYSee the official documentation for further details.
| path | A valid path name for a file. |
| flags | Flags made out of underlying constants. |
| mode | Mode, as described in the official documentation. |
| bool uvw::FileReq::openSync | ( | const std::string & | path, |
| Flags< FileOpen > | flags, | ||
| int | mode ) |
Sync open.
Available flags are:
FileReq::FileOpen::APPENDFileReq::FileOpen::CREATFileReq::FileOpen::DIRECTFileReq::FileOpen::DIRECTORYFileReq::FileOpen::DSYNCFileReq::FileOpen::EXCLFileReq::FileOpen::EXLOCKFileReq::FileOpen::FILEMAPFileReq::FileOpen::NOATIMEFileReq::FileOpen::NOCTTYFileReq::FileOpen::NOFOLLOWFileReq::FileOpen::NONBLOCKFileReq::FileOpen::RANDOMFileReq::FileOpen::RDONLYFileReq::FileOpen::RDWRFileReq::FileOpen::SEQUENTIALFileReq::FileOpen::SHORT_LIVEDFileReq::FileOpen::SYMLINKFileReq::FileOpen::SYNCFileReq::FileOpen::TEMPORARYFileReq::FileOpen::TRUNCFileReq::FileOpen::WRONLYSee the official documentation for further details.
| path | A valid path name for a file. |
| flags | Flags made out of underlying constants. |
| mode | Mode, as described in the official documentation. |
|
noexcept |
Cast operator to FileHandle.
Cast operator to an internal representation of the underlying file handle.
| void uvw::FileReq::read | ( | int64_t | offset, |
| unsigned int | len ) |
Async read.
Emit a FsEvent<FileReq::Type::READ> event when completed.
Emit an ErrorEvent event in case of errors.
| offset | Offset, as described in the official documentation. |
| len | Length, as described in the official documentation. |
| std::pair< bool, std::pair< std::unique_ptr< const char[]>, std::size_t > > uvw::FileReq::readSync | ( | int64_t | offset, |
| unsigned int | len ) |
Sync read.
| offset | Offset, as described in the official documentation. |
| len | Length, as described in the official documentation. |
std::pair composed as it follows:std::pair composed as it follows:| void uvw::FileReq::sendfile | ( | FileHandle | out, |
| int64_t | offset, | ||
| std::size_t | length ) |
Async sendfile.
Emit a FsEvent<FileReq::Type::SENDFILE> event when completed.
Emit an ErrorEvent event in case of errors.
| out | A valid instance of FileHandle. |
| offset | Offset, as described in the official documentation. |
| length | Length, as described in the official documentation. |
| std::pair< bool, std::size_t > uvw::FileReq::sendfileSync | ( | FileHandle | out, |
| int64_t | offset, | ||
| std::size_t | length ) |
Sync sendfile.
| out | A valid instance of FileHandle. |
| offset | Offset, as described in the official documentation. |
| length | Length, as described in the official documentation. |
std::pair composed as it follows:| void uvw::FileReq::stat | ( | ) |
Async fstat.
Emit a FsEvent<FileReq::Type::FSTAT> event when completed.
Emit an ErrorEvent event in case of errors.
| std::pair< bool, Stat > uvw::FileReq::statSync | ( | ) |
| void uvw::FileReq::sync | ( | ) |
Async fsync.
Emit a FsEvent<FileReq::Type::FSYNC> event when completed.
Emit an ErrorEvent event in case of errors.
| bool uvw::FileReq::syncSync | ( | ) |
Sync fsync.
| void uvw::FileReq::truncate | ( | int64_t | offset | ) |
Async ftruncate.
Emit a FsEvent<FileReq::Type::FTRUNCATE> event when completed.
Emit an ErrorEvent event in case of errors.
| offset | Offset, as described in the official documentation. |
| bool uvw::FileReq::truncateSync | ( | int64_t | offset | ) |
Sync ftruncate.
| offset | Offset, as described in the official documentation. |
| void uvw::FileReq::write | ( | char * | buf, |
| unsigned int | len, | ||
| int64_t | offset ) |
Async write.
The request doesn't take the ownership of the data. Be sure that their lifetime overcome the one of the request.
Emit a FsEvent<FileReq::Type::WRITE> event when completed.
Emit an ErrorEvent event in case of errors.
| buf | The data to be written. |
| len | The lenght of the submitted data. |
| offset | Offset, as described in the official documentation. |
| void uvw::FileReq::write | ( | std::unique_ptr< char[]> | buf, |
| unsigned int | len, | ||
| int64_t | offset ) |
Async write.
The request takes the ownership of the data and it is in charge of delete them.
Emit a FsEvent<FileReq::Type::WRITE> event when completed.
Emit an ErrorEvent event in case of errors.
| buf | The data to be written. |
| len | The lenght of the submitted data. |
| offset | Offset, as described in the official documentation. |
| std::pair< bool, std::size_t > uvw::FileReq::writeSync | ( | std::unique_ptr< char[]> | buf, |
| unsigned int | len, | ||
| int64_t | offset ) |
Sync write.
| buf | The data to be written. |
| len | The lenght of the submitted data. |
| offset | Offset, as described in the official documentation. |
std::pair composed as it follows: