Commit 27469d0 1 parent 9029592 commit 27469d0 Copy full SHA for 27469d0
File tree 2 files changed +23
-0
lines changed
presto-native-execution/presto_cpp/main/common
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,21 @@ std::string ConfigBase::capacityPropertyAsBytesString(
85
85
velox::config::CapacityUnit::BYTE));
86
86
}
87
87
88
+ bool ConfigBase::registerProperty (
89
+ const std::string& propertyName,
90
+ const folly::Optional<std::string>& defaultValue) {
91
+ if (registeredProps_.count (propertyName) != 0 ) {
92
+ PRESTO_STARTUP_LOG (WARNING)
93
+ << " Property '" << propertyName
94
+ << " ' is already registered with default value '"
95
+ << registeredProps_[propertyName].value_or (" <none>" ) << " '." ;
96
+ return false ;
97
+ }
98
+
99
+ registeredProps_[propertyName] = defaultValue;
100
+ return true ;
101
+ }
102
+
88
103
folly::Optional<std::string> ConfigBase::setValue (
89
104
const std::string& propertyName,
90
105
const std::string& value) {
Original file line number Diff line number Diff line change @@ -42,6 +42,14 @@ class ConfigBase {
42
42
config_ = std::move (config);
43
43
}
44
44
45
+ // / DO NOT DELETE THIS METHOD!
46
+ // / The method is used to register new properties after the config class is created.
47
+ // / Returns true if succeeded, false if failed (due to the property already
48
+ // / registered).
49
+ bool registerProperty (
50
+ const std::string& propertyName,
51
+ const folly::Optional<std::string>& defaultValue = {});
52
+
45
53
// / Adds or replaces value at the given key. Can be used by debugging or
46
54
// / testing code.
47
55
// / Returns previous value if there was any.
You can’t perform that action at this time.
0 commit comments