Plumb a read function up the stack to IDiskQueue

This commit is contained in:
Alex Miller 2019-02-07 17:02:27 -08:00
parent 6c7229ec07
commit 12123f41d6
3 changed files with 7 additions and 0 deletions

View File

@ -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<Standalone<StringRef>> 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<Standalone<StringRef>> read( location start, location end ) { return queue->read( start, end ); }
virtual location push( StringRef contents ) {
pushed = queue->push(contents);
return pushed;

View File

@ -54,6 +54,7 @@ public:
virtual Future<Standalone<StringRef>> 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<Standalone<StringRef>> 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<Void> 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.

View File

@ -70,6 +70,7 @@ public:
virtual Future<bool> initializeRecovery() { return false; }
virtual Future<Standalone<StringRef>> readNext( int bytes );
virtual IDiskQueue::location getNextReadLocation();
virtual Future<Standalone<StringRef>> read( location start, location end ) { ASSERT(false); throw internal_error(); }
virtual IDiskQueue::location push( StringRef contents );
virtual void pop( IDiskQueue::location upTo );
virtual Future<Void> commit();