Fix HighContentionPrefixAllocatorWorkload and make untrusted argument to workload factory type safe
This commit is contained in:
parent
fb1390ef3d
commit
180238076c
|
@ -231,13 +231,16 @@ struct IWorkloadFactory : ReferenceCounted<IWorkloadFactory> {
|
|||
virtual Reference<TestWorkload> create(WorkloadContext const& wcx) = 0;
|
||||
};
|
||||
|
||||
FDB_DECLARE_BOOLEAN_PARAM(UntrustedMode);
|
||||
|
||||
template <class Workload>
|
||||
struct WorkloadFactory : IWorkloadFactory {
|
||||
static_assert(std::is_convertible_v<decltype(Workload::NAME), std::string>,
|
||||
"Each workload must have a Workload::NAME member");
|
||||
using WorkloadType = TestWorkloadImpl<Workload>;
|
||||
bool runInUntrustedClient;
|
||||
WorkloadFactory(bool runInUntrustedClient = false) : runInUntrustedClient(runInUntrustedClient) {
|
||||
WorkloadFactory(UntrustedMode runInUntrustedClient = UntrustedMode::False)
|
||||
: runInUntrustedClient(runInUntrustedClient) {
|
||||
factories()[WorkloadType::NAME] = Reference<IWorkloadFactory>::addRef(this);
|
||||
}
|
||||
Reference<TestWorkload> create(WorkloadContext const& wcx) override {
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include "fdbserver/WorkerInterface.actor.h"
|
||||
#include "flow/actorcompiler.h" // This must be the last #include.
|
||||
|
||||
FDB_DEFINE_BOOLEAN_PARAM(UntrustedMode);
|
||||
|
||||
WorkloadContext::WorkloadContext() {}
|
||||
|
||||
WorkloadContext::WorkloadContext(const WorkloadContext& r)
|
||||
|
|
|
@ -328,5 +328,5 @@ struct CycleWorkload : TestWorkload, CycleMembers<MultiTenancy> {
|
|||
}
|
||||
};
|
||||
|
||||
WorkloadFactory<CycleWorkload<false>> CycleWorkloadFactory(false);
|
||||
WorkloadFactory<CycleWorkload<true>> TenantCycleWorkloadFactory(true);
|
||||
WorkloadFactory<CycleWorkload<false>> CycleWorkloadFactory(UntrustedMode::False);
|
||||
WorkloadFactory<CycleWorkload<true>> TenantCycleWorkloadFactory(UntrustedMode::True);
|
||||
|
|
|
@ -154,5 +154,4 @@ struct HighContentionPrefixAllocatorWorkload : TestWorkload {
|
|||
|
||||
void getMetrics(std::vector<PerfMetric>& m) override {}
|
||||
};
|
||||
WorkloadFactory<HighContentionPrefixAllocatorWorkload> HighContentionPrefixAllocatorWorkload(
|
||||
HighContentionPrefixAllocatorWorkload::NAME);
|
||||
WorkloadFactory<HighContentionPrefixAllocatorWorkload> HighContentionPrefixAllocatorWorkload;
|
||||
|
|
|
@ -141,4 +141,4 @@ struct PrivateEndpoints : TestWorkload {
|
|||
|
||||
} // namespace
|
||||
|
||||
WorkloadFactory<PrivateEndpoints> PrivateEndpointsFactory(true);
|
||||
WorkloadFactory<PrivateEndpoints> PrivateEndpointsFactory(UntrustedMode::True);
|
||||
|
|
Loading…
Reference in New Issue