Classes |
struct | mapped_file |
| A holder of a mapped file. More...
|
Public Types |
enum | open_states { closed,
open,
opendir
} |
| In which way this handle is opened or not. More...
|
Public Member Functions |
dispatcher * | parent () const |
| Returns the parent of this io handle.
|
handle_ptr | container () const |
| Returns a handle to the directory containing this handle. Only works if `file_flags::hold_parent_open` was specified when this handle was opened.
|
virtual open_states | is_open () const =0 |
| Returns if this handle is opened or not.
|
virtual void * | native_handle () const =0 |
| Returns the native handle of this io handle. On POSIX, you can cast this to a fd using `(int)(size_t) native_handle()`. On Windows it's a simple `(HANDLE) native_handle()`.
|
const
chrono::system_clock::time_point & | opened () const |
| Returns when this handle was opened.
|
virtual boost::afio::path | path (bool refresh=false)=0 |
| Returns the path of this i/o handle right now if the handle is open and refresh is true, else last known good. May be null if the file has been deleted.
|
virtual boost::afio::path | path () const =0 |
| Returns the last known good path of this i/o handle. May be null if the file has been deleted.
|
file_flags | flags () const |
| Returns the final flags used when this handle was opened.
|
bool | opened_as_file () const |
| True if this handle was opened as a file.
|
bool | opened_as_dir () const |
| True if this handle was opened as a directory.
|
bool | opened_as_symlink () const |
| True if this handle was opened as a symlink.
|
bool | available_to_directory_cache () const |
| True if this handle is used by the directory handle cache (not UniqueDirectoryHandle and is open for write and not open for write)
|
off_t | read_count () const |
| Returns how many bytes have been read since this handle was opened.
|
off_t | write_count () const |
| Returns how many bytes have been written since this handle was opened.
|
off_t | write_count_since_fsync () const |
| Returns how many bytes have been written since this handle was last fsynced.
|
virtual directory_entry | direntry (metadata_flags wanted=directory_entry::metadata_fastpath())=0 |
| Returns a mostly filled directory_entry for the file or directory referenced by this handle. Use `metadata_flags::All` if you want it as complete as your platform allows, even at the cost of severe performance loss.
|
stat_t | lstat (metadata_flags wanted=directory_entry::metadata_fastpath()) |
| Returns a mostly filled stat_t structure for the file or directory referenced by this handle. Use `metadata_flags::All` if you want it as complete as your platform allows, even at the cost of severe performance loss. Calls direntry(), so same race guarantees as that call.
|
virtual boost::afio::path | target ()=0 |
| Returns the target path of this handle if it is a symbolic link.
|
virtual mapped_file_ptr | map_file (size_t length=(size_t)-1, off_t offset=0, bool read_only=false) |
| Maps the file into memory, returning a null pointer if couldn't map (e.g. address space exhaustion). Do NOT mix this with `file_flags::os_direct`!
|
virtual void | link (const path_req &req)=0 |
| Hard links the file to a new location on the same volume.
|
virtual void | unlink ()=0 |
| Unlinks the file from its present location as determined by path(true), which could be any hard link on those operating systems with an unstable path(true). Other links may remain to the same file.
|
virtual void | atomic_relink (const path_req &req)=0 |
| Links the file to a new location and unlinks the file from its present location as determined by path(true), atomically overwriting any file entry at the new location. Very useful for preparing file content elsewhere and once ready, atomically making it visible at some named location to other processes. Note that operating systems with an unstable path(true) may relink any hard link to the file to the new location.
|
Protected Member Functions |
| handle (dispatcher *parent, file_flags flags) |
virtual void | close ()=0 |
| Calling this directly can cause misoperation. Best to avoid unless you have inspected the source code for the consequences.
|
Protected Attributes |
handle_ptr | dirh |
atomic< off_t > | bytesread |
atomic< off_t > | byteswritten |
atomic< off_t > | byteswrittenatlastfsync |
Friends |
class | dispatcher |
struct | detail::async_io_handle_posix |
struct | detail::async_io_handle_windows |
class | detail::async_file_io_dispatcher_compat |
class | detail::async_file_io_dispatcher_windows |
class | detail::async_file_io_dispatcher_linux |
class | detail::async_file_io_dispatcher_qnx |
The abstract base class encapsulating a platform-specific file handle.
Note that failure to explicitly schedule closing a file handle in the dispatcher means it will be synchronously closed on last reference count by handle. This can consume considerable time, especially if SyncOnClose is enabled.
Definition at line 1139 of file afio.hpp.