MCPcopy Create free account
hub / github.com/bytedance/bolt / registerStatefulVectorFunction

Function registerStatefulVectorFunction

bolt/expression/VectorFunction.cpp:118–141  ·  view source on GitHub ↗

Registers a new vector function. When overwrite = true, previous functions with the given name will be replaced. Returns true iff an insertion actually happened

Source from the content-addressed store, hash-verified

116/// with the given name will be replaced.
117/// Returns true iff an insertion actually happened
118bool registerStatefulVectorFunction(
119 const std::string& name,
120 std::vector<FunctionSignaturePtr> signatures,
121 VectorFunctionFactory factory,
122 VectorFunctionMetadata metadata,
123 bool overwrite) {
124 auto sanitizedName = sanitizeName(name);
125
126 if (overwrite) {
127 vectorFunctionFactories().withWLock([&](auto& functionMap) {
128 // Insert/overwrite.
129 functionMap[sanitizedName] = {
130 std::move(signatures), std::move(factory), std::move(metadata)};
131 });
132 return true;
133 }
134
135 return vectorFunctionFactories().withWLock([&](auto& functionMap) {
136 auto [iterator, inserted] = functionMap.insert(
137 {sanitizedName,
138 {std::move(signatures), std::move(factory), std::move(metadata)}});
139 return inserted;
140 });
141}
142
143// Returns true iff an insertion actually happened
144bool registerVectorFunction(

Callers 15

registerRemoteFunctionFunction · 0.85
registerSimpleFunctionsFunction · 0.85
registerStringFunctionsFunction · 0.85
registerArrayFunctionsFunction · 0.85
SetUpTestCaseMethod · 0.85
SetUpTestCaseMethod · 0.85
registerRe2FunctionsFunction · 0.85

Calls 2

sanitizeNameFunction · 0.85
insertMethod · 0.45

Tested by 3

SetUpTestCaseMethod · 0.68
SetUpTestCaseMethod · 0.68
TEST_PFunction · 0.68