Skip to content

Implement C++ line_sender::flush_and_keep_with_flags() #88

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
36 changes: 36 additions & 0 deletions include/questdb/ingress/line_sender.hpp
Original file line number Diff line number Diff line change
@@ -1247,6 +1247,42 @@ namespace questdb::ingress
}
}

/**
* Send the batch of rows in the buffer to the QuestDB server, and, if the parameter
* `transactional` is true, ensure the flush will be transactional.
* See docs on the ::line_sender_flush_and_keep_with_flags() function for more details.
*/
bool flush_and_keep_with_flags(const line_sender_buffer& buffer, bool transactional)
{
try
{
if (buffer._impl)
{
ensure_impl();
line_sender_error::wrapped_call(
::line_sender_flush_and_keep_with_flags,
_impl,
buffer._impl,
transactional);
}
else
{
line_sender_buffer buffer2{0};
buffer2.may_init();
line_sender_error::wrapped_call(
::line_sender_flush_and_keep_with_flags,
_impl,
buffer2._impl,
transactional);
}
}
catch (...)
{
return false;
}
return true;
}

/**
* Check if an error occurred previously and the sender must be closed.
* This happens when there was an earlier failure.