From 12123f41d6ce85c888f0282cc9b1161a249d2132 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Thu, 7 Feb 2019 17:02:27 -0800 Subject: [PATCH] Plumb a read function up the stack to IDiskQueue --- fdbserver/DiskQueue.actor.cpp | 5 +++++ fdbserver/IDiskQueue.h | 1 + fdbserver/LogSystemDiskQueueAdapter.h | 1 + 3 files changed, 7 insertions(+) diff --git a/fdbserver/DiskQueue.actor.cpp b/fdbserver/DiskQueue.actor.cpp index aca58340b5..98a621fe63 100644 --- a/fdbserver/DiskQueue.actor.cpp +++ b/fdbserver/DiskQueue.actor.cpp @@ -713,6 +713,7 @@ public: } return endLocation(); } + virtual void pop( location upTo ) { ASSERT( !upTo.hi ); ASSERT( !recovered || upTo.lo <= endLocation() ); @@ -732,6 +733,8 @@ public: } } + virtual Future> read(location from, location to) { return read(this, from, to); } + int getMaxPayload() { return Page::maxPayload; } @@ -1241,6 +1244,8 @@ public: virtual location getNextReadLocation() { return queue->getNextReadLocation(); } + virtual Future> read( location start, location end ) { return queue->read( start, end ); } + virtual location push( StringRef contents ) { pushed = queue->push(contents); return pushed; diff --git a/fdbserver/IDiskQueue.h b/fdbserver/IDiskQueue.h index 0cd3498c91..70f5f9670a 100644 --- a/fdbserver/IDiskQueue.h +++ b/fdbserver/IDiskQueue.h @@ -54,6 +54,7 @@ public: virtual Future> readNext( int bytes ) = 0; // Return the next bytes in the queue (beginning, the first time called, with the first unpopped byte) virtual location getNextReadLocation() = 0; // Returns a location >= the location of all bytes previously returned by readNext(), and <= the location of all bytes subsequently returned + virtual Future> read( location start, location end ) = 0; virtual location push( StringRef contents ) = 0; // Appends the given bytes to the byte stream. Returns a location token representing the *end* of the contents. virtual void pop( location upTo ) = 0; // Removes all bytes before the given location token from the byte stream. virtual Future commit() = 0; // returns when all prior pushes and pops are durable. If commit does not return (due to close or a crash), any prefix of the pushed bytes and any prefix of the popped bytes may be durable. diff --git a/fdbserver/LogSystemDiskQueueAdapter.h b/fdbserver/LogSystemDiskQueueAdapter.h index 4983340b69..771f4ae4c6 100644 --- a/fdbserver/LogSystemDiskQueueAdapter.h +++ b/fdbserver/LogSystemDiskQueueAdapter.h @@ -70,6 +70,7 @@ public: virtual Future initializeRecovery() { return false; } virtual Future> readNext( int bytes ); virtual IDiskQueue::location getNextReadLocation(); + virtual Future> read( location start, location end ) { ASSERT(false); throw internal_error(); } virtual IDiskQueue::location push( StringRef contents ); virtual void pop( IDiskQueue::location upTo ); virtual Future commit();