libfilezilla
Loading...
Searching...
No Matches
buffer_writer Class Referencefinal

#include <writer.hpp>

Inheritance diagram for buffer_writer:
Collaboration diagram for buffer_writer:

Public Member Functions

 buffer_writer (buffer &buffer, std::wstring const &name, aio_buffer_pool &pool, size_t size_limit, progress_cb_t &&progress_cb=nullptr)
virtual aio_result preallocate (uint64_t size) override
 Instructs writer to preallocate storage. May be a noop.
Public Member Functions inherited from writer_base
 writer_base (writer_base const &)=delete
writer_baseoperator= (writer_base const &)=delete
aio_result add_buffer (buffer_lease &&b, event_handler &h)
 Pass a buffer to be written out.
aio_result finalize (event_handler &h)
 Finalizes the writer.
virtual bool set_mtime (datetime const &)
 Must be finalized already.
void close ()
Public Member Functions inherited from aio_waitable
void remove_waiter (event_handler &h)

Additional Inherited Members

Public Types inherited from writer_base
using progress_cb_t = std::function<void(writer_base const*, uint64_t written)>
Public Types inherited from aio_base
using size_type = uint64_t
Static Public Attributes inherited from aio_base
static constexpr auto nosize = static_cast<size_type>(-1)
Protected Member Functions inherited from writer_base
 writer_base (std::wstring &&name, aio_buffer_pool &pool, progress_cb_t &&progress_cb, size_t max_buffers) noexcept
 writer_base (std::wstring_view name, aio_buffer_pool &pool, progress_cb_t &&progress_cb, size_t max_buffers) noexcept
virtual void do_close (scoped_lock &)
Protected Member Functions inherited from aio_waitable
void remove_waiters ()
 Call in destructor of most-derived class.
void add_waiter (event_handler &h)
void signal_availibility ()
Protected Attributes inherited from writer_base
mutex mtx_
aio_buffer_poolbuffer_pool_
std::wstring const name_
progress_cb_t progress_cb_
size_t const max_buffers_ {}
std::list< buffer_leasebuffers_
bool error_ {}
uint8_t finalizing_ {}

Detailed Description

A simple buffer writer.

The buffer must live longer than the writer. Note that there is no synchronization. Never open two writers for the same buffer in different threads, or access the buffer from any other thread while there is a writer.

Member Function Documentation

◆ preallocate()

virtual aio_result preallocate ( uint64_t )
overridevirtual

Instructs writer to preallocate storage. May be a noop.

Reimplemented from writer_base.


The documentation for this class was generated from the following file: