Tweak provider that exposes a single boolean COF used by ValdiRuntimeTweaks.
| 46 | |
| 47 | // Tweak provider that exposes a single boolean COF used by ValdiRuntimeTweaks. |
| 48 | class MmapTweakProvider : public SharedPtrRefCountable, |
| 49 | public snap::valdi_core::ModuleFactory, |
| 50 | public ITweakValueProvider { |
| 51 | public: |
| 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 | |
| 78 | private: |
| 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 |
nothing calls this directly
no outgoing calls
no test coverage detected