Skip to content
Merged
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
57 changes: 28 additions & 29 deletions src/db-copy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "pgsql-params.hpp"

#include <cassert>
#include <cstddef>
#include <condition_variable>
#include <deque>
#include <future>
Expand Down Expand Up @@ -74,12 +75,11 @@ class db_target_descr_t
*/
class db_deleter_by_id_t
{
enum
{
// There is a trade-off here between sending as few DELETE SQL as
// possible and keeping the size of the deletable vector managable.
Max_entries = 1000000
};
/**
* There is a trade-off here between sending as few DELETE SQL as
* possible and keeping the size of the deletable vector managable.
*/
static constexpr std::size_t Max_entries = 1000000;

public:
bool has_data() const noexcept { return !m_deletables.empty(); }
Expand All @@ -101,12 +101,11 @@ class db_deleter_by_id_t
*/
class db_deleter_by_type_and_id_t
{
enum
{
// There is a trade-off here between sending as few DELETE SQL as
// possible and keeping the size of the deletable vector managable.
Max_entries = 1000000
};
/**
* There is a trade-off here between sending as few DELETE SQL as
* possible and keeping the size of the deletable vector managable.
*/
static constexpr std::size_t Max_entries = 1000000;

struct item_t
{
Expand Down Expand Up @@ -140,23 +139,23 @@ class db_deleter_by_type_and_id_t

struct db_cmd_copy_t
{
enum
{
/** Size of a single buffer with COPY data for Postgresql.
* This is a trade-off between memory usage and sending large chunks
* to speed up processing. Currently a one-size fits all value.
* Needs more testing and individual values per queue.
*/
Max_buf_size = 10 * 1024 * 1024,
/** Maximum length of the queue with COPY data.
* In the usual case, PostgreSQL should be faster processing the
* data than it can be produced and there should only be one element
* in the queue. If PostgreSQL is slower, then the queue will always
* be full and it is better to keep the queue smaller to reduce memory
* usage. Current value is just assumed to be a reasonable trade off.
*/
Max_buffers = 10
};
/**
* Size of a single buffer with COPY data for Postgresql.
* This is a trade-off between memory usage and sending large chunks
* to speed up processing. Currently a one-size fits all value.
* Needs more testing and individual values per queue.
*/
static constexpr std::size_t Max_buf_size = 10 * 1024 * 1024;

/**
* Maximum length of the queue with COPY data.
* In the usual case, PostgreSQL should be faster processing the
* data than it can be produced and there should only be one element
* in the queue. If PostgreSQL is slower, then the queue will always
* be full and it is better to keep the queue smaller to reduce memory
* usage. Current value is just assumed to be a reasonable trade off.
*/
static constexpr std::size_t Max_buffers = 10;

/// Name of the target table for the copy operation
std::shared_ptr<db_target_descr_t> target;
Expand Down
6 changes: 3 additions & 3 deletions src/middle-pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,18 @@ class member_list_json_builder
}

private:
osmium::builder::RelationMemberListBuilder *m_builder;
std::string m_role;
osmium::builder::RelationMemberListBuilder *m_builder;
osmium::object_id_type m_ref = 0;
osmium::item_type m_type = osmium::item_type::undefined;
enum class next_val
enum class next_val : std::uint8_t
{
none,
type,
ref,
role
} m_next_val = next_val::none;
};
}; // class member_list_json_builder

template <typename T>
void pgsql_parse_json_members(char const *string,
Expand Down
2 changes: 1 addition & 1 deletion src/output-flex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct options_t;
* When C++ code is called from the Lua code we sometimes need to know
* in what context this happens. These are the possible contexts.
*/
enum class calling_context
enum class calling_context : std::uint8_t
{
main = 0, ///< In main context, i.e. the Lua script outside any callbacks
process_node = 1, ///< In the process_node() callback
Expand Down
3 changes: 2 additions & 1 deletion src/taginfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
* For a full list of authors see the git log.
*/

#include <cstdint>
#include <string>
#include <vector>

enum class ColumnType
enum class ColumnType : std::uint8_t
{
INT,
REAL,
Expand Down
2 changes: 1 addition & 1 deletion tests/test-output-flex-nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TEST_CASE("add nodes")
CHECK(1 == conn.get_count("osm2pgsql_test_t1", "node_id = 17"));
}

enum class node_relationship
enum class node_relationship : std::uint8_t
{
none,
in_way,
Expand Down