AsyncFile

Runs all blocking file I/O commands in a thread pool and calls the handler upon completion.

Constructors

this
this(EventLoop evl)

Members

Functions

append
bool append(string file_path, ubyte[] buffer, bool create_if_not_exists, bool truncate_if_exists)

Appends the data from the buffer into a file at the specified path.

buffer
shared(ubyte[]) buffer()

Retrieve the buffer from the last command. Must be called upon completion.

handler
void handler()
Undocumented in source. Be warned that the author may not have intended to support it.
kill
bool kill()

Cleans up the underlying resources. todo: make this dispose?

onReady
shared(typeof(this)) onReady(void delegate() del)

Sets the handler called by the owner thread's event loop after the command is completed.

read
bool read(string file_path, size_t len, ulong off, bool create_if_not_exists, bool truncate_if_exists)

Creates a new buffer with the specified length and uses it to read the file data at the specified path starting at the specified offset byte.

read
bool read(string file_path, ubyte[] buffer, ulong off, bool create_if_not_exists, bool truncate_if_exists)

Reads the file into the buffer starting at offset byte position.

write
bool write(string file_path, const(ubyte)[] buffer, ulong off, bool create_if_not_exists, bool truncate_if_exists)

Writes the data from the buffer into the file at the specified path starting at the given offset byte position.

Properties

cmdInfo
FileCmdInfo cmdInfo [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
error
string error [@property getter]
file
File file [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
file
File file [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
filePath
Path filePath [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
filePath
Path filePath [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
offset
ulong offset [@property getter]

The current offset updated after the command execution

offset
ulong offset [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
status
StatusInfo status [@property getter]
status
StatusInfo status [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
waiting
bool waiting [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
waiting
bool waiting [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.

Meta