LogCabin
|
Queues various operations on files, such as writes and fsyncs, to be executed later. More...
Classes | |
struct | Op |
Public Member Functions | |
Sync (uint64_t lastIndex, std::chrono::nanoseconds diskWriteDurationThreshold) | |
~Sync () | |
void | updateStats (Core::RollingStat &nanos) const |
Add how long the filesystem ops took to 'nanos'. | |
void | optimize () |
Called at the start of wait to avoid some redundant disk flushes. | |
void | wait () |
Wait for the log entries to be durable. | |
Public Attributes | |
const std::chrono::nanoseconds | diskWriteDurationThreshold |
If a wait() exceeds this time, log a warning. | |
std::deque< Op > | ops |
List of operations to perform during wait(). | |
TimePoint | waitStart |
Time at start of wait() call. | |
TimePoint | waitEnd |
Time at end of wait() call. |
Queues various operations on files, such as writes and fsyncs, to be executed later.
Definition at line 263 of file SegmentedLog.h.
LogCabin::Storage::SegmentedLog::Sync::Sync | ( | uint64_t | lastIndex, |
std::chrono::nanoseconds | diskWriteDurationThreshold | ||
) | [explicit] |
Definition at line 178 of file SegmentedLog.cc.
LogCabin::Storage::SegmentedLog::Sync::~Sync | ( | ) | [virtual] |
Reimplemented from LogCabin::Storage::Log::Sync.
Definition at line 188 of file SegmentedLog.cc.
void LogCabin::Storage::SegmentedLog::Sync::updateStats | ( | Core::RollingStat & | nanos | ) | const |
Add how long the filesystem ops took to 'nanos'.
This is invoked from syncCompleteVirtual so that it is thread-safe with respect to the 'nanos' variable. We can't do it in 'wait' directly since that can execute concurrently with someone reading 'nanos'.
Definition at line 305 of file SegmentedLog.cc.
Called at the start of wait to avoid some redundant disk flushes.
Definition at line 193 of file SegmentedLog.cc.
void LogCabin::Storage::SegmentedLog::Sync::wait | ( | ) | [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 from LogCabin::Storage::Log::Sync.
Definition at line 215 of file SegmentedLog.cc.
const std::chrono::nanoseconds LogCabin::Storage::SegmentedLog::Sync::diskWriteDurationThreshold |
If a wait() exceeds this time, log a warning.
Definition at line 309 of file SegmentedLog.h.
std::deque<Op> LogCabin::Storage::SegmentedLog::Sync::ops |
List of operations to perform during wait().
Definition at line 311 of file SegmentedLog.h.
Time at start of wait() call.
Definition at line 313 of file SegmentedLog.h.
Time at end of wait() call.
Definition at line 315 of file SegmentedLog.h.