MCPcopy Create free account
hub / github.com/apple/foundationdb / decodeKey

Method decodeKey

fdbclient/ConfigKnobs.cpp:25–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23#include "flow/UnitTest.h"
24
25ConfigKey ConfigKeyRef::decodeKey(KeyRef const& key) {
26 Tuple tuple;
27 try {
28 tuple = Tuple::unpack(key);
29 } catch (Error& e) {
30 TraceEvent(SevWarnAlways, "FailedToUnpackConfigKey").error(e).detail("Key", printable(key));
31 throw invalid_config_db_key();
32 }
33 if (tuple.size() != 2) {
34 throw invalid_config_db_key();
35 }
36 if (tuple.getType(0) == Tuple::NULL_TYPE) {
37 return ConfigKeyRef({}, tuple.getString(1));
38 } else {
39 if (tuple.getType(0) != Tuple::BYTES || tuple.getType(1) != Tuple::BYTES) {
40 throw invalid_config_db_key();
41 }
42 return ConfigKeyRef(tuple.getString(0), tuple.getString(1));
43 }
44}
45
46Value KnobValueRef::ToValueFunc::operator()(int v) const {
47 return BinaryWriter::toValue(v, Unversioned());

Callers 1

durabilityTestFunction · 0.80

Calls 9

unpackFunction · 0.85
TraceEventClass · 0.85
ConfigKeyRefClass · 0.85
detailMethod · 0.80
printableFunction · 0.70
errorMethod · 0.45
sizeMethod · 0.45
getTypeMethod · 0.45
getStringMethod · 0.45

Tested by 1

durabilityTestFunction · 0.64