|
int | append (logid_t logid, std::string &&payload, AppendCallback::Context callback_context, AppendAttributes &&attrs=AppendAttributes()) |
|
int | append (logid_t logid, PayloadGroup &&payload_group, AppendCallback::Context callback_context, AppendAttributes &&attrs=AppendAttributes()) |
|
std::vector< Status > | append (std::vector< Append > &&appends) |
|
int | flushAll () |
|
virtual | ~BufferedWriter () |
|
◆ PayloadVariant
◆ ~BufferedWriter()
virtual facebook::logdevice::BufferedWriter::~BufferedWriter |
( |
| ) |
|
|
inlinevirtual |
NOTE: involves communication with LogDevice threads, blocks until they acknowledge the destruction.
◆ append() [1/2]
int facebook::logdevice::BufferedWriter::append |
( |
logid_t |
logid, |
|
|
std::string && |
payload, |
|
|
AppendCallback::Context |
callback_context, |
|
|
AppendAttributes && |
attrs = AppendAttributes() |
|
) |
| |
Same as Client::append() except the append may get buffered. If the call succeeds it is added into a buffer, and finally appended to the log as a batch of appends. Once it has been successfully stored in LogDevice, BufferedWriter::AppendCallback::onSuccess (passed in create()) is invoked with a ContextSet containing callback_context.
If the call succeeds (returns 0), the class assumes ownership of the payload. If the call fails, the payload remains in the given parameter. See Client::append for explanation of AppendAttributes
◆ append() [2/2]
std::vector<Status> facebook::logdevice::BufferedWriter::append |
( |
std::vector< Append > && |
appends | ) |
|
Multi-write version of append(). Requires less interthread communication than calling append() for each record.
- Returns
- A vector of Status objects, one for each input append. The status is E::OK if the append was successfully queued for writing, or otherwise one of the `err' codes documented for the single-write append(). If some of the appends fail, their payloads remain in the input vector.
◆ create()
Constructing and destructing a BufferedWriter involves interthread communication (with LogDevice library threads) and may block if those threads are busy. BufferedWriter instances are meant to be long-lived (and clients will typically use just one).
Uses client as sink for sending buffered appends.
◆ flushAll()
int facebook::logdevice::BufferedWriter::flushAll |
( |
| ) |
|
Instructs the class to immediately flush all buffered appends. Does not block, just passes messages to LogDevice threads.
It is not intended for this to be called often in production as it can limit the amount of batching; space- and time-based flushing should be preferred.
- Returns
- 0 on success, -1 if messages could not be posted to some LogDevice threads
The documentation for this class was generated from the following file: