LogDevice API
Public Types | Public Member Functions | List of all members
facebook::logdevice::BufferedWriter::AppendCallback Class Reference

#include <BufferedWriter.h>

Public Types

enum  RetryDecision { ALLOW, DENY }
 
using Context = void *
 
using ContextSet = std::vector< std::pair< Context, PayloadVariant > >
 

Public Member Functions

virtual void onSuccess (logid_t, ContextSet, const DataRecordAttributes &)
 
virtual void onFailure (logid_t, ContextSet, Status)
 
virtual RetryDecision onRetry (logid_t, const ContextSet &, Status)
 

Detailed Description

Callback interface. All methods get called on an unspecified thread. Applications should subclass and override desired notification methods.

Member Function Documentation

◆ onFailure()

virtual void facebook::logdevice::BufferedWriter::AppendCallback::onFailure ( logid_t  ,
ContextSet  ,
Status   
)
inlinevirtual

Called when a batch of records for the same log failed to be appended, and BufferedWriter exhausted all retries it was configured to do (if any).

This function is not applicable in STREAM mode. Failed appends are retried by default and hence no failures are reported back.

Payload strings (in the ContextSet vector) are no longer needed within BufferedWriter so the application is free to steal them.

◆ onRetry()

virtual RetryDecision facebook::logdevice::BufferedWriter::AppendCallback::onRetry ( logid_t  ,
const ContextSet &  ,
Status   
)
inlinevirtual

Called when a batch of records for the same log failed to be appended, but BufferedWriter is planning to retry.

This function is not applicable in STREAM mode. Failed appends are retried by default and hence no failures are reported back.

If ALLOW is returned, BufferedWriter will proceed to schedule the retry for this batch. If DENY is returned, BufferedWriter will not retry and will instead invoke onFailure() shortly after.

◆ onSuccess()

virtual void facebook::logdevice::BufferedWriter::AppendCallback::onSuccess ( logid_t  ,
ContextSet  ,
const DataRecordAttributes &   
)
inlinevirtual

Called when a batch of records for the same log was successfully appended.

Payload strings (in the ContextSet vector) are no longer needed within BufferedWriter so the application is free to steal them. All of the records share the same LSN and timestamp, available in `attrs'.

In STREAM mode, append callbacks are done in the same order in which they were accepted by the BufferedWriter. In the event of failures, an append maybe duplicated in the log. STREAM mode guarantees that the 'first' occurrence, among the duplicates, of an append obeys FIFO order. So, the LSNs corresponding to first occurrence of appends increase monotonically. However, LSN reported in 'attrs' correspond to some occurrence, hence they need not increase monotonically.


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