Explicitly seal classes that inherit but aren't inherited from
This commit is contained in:
parent
71d0ef676c
commit
a9607bdcec
|
@ -39,15 +39,15 @@
|
|||
struct LineNoiseReader final : IThreadPoolReceiver {
|
||||
void init() override {}
|
||||
|
||||
struct Read : TypedAction<LineNoiseReader, Read> {
|
||||
std::string prompt;
|
||||
struct Read final : TypedAction<LineNoiseReader, Read> {
|
||||
std::string prompt;
|
||||
ThreadReturnPromise<Optional<std::string>> result;
|
||||
|
||||
double getTimeEstimate() const override { return 0.0; }
|
||||
explicit Read(std::string const& prompt) : prompt(prompt) {}
|
||||
};
|
||||
};
|
||||
|
||||
void action(Read& r) {
|
||||
void action(Read& r) {
|
||||
try {
|
||||
r.result.send( read(r.prompt) );
|
||||
} catch (Error& e) {
|
||||
|
|
|
@ -1837,7 +1837,7 @@ private:
|
|||
std::string m_path;
|
||||
};
|
||||
|
||||
class BackupContainerBlobStore : public BackupContainerFileSystem, ReferenceCounted<BackupContainerBlobStore> {
|
||||
class BackupContainerBlobStore final : public BackupContainerFileSystem, ReferenceCounted<BackupContainerBlobStore> {
|
||||
private:
|
||||
// Backup files to under a single folder prefix with subfolders for each named backup
|
||||
static const std::string DATAFOLDER;
|
||||
|
@ -1877,15 +1877,13 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void addref() final { return ReferenceCounted<BackupContainerBlobStore>::addref(); }
|
||||
void delref() final { return ReferenceCounted<BackupContainerBlobStore>::delref(); }
|
||||
void addref() override { return ReferenceCounted<BackupContainerBlobStore>::addref(); }
|
||||
void delref() override { return ReferenceCounted<BackupContainerBlobStore>::delref(); }
|
||||
|
||||
static std::string getURLFormat() {
|
||||
return BlobStoreEndpoint::getURLFormat(true) + " (Note: The 'bucket' parameter is required.)";
|
||||
}
|
||||
|
||||
~BackupContainerBlobStore() = default;
|
||||
|
||||
Future<Reference<IAsyncFile>> readFile(std::string path) final {
|
||||
return Reference<IAsyncFile>(
|
||||
new AsyncFileReadAheadCache(
|
||||
|
|
|
@ -940,17 +940,17 @@ namespace fileBackup {
|
|||
// Backup and Restore taskFunc definitions will inherit from one of the following classes which
|
||||
// servers to catch and log to the appropriate config any error that execute/finish didn't catch and log.
|
||||
struct RestoreTaskFuncBase : TaskFuncBase {
|
||||
Future<Void> handleError(Database cx, Reference<Task> task, Error const& error) override {
|
||||
Future<Void> handleError(Database cx, Reference<Task> task, Error const& error) final override {
|
||||
return RestoreConfig(task).logError(cx, error, format("'%s' on '%s'", error.what(), task->params[Task::reservedTaskParamKeyType].printable().c_str()));
|
||||
}
|
||||
std::string toString(Reference<Task> task) const override { return ""; }
|
||||
virtual std::string toString(Reference<Task> task) const override { return ""; }
|
||||
};
|
||||
|
||||
struct BackupTaskFuncBase : TaskFuncBase {
|
||||
Future<Void> handleError(Database cx, Reference<Task> task, Error const& error) override {
|
||||
Future<Void> handleError(Database cx, Reference<Task> task, Error const& error) final override {
|
||||
return BackupConfig(task).logError(cx, error, format("'%s' on '%s'", error.what(), task->params[Task::reservedTaskParamKeyType].printable().c_str()));
|
||||
}
|
||||
std::string toString(Reference<Task> task) const override { return ""; }
|
||||
virtual std::string toString(Reference<Task> task) const override { return ""; }
|
||||
};
|
||||
|
||||
ACTOR static Future<Standalone<VectorRef<KeyRef>>> getBlockOfShards(Reference<ReadYourWritesTransaction> tr, Key beginKey, Key endKey, int limit) {
|
||||
|
@ -984,15 +984,15 @@ namespace fileBackup {
|
|||
}
|
||||
} Params;
|
||||
|
||||
std::string toString(Reference<Task> task) {
|
||||
return format("beginKey '%s' endKey '%s' addTasks %d",
|
||||
std::string toString(Reference<Task> task) const override {
|
||||
return format("beginKey '%s' endKey '%s' addTasks %d",
|
||||
Params.beginKey().get(task).printable().c_str(),
|
||||
Params.endKey().get(task).printable().c_str(),
|
||||
Params.addBackupRangeTasks().get(task)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
StringRef getName() const { return name; };
|
||||
StringRef getName() const { return name; };
|
||||
|
||||
Future<Void> execute(Database cx, Reference<TaskBucket> tb, Reference<FutureBucket> fb, Reference<Task> task) { return _execute(cx, tb, fb, task); };
|
||||
Future<Void> finish(Reference<ReadYourWritesTransaction> tr, Reference<TaskBucket> tb, Reference<FutureBucket> fb, Reference<Task> task) { return _finish(tr, tb, fb, task); };
|
||||
|
@ -2589,13 +2589,13 @@ namespace fileBackup {
|
|||
static TaskParam<int64_t> readLen() { return LiteralStringRef(__FUNCTION__); }
|
||||
} Params;
|
||||
|
||||
std::string toString(Reference<Task> task) {
|
||||
return format("fileName '%s' readLen %lld readOffset %lld",
|
||||
std::string toString(Reference<Task> task) const override {
|
||||
return format("fileName '%s' readLen %lld readOffset %lld",
|
||||
Params.inputFile().get(task).fileName.c_str(),
|
||||
Params.readLen().get(task),
|
||||
Params.readOffset().get(task));
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
struct RestoreRangeTaskFunc : RestoreFileTaskFuncBase {
|
||||
static struct : InputParams {
|
||||
|
@ -2616,14 +2616,14 @@ namespace fileBackup {
|
|||
}
|
||||
} Params;
|
||||
|
||||
std::string toString(Reference<Task> task) {
|
||||
std::string returnStr = RestoreFileTaskFuncBase::toString(task);
|
||||
std::string toString(Reference<Task> task) const override {
|
||||
std::string returnStr = RestoreFileTaskFuncBase::toString(task);
|
||||
for(auto &range : Params.getOriginalFileRanges(task))
|
||||
returnStr += format(" originalFileRange '%s'", printable(range).c_str());
|
||||
return returnStr;
|
||||
}
|
||||
}
|
||||
|
||||
ACTOR static Future<Void> _execute(Database cx, Reference<TaskBucket> taskBucket, Reference<FutureBucket> futureBucket, Reference<Task> task) {
|
||||
ACTOR static Future<Void> _execute(Database cx, Reference<TaskBucket> taskBucket, Reference<FutureBucket> futureBucket, Reference<Task> task) {
|
||||
state RestoreConfig restore(task);
|
||||
|
||||
state RestoreFile rangeFile = Params.inputFile().get(task);
|
||||
|
|
|
@ -1096,7 +1096,7 @@ ACTOR Future<CoordinatorsResult> changeQuorum(Database cx, Reference<IQuorumChan
|
|||
}
|
||||
}
|
||||
|
||||
struct SpecifiedQuorumChange : IQuorumChange {
|
||||
struct SpecifiedQuorumChange final : IQuorumChange {
|
||||
vector<NetworkAddress> desired;
|
||||
explicit SpecifiedQuorumChange( vector<NetworkAddress> const& desired ) : desired(desired) {}
|
||||
Future<vector<NetworkAddress>> getDesiredCoordinators(Transaction* tr, vector<NetworkAddress> oldCoordinators,
|
||||
|
@ -1107,7 +1107,7 @@ struct SpecifiedQuorumChange : IQuorumChange {
|
|||
};
|
||||
Reference<IQuorumChange> specifiedQuorumChange(vector<NetworkAddress> const& addresses) { return Reference<IQuorumChange>(new SpecifiedQuorumChange(addresses)); }
|
||||
|
||||
struct NoQuorumChange : IQuorumChange {
|
||||
struct NoQuorumChange final : IQuorumChange {
|
||||
Future<vector<NetworkAddress>> getDesiredCoordinators(Transaction* tr, vector<NetworkAddress> oldCoordinators,
|
||||
Reference<ClusterConnectionFile>,
|
||||
CoordinatorsResult&) override {
|
||||
|
@ -1116,7 +1116,7 @@ struct NoQuorumChange : IQuorumChange {
|
|||
};
|
||||
Reference<IQuorumChange> noQuorumChange() { return Reference<IQuorumChange>(new NoQuorumChange); }
|
||||
|
||||
struct NameQuorumChange : IQuorumChange {
|
||||
struct NameQuorumChange final : IQuorumChange {
|
||||
std::string newName;
|
||||
Reference<IQuorumChange> otherChange;
|
||||
explicit NameQuorumChange( std::string const& newName, Reference<IQuorumChange> const& otherChange ) : newName(newName), otherChange(otherChange) {}
|
||||
|
@ -1131,7 +1131,7 @@ Reference<IQuorumChange> nameQuorumChange(std::string const& name, Reference<IQu
|
|||
return Reference<IQuorumChange>(new NameQuorumChange( name, other ));
|
||||
}
|
||||
|
||||
struct AutoQuorumChange : IQuorumChange {
|
||||
struct AutoQuorumChange final : IQuorumChange {
|
||||
int desired;
|
||||
explicit AutoQuorumChange( int desired ) : desired(desired) {}
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
#include "flow/ThreadHelper.actor.h"
|
||||
|
||||
template<class T>
|
||||
class AbortableSingleAssignmentVar : public ThreadSingleAssignmentVar<T>, public ThreadCallback {
|
||||
template <class T>
|
||||
class AbortableSingleAssignmentVar final : public ThreadSingleAssignmentVar<T>, public ThreadCallback {
|
||||
public:
|
||||
AbortableSingleAssignmentVar(ThreadFuture<T> future, ThreadFuture<Void> abortSignal) : future(future), abortSignal(abortSignal), hasBeenSet(false), callbacksCleared(false) {
|
||||
int userParam;
|
||||
|
@ -124,8 +124,8 @@ ThreadFuture<T> abortableFuture(ThreadFuture<T> f, ThreadFuture<Void> abortSigna
|
|||
return ThreadFuture<T>(new AbortableSingleAssignmentVar<T>(f, abortSignal));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
class DLThreadSingleAssignmentVar : public ThreadSingleAssignmentVar<T> {
|
||||
template <class T>
|
||||
class DLThreadSingleAssignmentVar final : public ThreadSingleAssignmentVar<T> {
|
||||
public:
|
||||
DLThreadSingleAssignmentVar(Reference<FdbCApi> api, FdbCApi::FDBFuture *f, std::function<T(FdbCApi::FDBFuture*, FdbCApi*)> extractValue) : api(api), f(f), extractValue(extractValue), futureRefCount(1) {
|
||||
ThreadSingleAssignmentVar<T>::addref();
|
||||
|
@ -223,8 +223,8 @@ ThreadFuture<T> toThreadFuture(Reference<FdbCApi> api, FdbCApi::FDBFuture *f, st
|
|||
return ThreadFuture<T>(new DLThreadSingleAssignmentVar<T>(api, f, extractValue));
|
||||
}
|
||||
|
||||
template<class S, class T>
|
||||
class MapSingleAssignmentVar : public ThreadSingleAssignmentVar<T>, ThreadCallback {
|
||||
template <class S, class T>
|
||||
class MapSingleAssignmentVar final : public ThreadSingleAssignmentVar<T>, ThreadCallback {
|
||||
public:
|
||||
MapSingleAssignmentVar(ThreadFuture<S> source, std::function<ErrorOr<T>(ErrorOr<S>)> mapValue) : source(source), mapValue(mapValue) {
|
||||
ThreadSingleAssignmentVar<T>::addref();
|
||||
|
@ -275,8 +275,8 @@ ThreadFuture<T> mapThreadFuture(ThreadFuture<S> source, std::function<ErrorOr<T>
|
|||
return ThreadFuture<T>(new MapSingleAssignmentVar<S, T>(source, mapValue));
|
||||
}
|
||||
|
||||
template<class S, class T>
|
||||
class FlatMapSingleAssignmentVar : public ThreadSingleAssignmentVar<T>, ThreadCallback {
|
||||
template <class S, class T>
|
||||
class FlatMapSingleAssignmentVar final : public ThreadSingleAssignmentVar<T>, ThreadCallback {
|
||||
public:
|
||||
FlatMapSingleAssignmentVar(ThreadFuture<S> source, std::function<ErrorOr<ThreadFuture<T>>(ErrorOr<S>)> mapValue) : source(source), mapValue(mapValue), cancelled(false), released(false) {
|
||||
ThreadSingleAssignmentVar<T>::addref();
|
||||
|
|
|
@ -1436,7 +1436,7 @@ TEST_CASE("/fdbclient/multiversionclient/EnvironmentVariableParsing" ) {
|
|||
return Void();
|
||||
}
|
||||
|
||||
class ValidateFuture : public ThreadCallback {
|
||||
class ValidateFuture final : public ThreadCallback {
|
||||
public:
|
||||
ValidateFuture(ThreadFuture<int> f, ErrorOr<int> expectedValue, std::set<int> legalErrors) : f(f), expectedValue(expectedValue), legalErrors(legalErrors) { }
|
||||
|
||||
|
@ -1693,7 +1693,7 @@ TEST_CASE("/fdbclient/multiversionclient/AbortableSingleAssignmentVar" ) {
|
|||
return Void();
|
||||
}
|
||||
|
||||
class CAPICallback : public ThreadCallback {
|
||||
class CAPICallback final : public ThreadCallback {
|
||||
public:
|
||||
CAPICallback(void (*callbackf)(FdbCApi::FDBFuture*, void*), FdbCApi::FDBFuture* f, void* userdata)
|
||||
: callbackf(callbackf), f(f), userdata(userdata) {}
|
||||
|
|
|
@ -296,7 +296,7 @@ struct ClientInfo : ThreadSafeReferenceCounted<ClientInfo> {
|
|||
|
||||
class MultiVersionApi;
|
||||
|
||||
class MultiVersionDatabase : public IDatabase, ThreadSafeReferenceCounted<MultiVersionDatabase> {
|
||||
class MultiVersionDatabase final : public IDatabase, ThreadSafeReferenceCounted<MultiVersionDatabase> {
|
||||
public:
|
||||
MultiVersionDatabase(MultiVersionApi *api, std::string clusterFilePath, Reference<IDatabase> db, bool openConnectors=true);
|
||||
~MultiVersionDatabase();
|
||||
|
|
|
@ -687,7 +687,7 @@ struct SimDiskSpace {
|
|||
|
||||
void doReboot( ISimulator::ProcessInfo* const& p, ISimulator::KillType const& kt );
|
||||
|
||||
struct Sim2Listener : IListener, ReferenceCounted<Sim2Listener> {
|
||||
struct Sim2Listener final : IListener, ReferenceCounted<Sim2Listener> {
|
||||
explicit Sim2Listener( ISimulator::ProcessInfo* process, const NetworkAddress& listenAddr )
|
||||
: process(process),
|
||||
address(listenAddr) {}
|
||||
|
@ -728,7 +728,7 @@ private:
|
|||
|
||||
#define g_sim2 ((Sim2&)g_simulator)
|
||||
|
||||
class Sim2 : public ISimulator, public INetworkConnections {
|
||||
class Sim2 final : public ISimulator, public INetworkConnections {
|
||||
public:
|
||||
// Implement INetwork interface
|
||||
// Everything actually network related is delegated to the Sim2Net class; Sim2 is only concerned with simulating machines and time
|
||||
|
|
|
@ -94,7 +94,7 @@ private:
|
|||
};
|
||||
|
||||
template <class Threadlike, class Mutex, bool IS_CORO>
|
||||
class WorkPool : public IThreadPool, public ReferenceCounted<WorkPool<Threadlike,Mutex,IS_CORO>> {
|
||||
class WorkPool final : public IThreadPool, public ReferenceCounted<WorkPool<Threadlike, Mutex, IS_CORO>> {
|
||||
struct Worker;
|
||||
|
||||
// Pool can survive the destruction of WorkPool while it waits for workers to terminate
|
||||
|
|
|
@ -158,7 +158,7 @@ public:
|
|||
};
|
||||
|
||||
// TeamCollection's server team info.
|
||||
class TCTeamInfo : public ReferenceCounted<TCTeamInfo>, public IDataDistributionTeam {
|
||||
class TCTeamInfo final : public ReferenceCounted<TCTeamInfo>, public IDataDistributionTeam {
|
||||
vector< Reference<TCServerInfo> > servers;
|
||||
vector<UID> serverIDs;
|
||||
bool healthy;
|
||||
|
|
|
@ -82,7 +82,7 @@ struct RelocateData {
|
|||
bool operator!=(const RelocateData& rhs) const { return !(*this == rhs); }
|
||||
};
|
||||
|
||||
class ParallelTCInfo : public ReferenceCounted<ParallelTCInfo>, public IDataDistributionTeam {
|
||||
class ParallelTCInfo final : public ReferenceCounted<ParallelTCInfo>, public IDataDistributionTeam {
|
||||
vector<Reference<IDataDistributionTeam>> teams;
|
||||
|
||||
int64_t sum(std::function<int64_t(IDataDistributionTeam const&)> func) const {
|
||||
|
|
|
@ -103,7 +103,7 @@ typedef Standalone<TLogQueueEntryRef> TLogQueueEntry;
|
|||
struct LogData;
|
||||
struct TLogData;
|
||||
|
||||
struct TLogQueue : public IClosable {
|
||||
struct TLogQueue final : public IClosable {
|
||||
public:
|
||||
TLogQueue( IDiskQueue* queue, UID dbgid ) : queue(queue), dbgid(dbgid) {}
|
||||
|
||||
|
|
|
@ -2974,7 +2974,7 @@ struct InPlaceArray {
|
|||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
class VersionedBTree : public IVersionedStore {
|
||||
class VersionedBTree final : public IVersionedStore {
|
||||
public:
|
||||
// The first possible internal record possible in the tree
|
||||
static RedwoodRecordRef dbBegin;
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
#include "boost/asio.hpp"
|
||||
#include "boost/bind.hpp"
|
||||
|
||||
|
||||
class ThreadPool : public IThreadPool, public ReferenceCounted<ThreadPool> {
|
||||
class ThreadPool final : public IThreadPool, public ReferenceCounted<ThreadPool> {
|
||||
struct Thread {
|
||||
ThreadPool *pool;
|
||||
IThreadPoolReceiver* userObject;
|
||||
|
@ -103,7 +102,6 @@ public:
|
|||
void post(PThreadAction action) override { ios.post(ActionWrapper(action)); }
|
||||
};
|
||||
|
||||
|
||||
Reference<IThreadPool> createGenericThreadPool(int stackSize)
|
||||
{
|
||||
return Reference<IThreadPool>( new ThreadPool(stackSize) );
|
||||
|
|
|
@ -109,7 +109,7 @@ private:
|
|||
|
||||
Reference<IThreadPool> createGenericThreadPool(int stackSize = 0);
|
||||
|
||||
class DummyThreadPool : public IThreadPool, ReferenceCounted<DummyThreadPool> {
|
||||
class DummyThreadPool final : public IThreadPool, ReferenceCounted<DummyThreadPool> {
|
||||
public:
|
||||
~DummyThreadPool() {}
|
||||
DummyThreadPool() : thread(nullptr) {}
|
||||
|
@ -142,6 +142,4 @@ private:
|
|||
Promise<Void> errors;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -537,7 +537,7 @@ struct SSLHandshakerThread : IThreadPoolReceiver {
|
|||
SSLHandshakerThread() {}
|
||||
virtual void init() {}
|
||||
|
||||
struct Handshake : TypedAction<SSLHandshakerThread,Handshake> {
|
||||
struct Handshake final : TypedAction<SSLHandshakerThread, Handshake> {
|
||||
Handshake(ssl_socket &socket, ssl_socket::handshake_type type) : socket(socket), type(type) {
|
||||
}
|
||||
double getTimeEstimate() const override { return 0.001; }
|
||||
|
|
|
@ -201,7 +201,7 @@ public:
|
|||
|
||||
Reference<BarrierList> barriers;
|
||||
|
||||
struct WriterThread : IThreadPoolReceiver {
|
||||
struct WriterThread final : IThreadPoolReceiver {
|
||||
WriterThread( Reference<BarrierList> barriers, Reference<ITraceLogWriter> logWriter, Reference<ITraceLogFormatter> formatter )
|
||||
: barriers(barriers), logWriter(logWriter), formatter(formatter) {}
|
||||
|
||||
|
@ -211,7 +211,7 @@ public:
|
|||
Reference<ITraceLogFormatter> formatter;
|
||||
Reference<BarrierList> barriers;
|
||||
|
||||
struct Open : TypedAction<WriterThread,Open> {
|
||||
struct Open final : TypedAction<WriterThread, Open> {
|
||||
double getTimeEstimate() const override { return 0; }
|
||||
};
|
||||
void action( Open& o ) {
|
||||
|
@ -219,7 +219,7 @@ public:
|
|||
logWriter->write(formatter->getHeader());
|
||||
}
|
||||
|
||||
struct Close : TypedAction<WriterThread,Close> {
|
||||
struct Close final : TypedAction<WriterThread, Close> {
|
||||
double getTimeEstimate() const override { return 0; }
|
||||
};
|
||||
void action( Close& c ) {
|
||||
|
@ -227,7 +227,7 @@ public:
|
|||
logWriter->close();
|
||||
}
|
||||
|
||||
struct Roll : TypedAction<WriterThread,Roll> {
|
||||
struct Roll final : TypedAction<WriterThread, Roll> {
|
||||
double getTimeEstimate() const override { return 0; }
|
||||
};
|
||||
void action( Roll& c ) {
|
||||
|
@ -236,14 +236,14 @@ public:
|
|||
logWriter->write(formatter->getHeader());
|
||||
}
|
||||
|
||||
struct Barrier : TypedAction<WriterThread, Barrier> {
|
||||
struct Barrier final : TypedAction<WriterThread, Barrier> {
|
||||
double getTimeEstimate() const override { return 0; }
|
||||
};
|
||||
void action( Barrier& a ) {
|
||||
barriers->pop();
|
||||
}
|
||||
|
||||
struct WriteBuffer : TypedAction<WriterThread, WriteBuffer> {
|
||||
struct WriteBuffer final : TypedAction<WriterThread, WriteBuffer> {
|
||||
std::vector<TraceEventFields> events;
|
||||
|
||||
WriteBuffer(std::vector<TraceEventFields> events) : events(events) {}
|
||||
|
@ -260,7 +260,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
struct Ping : TypedAction<WriterThread, Ping> {
|
||||
struct Ping final : TypedAction<WriterThread, Ping> {
|
||||
ThreadReturnPromise<Void> ack;
|
||||
|
||||
explicit Ping(){};
|
||||
|
|
|
@ -534,8 +534,8 @@ public:
|
|||
int getFutureReferenceCount() const { return futures; }
|
||||
int getPromiseReferenceCount() const { return promises; }
|
||||
|
||||
void destroy() override { delete this; }
|
||||
void cancel() override {}
|
||||
virtual void destroy() override { delete this; }
|
||||
virtual void cancel() override {}
|
||||
|
||||
void addCallbackAndDelFutureRef(Callback<T>* cb) {
|
||||
// We are always *logically* dropping one future reference from this, but if we are adding a first callback
|
||||
|
|
Loading…
Reference in New Issue