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

Refactor: Simplifiy code by using std::variant for copy mgr #2209

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

joto
Copy link
Collaborator

@joto joto commented Jul 7, 2024

The second commit simplifies the code further.

}

void flush()
{
// flush current buffer if there is one
if (m_current) {
m_processor->add_buffer(std::move(m_current));
m_processor->send_command(
db_cmd_copy_delete_t<DELETER>{std::move(m_current)});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does m_current really need wrapping here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have fixed that, rebased and force-pushed.

joto added 2 commits July 9, 2024 11:21
COPYs are handled in extra threads through a worker queue. Using
std::variant instead of virtual classes simplifies the code, because we
don't need the indirection through a unique_ptr any more.
This is simpler than having the connection in a unique_ptr in the worker
thread. Open the connection in the main thread also means any errors
happen still in the main thread where they are trivial to handle.
@joto joto force-pushed the variant-for-copy branch from b8982b5 to 6bd67a7 Compare July 9, 2024 09:33
@lonvia lonvia merged commit f0433c2 into osm2pgsql-dev:master Jul 9, 2024
26 checks passed
@joto joto deleted the variant-for-copy branch July 10, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants