Explicitly mark IAsyncFile functions as overrided

This commit is contained in:
sfc-gh-tclinkenbeard 2020-08-19 18:17:05 -07:00
parent 157700e5b6
commit c8b774a30a
7 changed files with 48 additions and 60 deletions

View File

@ -165,7 +165,7 @@ public:
}
// Ready once all data has been sent AND acknowledged from the remote side
virtual Future<Void> sync() {
Future<Void> sync() override {
// Only initiate the finish operation once, and also prevent further writing.
if(!m_finished.isValid()) {
m_finished = doFinishUpload(this);
@ -259,23 +259,23 @@ public:
virtual void addref() { ReferenceCounted<AsyncFileBlobStoreRead>::addref(); }
virtual void delref() { ReferenceCounted<AsyncFileBlobStoreRead>::delref(); }
virtual Future<int> read( void *data, int length, int64_t offset );
Future<int> read(void* data, int length, int64_t offset) override;
virtual Future<Void> write( void const *data, int length, int64_t offset ) { throw file_not_writable(); }
virtual Future<Void> truncate( int64_t size ) { throw file_not_writable(); }
Future<Void> write(void const* data, int length, int64_t offset) override { throw file_not_writable(); }
Future<Void> truncate(int64_t size) override { throw file_not_writable(); }
virtual Future<Void> sync() { return Void(); }
virtual Future<Void> flush() { return Void(); }
Future<Void> sync() override { return Void(); }
Future<Void> flush() override { return Void(); }
Future<int64_t> size() const override;
virtual Future<Void> readZeroCopy( void** data, int* length, int64_t offset ) {
Future<Void> readZeroCopy(void** data, int* length, int64_t offset) override {
TraceEvent(SevError, "ReadZeroCopyNotSupported").detail("FileType", "BlobStoreRead");
return platform_error();
}
virtual void releaseZeroCopy( void* data, int length, int64_t offset ) {}
void releaseZeroCopy(void* data, int length, int64_t offset) override {}
virtual int64_t debugFD() const override { return -1; }
int64_t debugFD() const override { return -1; }
std::string getFilename() const override { return m_object; }

View File

@ -160,7 +160,7 @@ public:
return openFiles[filename].get();
}
virtual Future<int> read( void* data, int length, int64_t offset ) {
Future<int> read(void* data, int length, int64_t offset) override {
++countFileCacheReads;
++countCacheReads;
if (offset + length > this->length) {
@ -190,17 +190,15 @@ public:
return Void();
}
virtual Future<Void> write( void const* data, int length, int64_t offset ) {
Future<Void> write(void const* data, int length, int64_t offset) override {
return write_impl(this, data, length, offset);
}
virtual Future<Void> readZeroCopy( void** data, int* length, int64_t offset );
virtual void releaseZeroCopy( void* data, int length, int64_t offset );
Future<Void> readZeroCopy(void** data, int* length, int64_t offset) override;
void releaseZeroCopy(void* data, int length, int64_t offset) override;
// This waits for previously started truncates to finish and then truncates
virtual Future<Void> truncate( int64_t size ) {
return truncate_impl(this, size);
}
Future<Void> truncate(int64_t size) override { return truncate_impl(this, size); }
// This is the 'real' truncate that does the actual removal of cache blocks and then shortens the file
Future<Void> changeFileSize( int64_t size );
@ -215,9 +213,7 @@ public:
return Void();
}
virtual Future<Void> sync() {
return waitAndSync( this, flush() );
}
Future<Void> sync() override { return waitAndSync(this, flush()); }
Future<int64_t> size() const override { return length; }
@ -331,7 +327,7 @@ private:
}
}
virtual Future<Void> flush();
Future<Void> flush() override;
Future<Void> quiesce();
@ -350,7 +346,7 @@ private:
};
struct AFCPage : public EvictablePage, public FastAllocated<AFCPage> {
virtual bool evict() {
bool evict() override {
if ( notReading.isReady() && notFlushing.isReady() && !dirty && !zeroCopyRefCount && !truncated ) {
owner->remove_page( this );
delete this;

View File

@ -117,24 +117,24 @@ public:
int64_t debugFD() const override { return fd; }
virtual Future<int> read( void* data, int length, int64_t offset ) {
Future<int> read(void* data, int length, int64_t offset) override {
++countFileLogicalReads;
++countLogicalReads;
return read_impl(fd, data, length, offset);
}
virtual Future<Void> write( void const* data, int length, int64_t offset ) // Copies data synchronously
Future<Void> write(void const* data, int length, int64_t offset) override // Copies data synchronously
{
++countFileLogicalWrites;
++countLogicalWrites;
//Standalone<StringRef> copy = StringRef((const uint8_t*)data, length);
return write_impl( fd, err, StringRef((const uint8_t*)data, length), offset );
}
virtual Future<Void> truncate( int64_t size ) {
Future<Void> truncate(int64_t size) override {
++countFileLogicalWrites;
++countLogicalWrites;
return truncate_impl( fd, err, size );
}
virtual Future<Void> sync() {
Future<Void> sync() override {
++countFileLogicalWrites;
++countLogicalWrites;
auto fsync = sync_impl( fd, err );

View File

@ -182,7 +182,7 @@ public:
virtual void addref() { ReferenceCounted<AsyncFileKAIO>::addref(); }
virtual void delref() { ReferenceCounted<AsyncFileKAIO>::delref(); }
virtual Future<int> read( void* data, int length, int64_t offset ) {
Future<int> read(void* data, int length, int64_t offset) override {
++countFileLogicalReads;
++countLogicalReads;
//printf("%p Begin logical read\n", getCurrentCoro());
@ -205,7 +205,7 @@ public:
return result;
}
virtual Future<Void> write( void const* data, int length, int64_t offset ) {
Future<Void> write(void const* data, int length, int64_t offset) override {
++countFileLogicalWrites;
++countLogicalWrites;
//printf("%p Begin logical write\n", getCurrentCoro());
@ -234,7 +234,7 @@ public:
#ifndef FALLOC_FL_ZERO_RANGE
#define FALLOC_FL_ZERO_RANGE 0x10
#endif
virtual Future<Void> zeroRange( int64_t offset, int64_t length ) override {
Future<Void> zeroRange(int64_t offset, int64_t length) override {
bool success = false;
if (ctx.fallocateZeroSupported) {
int rc = fallocate( fd, FALLOC_FL_ZERO_RANGE, offset, length );
@ -247,7 +247,7 @@ public:
}
return success ? Void() : IAsyncFile::zeroRange(offset, length);
}
virtual Future<Void> truncate( int64_t size ) {
Future<Void> truncate(int64_t size) override {
++countFileLogicalWrites;
++countLogicalWrites;
@ -308,7 +308,7 @@ public:
return Void();
}
virtual Future<Void> sync() {
Future<Void> sync() override {
++countFileLogicalWrites;
++countLogicalWrites;

View File

@ -87,25 +87,25 @@ public:
ReferenceCounted<AsyncFileDetachable>::delref();
}
Future<int> read(void *data, int length, int64_t offset) {
Future<int> read(void* data, int length, int64_t offset) override {
if( !file.getPtr() || g_simulator.getCurrentProcess()->shutdownSignal.getFuture().isReady() )
return io_error().asInjectedFault();
return sendErrorOnShutdown( file->read( data, length, offset ) );
}
Future<Void> write(void const *data, int length, int64_t offset) {
Future<Void> write(void const* data, int length, int64_t offset) override {
if( !file.getPtr() || g_simulator.getCurrentProcess()->shutdownSignal.getFuture().isReady() )
return io_error().asInjectedFault();
return sendErrorOnShutdown( file->write( data, length, offset ) );
}
Future<Void> truncate(int64_t size) {
Future<Void> truncate(int64_t size) override {
if( !file.getPtr() || g_simulator.getCurrentProcess()->shutdownSignal.getFuture().isReady() )
return io_error().asInjectedFault();
return sendErrorOnShutdown( file->truncate( size ) );
}
Future<Void> sync() {
Future<Void> sync() override {
if( !file.getPtr() || g_simulator.getCurrentProcess()->shutdownSignal.getFuture().isReady() )
return io_error().asInjectedFault();
return sendErrorOnShutdown( file->sync() );
@ -263,13 +263,11 @@ public:
}
//Passes along reads straight to the underlying file, waiting for any outstanding changes that could affect the results
Future<int> read(void *data, int length, int64_t offset) {
return read(this, data, length, offset);
}
Future<int> read(void* data, int length, int64_t offset) override { return read(this, data, length, offset); }
//Writes data to the file. Writes are delayed a random amount of time before being
//passed to the underlying file
Future<Void> write(void const *data, int length, int64_t offset) {
Future<Void> write(void const* data, int length, int64_t offset) override {
//TraceEvent("AsyncFileNonDurable_Write", id).detail("Filename", filename).detail("Offset", offset).detail("Length", length);
if(length == 0) {
TraceEvent(SevWarnAlways, "AsyncFileNonDurable_EmptyModification", id).detail("Filename", filename);
@ -283,10 +281,10 @@ public:
writeEnded.send(write(this, writeStarted, writeEnded.getFuture(), data, length, offset));
return writeStarted.getFuture();
}
//Truncates the file. Truncates are delayed a random amount of time before being
//passed to the underlying file
Future<Void> truncate(int64_t size) {
Future<Void> truncate(int64_t size) override {
//TraceEvent("AsyncFileNonDurable_Truncate", id).detail("Filename", filename).detail("Offset", size);
debugFileTruncate("AsyncFileNonDurableTruncate", filename, size);

View File

@ -155,27 +155,27 @@ public:
return wpos;
}
virtual Future<int> read( void *data, int length, int64_t offset ) {
Future<int> read(void* data, int length, int64_t offset) override {
return read_impl(Reference<AsyncFileReadAheadCache>::addRef(this), data, length, offset);
}
virtual Future<Void> write( void const *data, int length, int64_t offset ) { throw file_not_writable(); }
virtual Future<Void> truncate( int64_t size ) { throw file_not_writable(); }
Future<Void> write(void const* data, int length, int64_t offset) override { throw file_not_writable(); }
Future<Void> truncate(int64_t size) override { throw file_not_writable(); }
virtual Future<Void> sync() { return Void(); }
virtual Future<Void> flush() { return Void(); }
Future<Void> sync() override { return Void(); }
Future<Void> flush() override { return Void(); }
Future<int64_t> size() const override { return m_f->size(); }
virtual Future<Void> readZeroCopy( void** data, int* length, int64_t offset ) {
Future<Void> readZeroCopy(void** data, int* length, int64_t offset) override {
TraceEvent(SevError, "ReadZeroCopyNotSupported").detail("FileType", "ReadAheadCache");
return platform_error();
}
virtual void releaseZeroCopy( void* data, int length, int64_t offset ) {}
void releaseZeroCopy(void* data, int length, int64_t offset) override {}
int64_t debugFD() const override { return -1; }
virtual std::string getFilename() const override { return m_f->getFilename(); }
std::string getFilename() const override { return m_f->getFilename(); }
virtual ~AsyncFileReadAheadCache() {
for(auto &it : m_blocks) {

View File

@ -480,25 +480,19 @@ public:
int64_t debugFD() const override { return (int64_t)h; }
virtual Future<int> read( void* data, int length, int64_t offset ) {
return read_impl( this, data, length, offset );
}
Future<int> read(void* data, int length, int64_t offset) override { return read_impl(this, data, length, offset); }
virtual Future<Void> write( void const* data, int length, int64_t offset ) {
Future<Void> write(void const* data, int length, int64_t offset) override {
return write_impl( this, StringRef((const uint8_t*)data, length), offset );
}
virtual Future<Void> truncate( int64_t size ) {
return truncate_impl( this, size );
}
Future<Void> truncate(int64_t size) override { return truncate_impl(this, size); }
virtual Future<Void> sync() {
return sync_impl( this );
}
Future<Void> sync() override { return sync_impl(this); }
Future<int64_t> size() const override { return size_impl(this); }
virtual std::string getFilename() const override { return actualFilename; }
std::string getFilename() const override { return actualFilename; }
~SimpleFile() {
_close( h );