LogCabin
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Public Attributes
LogCabin::Storage::Log::Sync Class Reference

An interface for flushing newly appended log entries to stable storage. More...

#include <Log.h>

Inheritance diagram for LogCabin::Storage::Log::Sync:
LogCabin::Storage::SegmentedLog::Sync LogCabin::Storage::SimpleFileLog::Sync

List of all members.

Public Member Functions

 Sync (uint64_t lastIndex)
virtual ~Sync ()
virtual void wait ()
 Wait for the log entries to be durable.

Public Attributes

uint64_t lastIndex
 The index of the last log entry that is being flushed.
bool completed
 Used by destructor to make sure that Log::syncComplete was called.

Detailed Description

An interface for flushing newly appended log entries to stable storage.

Leaders do this in a separate thread, while followers and candidates do this immediately after appending the entries.

Callers should wait() on all Sync objects prior to calling truncateSuffix(). This never happens on leaders, so it's not a real limitation, but things may go wonky otherwise.

Definition at line 51 of file Log.h.


Constructor & Destructor Documentation

LogCabin::Storage::Log::Sync::Sync ( uint64_t  lastIndex) [explicit]

Reimplemented in LogCabin::Storage::SimpleFileLog::Sync.

Definition at line 33 of file Log.cc.

Reimplemented in LogCabin::Storage::SegmentedLog::Sync.

Definition at line 38 of file Log.cc.


Member Function Documentation

virtual void LogCabin::Storage::Log::Sync::wait ( ) [inline, virtual]

Wait for the log entries to be durable.

This is safe to call while the Log is being accessed and modified from a separate thread. PANICs on errors.

Reimplemented in LogCabin::Storage::SegmentedLog::Sync, and LogCabin::Storage::SimpleFileLog::Sync.

Definition at line 61 of file Log.h.


Member Data Documentation

The index of the last log entry that is being flushed.

After the call to wait, every entry in the log up to this one is durable.

Definition at line 67 of file Log.h.

Used by destructor to make sure that Log::syncComplete was called.

Definition at line 71 of file Log.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines