|
uvw 3.4.0
|
The fs request. More...
#include <fs.h>


Public Member Functions | |
| void | unlink (const std::string &path) |
| Async unlink. | |
| bool | unlink_sync (const std::string &path) |
| Sync unlink. | |
| void | mkdir (const std::string &path, int mode) |
| Async mkdir. | |
| bool | mkdir_sync (const std::string &path, int mode) |
| Sync mkdir. | |
| void | mkdtemp (const std::string &tpl) |
| Async mktemp. | |
| std::pair< bool, const char * > | mkdtemp_sync (const std::string &tpl) |
| Sync mktemp. | |
| void | mkstemp (const std::string &tpl) |
| Async mkstemp. | |
| std::pair< bool, std::pair< std::string, std::size_t > > | mkstemp_sync (const std::string &tpl) |
| Sync mkstemp. | |
| void | lutime (const std::string &path, time atime, time mtime) |
| Async lutime. | |
| bool | lutime_sync (const std::string &path, time atime, time mtime) |
| Sync lutime. | |
| void | rmdir (const std::string &path) |
| Async rmdir. | |
| bool | rmdir_sync (const std::string &path) |
| Sync rmdir. | |
| void | scandir (const std::string &path, int flags) |
| Async scandir. | |
| std::pair< bool, std::size_t > | scandir_sync (const std::string &path, int flags) |
| Sync scandir. | |
| std::pair< bool, std::pair< entry_type, const char * > > | scandir_next () |
| Gets entries populated with the next directory entry data. | |
| void | stat (const std::string &path) |
| Async stat. | |
| std::pair< bool, file_info > | stat_sync (const std::string &path) |
| Sync stat. | |
| void | lstat (const std::string &path) |
| Async lstat. | |
| std::pair< bool, file_info > | lstat_sync (const std::string &path) |
| Sync lstat. | |
| void | statfs (const std::string &path) |
| Async statfs. | |
| std::pair< bool, fs_info > | statfs_sync (const std::string &path) |
| Sync statfs. | |
| void | rename (const std::string &old, const std::string &path) |
| Async rename. | |
| bool | rename_sync (const std::string &old, const std::string &path) |
| Sync rename. | |
| void | copyfile (const std::string &old, const std::string &path, copy_file_flags flags=copy_file_flags::_UVW_ENUM) |
| Copies a file asynchronously from a path to a new one. | |
| bool | copyfile_sync (const std::string &old, const std::string &path, copy_file_flags flags=copy_file_flags::_UVW_ENUM) |
| Copies a file synchronously from a path to a new one. | |
| void | access (const std::string &path, int mode) |
| Async access. | |
| bool | access_sync (const std::string &path, int mode) |
| Sync access. | |
| void | chmod (const std::string &path, int mode) |
| Async chmod. | |
| bool | chmod_sync (const std::string &path, int mode) |
| Sync chmod. | |
| void | utime (const std::string &path, time atime, time mtime) |
| Async utime. | |
| bool | utime_sync (const std::string &path, time atime, time mtime) |
| Sync utime. | |
| void | link (const std::string &old, const std::string &path) |
| Async link. | |
| bool | link_sync (const std::string &old, const std::string &path) |
| Sync link. | |
| void | symlink (const std::string &old, const std::string &path, symlink_flags flags=symlink_flags::_UVW_ENUM) |
| Async symlink. | |
| bool | symlink_sync (const std::string &old, const std::string &path, symlink_flags flags=symlink_flags::_UVW_ENUM) |
| Sync symlink. | |
| void | readlink (const std::string &path) |
| Async readlink. | |
| std::pair< bool, std::pair< const char *, std::size_t > > | readlink_sync (const std::string &path) |
| Sync readlink. | |
| void | realpath (const std::string &path) |
| Async realpath. | |
| std::pair< bool, const char * > | realpath_sync (const std::string &path) |
| Sync realpath. | |
| void | chown (const std::string &path, uid_type uid, gid_type gid) |
| Async chown. | |
| bool | chown_sync (const std::string &path, uid_type uid, gid_type gid) |
| Sync chown. | |
| void | lchown (const std::string &path, uid_type uid, gid_type gid) |
| Async lchown. | |
| bool | lchown_sync (const std::string &path, uid_type uid, gid_type gid) |
| Sync lchown. | |
| void | opendir (const std::string &path) |
| Opens a path asynchronously as a directory stream. | |
| bool | opendir_sync (const std::string &path) |
| Opens a path synchronously as a directory stream. | |
| void | closedir () |
| Closes asynchronously a directory stream. | |
| bool | closedir_sync () |
| Closes synchronously a directory stream. | |
| void | readdir () |
| Iterates asynchronously over a directory stream one entry at a time. | |
| std::pair< bool, std::pair< entry_type, const char * > > | readdir_sync () |
| Iterates synchronously over a directory stream one entry at a time. | |
| Public Member Functions inherited from uvw::request< fs_req, uv_fs_t, fs_event > | |
| int | 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< fs_req, uv_fs_t, E... > | |
| std::shared_ptr< R > | data () const |
| Gets user-defined data. uvw won't use this field in any case. | |
| Public Member Functions inherited from uvw::uv_type< uv_fs_t > | |
| loop & | parent () const noexcept |
| Gets the loop from which the resource was originated. | |
| const uv_fs_t * | raw () const noexcept |
| Gets the underlying raw data structure. | |
| Public Member Functions inherited from uvw::emitter< fs_req, E... > | |
| void | on (listener_t< Type > f) |
| Registers a long-lived listener with the event emitter. | |
| void | reset () noexcept |
| Disconnects the listener for the given event type. | |
| bool | has () const noexcept |
| Checks if there is a listener registered for the specific event. | |
The fs request.
Cross-platform sync and async filesystem operations.
All file operations are run on the threadpool.
To create a fs_req through a loop, no arguments are required.
See the official documentation for further details.
| void uvw::fs_req::access | ( | const std::string & | path, |
| int | mode ) |
| bool uvw::fs_req::access_sync | ( | const std::string & | path, |
| int | mode ) |
Sync access.
| path | Path, as described in the official documentation. |
| mode | Mode, as described in the official documentation. |
| void uvw::fs_req::chmod | ( | const std::string & | path, |
| int | mode ) |
| bool uvw::fs_req::chmod_sync | ( | const std::string & | path, |
| int | mode ) |
Sync chmod.
| path | Path, as described in the official documentation. |
| mode | Mode, as described in the official documentation. |
Sync chown.
| path | Path, as described in the official documentation. |
| uid | UID, as described in the official documentation. |
| gid | GID, as described in the official documentation. |
| void uvw::fs_req::closedir | ( | ) |
Closes asynchronously a directory stream.
Emit a fs_event event when completed.
It frees also the memory allocated internally when a path has been opened as a directory stream.
| bool uvw::fs_req::closedir_sync | ( | ) |
Closes synchronously a directory stream.
It frees also the memory allocated internally when a path has been opened as a directory stream.
| void uvw::fs_req::copyfile | ( | const std::string & | old, |
| const std::string & | path, | ||
| copy_file_flags | flags = copy_file_flags::_UVW_ENUM ) |
Copies a file asynchronously from a path to a new one.
Emit a fs_event event when completed.
Available flags are:
| old | Old path, as described in the official documentation. |
| path | New path, as described in the official documentation. |
| flags | Optional additional flags. |
| bool uvw::fs_req::copyfile_sync | ( | const std::string & | old, |
| const std::string & | path, | ||
| copy_file_flags | flags = copy_file_flags::_UVW_ENUM ) |
Copies a file synchronously from a path to a new one.
Available flags are:
If the destination path is created, but an error occurs while copying the data, then the destination path is removed. There is a brief window of time between closing and removing the file where another process could access the file.
| old | Old path, as described in the official documentation. |
| path | New path, as described in the official documentation. |
| flags | Optional additional flags. |
Sync lchown.
| path | Path, as described in the official documentation. |
| uid | UID, as described in the official documentation. |
| gid | GID, as described in the official documentation. |
| void uvw::fs_req::link | ( | const std::string & | old, |
| const std::string & | path ) |
| bool uvw::fs_req::link_sync | ( | const std::string & | old, |
| const std::string & | path ) |
Sync link.
| old | Old path, as described in the official documentation. |
| path | New path, as described in the official documentation. |
| void uvw::fs_req::lstat | ( | const std::string & | path | ) |
| std::pair< bool, file_info > uvw::fs_req::lstat_sync | ( | const std::string & | path | ) |
| void uvw::fs_req::lutime | ( | const std::string & | path, |
| time | atime, | ||
| time | mtime ) |
Async lutime.
Emit a fs_event event when completed.
| path | Path, as described in the official documentation. |
| 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::fs_req::lutime_sync | ( | const std::string & | path, |
| time | atime, | ||
| time | mtime ) |
Sync lutime.
| path | Path, as described in the official documentation. |
| 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::fs_req::mkdir | ( | const std::string & | path, |
| int | mode ) |
| bool uvw::fs_req::mkdir_sync | ( | const std::string & | path, |
| int | mode ) |
Sync mkdir.
| path | Path, as described in the official documentation. |
| mode | Mode, as described in the official documentation. |
| void uvw::fs_req::mkdtemp | ( | const std::string & | tpl | ) |
| std::pair< bool, const char * > uvw::fs_req::mkdtemp_sync | ( | const std::string & | tpl | ) |
Sync mktemp.
| tpl | Template, as described in the official documentation. |
| void uvw::fs_req::mkstemp | ( | const std::string & | tpl | ) |
| std::pair< bool, std::pair< std::string, std::size_t > > uvw::fs_req::mkstemp_sync | ( | const std::string & | tpl | ) |
Sync mkstemp.
Returns a composed value where:
See the official documentation for further details.
| tpl | Template, as described in the official documentation. |
| void uvw::fs_req::opendir | ( | const std::string & | path | ) |
Opens a path asynchronously as a directory stream.
Emit a fs_event event when completed.
The contents of the directory can be iterated over by means of the readdir od readdir_sync member functions. The memory allocated by this function must be freed by calling closedir or closedir_sync.
| path | The path to open as a directory stream. |
| bool uvw::fs_req::opendir_sync | ( | const std::string & | path | ) |
Opens a path synchronously as a directory stream.
The contents of the directory can be iterated over by means of the readdir od readdir_sync member functions. The memory allocated by this function must be freed by calling closedir or closedir_sync.
| path | The path to open as a directory stream. |
| void uvw::fs_req::readdir | ( | ) |
Iterates asynchronously over a directory stream one entry at a time.
Emit a fs_event event when completed.
This function isn't thread safe. Moreover, it doesn't return the . and .. entries.
| std::pair< bool, std::pair< entry_type, const char * > > uvw::fs_req::readdir_sync | ( | ) |
Iterates synchronously over a directory stream one entry at a time.
Returns a composed value where:
Available entry types are:
See the official documentation for further details.
This function isn't thread safe. Moreover, it doesn't return the . and .. entries.
| void uvw::fs_req::readlink | ( | const std::string & | path | ) |
| std::pair< bool, std::pair< const char *, std::size_t > > uvw::fs_req::readlink_sync | ( | const std::string & | path | ) |
Sync readlink.
| path | Path, as described in the official documentation. |
| void uvw::fs_req::realpath | ( | const std::string & | path | ) |
| std::pair< bool, const char * > uvw::fs_req::realpath_sync | ( | const std::string & | path | ) |
Sync realpath.
| path | Path, as described in the official documentation. |
| void uvw::fs_req::rename | ( | const std::string & | old, |
| const std::string & | path ) |
| bool uvw::fs_req::rename_sync | ( | const std::string & | old, |
| const std::string & | path ) |
Sync rename.
| old | Old path, as described in the official documentation. |
| path | New path, as described in the official documentation. |
| void uvw::fs_req::rmdir | ( | const std::string & | path | ) |
| bool uvw::fs_req::rmdir_sync | ( | const std::string & | path | ) |
Sync rmdir.
| path | Path, as described in the official documentation. |
| void uvw::fs_req::scandir | ( | const std::string & | path, |
| int | flags ) |
| std::pair< bool, std::pair< entry_type, const char * > > uvw::fs_req::scandir_next | ( | ) |
Gets entries populated with the next directory entry data.
Returns a composed value where:
Available entry types are:
See the official documentation for further details.
| std::pair< bool, std::size_t > uvw::fs_req::scandir_sync | ( | const std::string & | path, |
| int | flags ) |
Sync scandir.
| path | Path, as described in the official documentation. |
| flags | Flags, as described in the official documentation. |
| void uvw::fs_req::stat | ( | const std::string & | path | ) |
| std::pair< bool, file_info > uvw::fs_req::stat_sync | ( | const std::string & | path | ) |
| void uvw::fs_req::statfs | ( | const std::string & | path | ) |
| std::pair< bool, fs_info > uvw::fs_req::statfs_sync | ( | const std::string & | path | ) |
Sync statfs.
Any fields in the resulting object that are not supported by the underlying operating system are set to zero.
| path | Path, as described in the official documentation. |
| void uvw::fs_req::symlink | ( | const std::string & | old, |
| const std::string & | path, | ||
| symlink_flags | flags = symlink_flags::_UVW_ENUM ) |
Async symlink.
Emit a fs_event event when completed.
Available flags are:
| old | Old path, as described in the official documentation. |
| path | New path, as described in the official documentation. |
| flags | Optional additional flags. |
| bool uvw::fs_req::symlink_sync | ( | const std::string & | old, |
| const std::string & | path, | ||
| symlink_flags | flags = symlink_flags::_UVW_ENUM ) |
Sync symlink.
Available flags are:
| old | Old path, as described in the official documentation. |
| path | New path, as described in the official documentation. |
| flags | Flags, as described in the official documentation. |
| void uvw::fs_req::unlink | ( | const std::string & | path | ) |
| bool uvw::fs_req::unlink_sync | ( | const std::string & | path | ) |
Sync unlink.
| path | Path, as described in the official documentation. |
| void uvw::fs_req::utime | ( | const std::string & | path, |
| time | atime, | ||
| time | mtime ) |
Async utime.
Emit a fs_event event when completed.
| path | Path, as described in the official documentation. |
| 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::fs_req::utime_sync | ( | const std::string & | path, |
| time | atime, | ||
| time | mtime ) |
Sync utime.
| path | Path, as described in the official documentation. |
| 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. |