MCPcopy Create free account
hub / github.com/Snapchat/Valdi / MmapTweakProvider

Class MmapTweakProvider

valdi/test/integration/MmapModuleArchive_tests.cpp:48–80  ·  view source on GitHub ↗

Tweak provider that exposes a single boolean COF used by ValdiRuntimeTweaks.

Source from the content-addressed store, hash-verified

46
47// Tweak provider that exposes a single boolean COF used by ValdiRuntimeTweaks.
48class MmapTweakProvider : public SharedPtrRefCountable,
49 public snap::valdi_core::ModuleFactory,
50 public ITweakValueProvider {
51public:
52 void setEnabled(bool enabled) {
53 _config.setMapValue(kTweakKey, Value(static_cast<bool>(enabled)));
54 }
55
56 StringBox getModulePath() override {
57 return STRING_LITERAL("Tweak");
58 }
59 Value loadModule() override {
60 return Value();
61 }
62 StringBox getString(const StringBox& key, const StringBox&) override {
63 return _config.getMapValue(key).toStringBox();
64 }
65 bool getBool(const StringBox& key, bool) override {
66 return _config.getMapValue(key).toBool();
67 }
68 float getFloat(const StringBox& key, float) override {
69 return _config.getMapValue(key).toFloat();
70 }
71 int32_t getInt(const StringBox& key, int32_t) override {
72 return _config.getMapValue(key).toInt();
73 }
74 Value getBinary(const StringBox& key, const Value&) override {
75 return _config.getMapValue(key);
76 }
77
78private:
79 Value _config;
80};
81
82// Metrics implementation that records counter / timer calls for the four
83// metrics added in this PR. All other Metrics methods are no-ops; gtest

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected