Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-generated kv pair serder ref. #19

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions components/core/src/clp/ffi/ir_stream/Deserializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,25 @@ auto Deserializer<IrUnitHandler>::deserialize_next_ir_unit(ReaderInterface& read
return result.error();
}

auto const node_locator{result.value()};
if (m_user_gen_keys_schema_tree->has_node(node_locator)) {
auto const& [is_auto_generated, node_locator]{result.value()};
auto& schema_tree_to_insert{
is_auto_generated ? m_auto_gen_keys_schema_tree : m_user_gen_keys_schema_tree
};

if (schema_tree_to_insert->has_node(node_locator)) {
return std::errc::protocol_error;
}

if (auto const err{m_ir_unit_handler.handle_schema_tree_node_insertion(node_locator)};
if (auto const err{m_ir_unit_handler.handle_schema_tree_node_insertion(
is_auto_generated,
node_locator
)};
IRErrorCode::IRErrorCode_Success != err)
{
return ir_error_code_to_errc(err);
}

std::ignore = m_user_gen_keys_schema_tree->insert_node(node_locator);
std::ignore = schema_tree_to_insert->insert_node(node_locator);
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ template <typename Handler>
concept IrUnitHandlerInterface = requires(
Handler handler,
KeyValuePairLogEvent&& log_event,
bool is_auto_generated,
UtcOffset utc_offset_old,
UtcOffset utc_offset_new,
SchemaTree::NodeLocator schema_tree_node_locator
Expand All @@ -42,11 +43,12 @@ concept IrUnitHandlerInterface = requires(

/**
* Handles a schema tree node insertion IR unit.
* @param is_auto_generated Whether the node is from auto-gen keys schema tree
* @param schema_tree_node_locator The locator of the node to insert.
* @return IRErrorCode::Success on success, user-defined error code on failures.
*/
{
handler.handle_schema_tree_node_insertion(schema_tree_node_locator)
handler.handle_schema_tree_node_insertion(is_auto_generated, schema_tree_node_locator)
} -> std::same_as<IRErrorCode>;

/**
Expand Down
Loading
Loading