mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
feat(replication): Use a ring buffer with messages to serve replication. (#1835)
* feat(replication): Use a ring buffer with messages to serve replication. * Fix libraries dep graph * Address PR feedback * nits * add a comment * Lower the default log length
This commit is contained in:
parent
1e61ec8114
commit
db21b735f6
16 changed files with 127 additions and 65 deletions
|
@ -10,12 +10,12 @@ using namespace util;
|
|||
void JournalStreamer::Start(io::Sink* dest) {
|
||||
using namespace journal;
|
||||
write_fb_ = fb2::Fiber("journal_stream", &JournalStreamer::WriterFb, this, dest);
|
||||
journal_cb_id_ = journal_->RegisterOnChange([this](const Entry& entry, bool allow_await) {
|
||||
if (entry.opcode == Op::NOOP) {
|
||||
// No recode to write, just await if data was written so consumer will read the data.
|
||||
journal_cb_id_ = journal_->RegisterOnChange([this](const JournalItem& item, bool allow_await) {
|
||||
if (item.opcode == Op::NOOP) {
|
||||
// No record to write, just await if data was written so consumer will read the data.
|
||||
return AwaitIfWritten();
|
||||
}
|
||||
writer_.Write(entry);
|
||||
Write(io::Buffer(item.data));
|
||||
NotifyWritten(allow_await);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue