From: Thomas Markwalder Date: Thu, 14 Jul 2016 13:09:03 +0000 (-0400) Subject: [4277] Added PostgreSQL HR Managment section to developer's guide X-Git-Tag: trac4551_base~12^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c941012d8e8359198d1a26f51af78f83c1f5fa95;p=thirdparty%2Fkea.git [4277] Added PostgreSQL HR Managment section to developer's guide src/lib/dhcprsrv/images/pgsql_host_data_source.svg - New class diagram for PgSqlHostDataSource doc/Doxyfile - Added src/lib/dhcprsrv/images to IMAGE_PATH src/lib/dhcpsrv/Makefile.am - Added images/pgsql_host_data_source.svg to EXTRA_DIST src/lib/dhcpsrv/libdhcpsrv.dox - Added subsection postgreSQLHostMgr src/lib/dhcpsrv/pgsql_connection.h src/lib/dhcpsrv/pgsql_exchange.h - Minor cleanup --- diff --git a/doc/Doxyfile b/doc/Doxyfile index 57bdb66ea1..eebef8cd28 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -886,7 +886,7 @@ EXAMPLE_RECURSIVE = NO # directories that contain image that are included in the documentation (see # the \image command). -IMAGE_PATH = ../doc/images ../src/lib/hooks/images ../src/bin/d2/images +IMAGE_PATH = ../doc/images ../src/lib/hooks/images ../src/bin/d2/images ../src/lib/dhcpsrv/images # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program diff --git a/src/lib/dhcpsrv/Makefile.am b/src/lib/dhcpsrv/Makefile.am index 16c8c64497..dcfec8609e 100755 --- a/src/lib/dhcpsrv/Makefile.am +++ b/src/lib/dhcpsrv/Makefile.am @@ -41,6 +41,9 @@ EXTRA_DIST += parsers/host_reservations_list_parser.h EXTRA_DIST += parsers/ifaces_config_parser.cc EXTRA_DIST += parsers/ifaces_config_parser.h +# Devel guide diagrams +EXTRA_DIST += images/pgsql_host_data_source.svg + # Define rule to build logging source files from message file alloc_engine_messages.h alloc_engine_messages.cc dhcpsrv_messages.h \ dhcpsrv_messages.cc hosts_messages.h hosts_messages.cc: s-messages diff --git a/src/lib/dhcpsrv/images/pgsql_host_data_source.svg b/src/lib/dhcpsrv/images/pgsql_host_data_source.svg new file mode 100644 index 0000000000..944715d9f7 --- /dev/null +++ b/src/lib/dhcpsrv/images/pgsql_host_data_source.svg @@ -0,0 +1,419 @@ + + + + + + + + + PgSqlHostDataSource + + + PgSqlHostDataSource() + ~PgSqlHostDataSource() + getAll() + getAll() + getAll4() + get4() + get4() + get4() + get6() + get6() + get6() + add() + getType() + getName() + getDescription() + getVersion() + + + + + + PgSqlExchange + + columns_ + + PgSqlExchange() + ~PgSqlExchange() + convertToDatabaseTime() + convertToDatabaseTime() + convertFromDatabaseTime() + getRawColumnValue() + getColumnLabel() + getColumnValue() + getColumnValue() + getColumnValue() + getIPv6Value() + isColumnNull() + getColumnValue() + convertFromBytea() + dumpRow() + + + + + + OptionProcessor + + universe_ + start_column_ + option_id_index_ + code_index_ + value_index_ + formatted_value_index_ + space_index_ + persistent_index_ + most_recent_option_id_ + + OptionProcessor() + clear() + retrieveOption() + setColumnNames() + + + impl_ + + + conn_ + + + conn_ + + + host_exchange_ + + + host_ipv6_exchange_ + + + host_ipv46_exchange_ + + + host_ipv6_reservation_exchange_ + + + host_option_exchange_ + + + opt_proc4_ + + + opt_proc6_ + + + + + + PgSqlHostDataSourceImpl + + + PgSqlHostDataSourceImpl() + ~PgSqlHostDataSourceImpl() + addStatement() + addResv() + addOption() + addOptions() + getHostCollection() + getHost() + getVersion() + + + + + + + + + + + PgSqlConnection + + DUPLICATE_KEY + + PgSqlConnection() + ~PgSqlConnection() + prepareStatement() + openDatabase() + startTransaction() + commit() + rollback() + compareError() + checkStatementError() + operator PGconn*() + operator bool() + + + + + + PgSqlHostWithOptionsExchange + + OPTION_COLUMNS + + PgSqlHostWithOptionsExchange() + clear() + processRowData() + getRequiredColumnsNum() + + + + + + + + + + + + + + + <<:shared_ptr>> + + + + + + PgSqlTransaction + + committed_ + + PgSqlTransaction() + ~PgSqlTransaction() + commit() + + + + + + PgSqlHostIPv6Exchange + + RESERVATION_COLUMNS + reservation_id_index_ + address_index_ + prefix_len_index_ + type_index_ + iaid_index_ + most_recent_reservation_id_ + + PgSqlHostIPv6Exchange() + clear() + getReservationId() + retrieveReservation() + processRowData() + + + + + + PgSqlHostExchange + + HOST_ID_COL + DHCP_IDENTIFIER_COL + DHCP_IDENTIFIER_TYPE_COL + DHCP4_SUBNET_ID_COL + DHCP6_SUBNET_ID_COL + IPV4_ADDRESS_COL + HOSTNAME_COL + DHCP4_CLIENT_CLASSES_COL + DHCP6_CLIENT_CLASSES_COL + HOST_COLUMNS + + PgSqlHostExchange() + ~PgSqlHostExchange() + clear() + findAvailColumn() + getHostId() + createBindForSend() + processRowData() + retrieveHost() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <<:shared_ptr>> + + + <<:shared_ptr>> + + + + + + <<typedef>> + OptionProcessorPtr + + + + + + + + PgSqlIPv6ReservationExchange + + RESRV_COLUMNS + + PgSqlIPv6ReservationExchange() + createBindForSend() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <<:shared_ptr>> + + + + + + PgSqlOptionExchange + + OPTION_ID_COL + CODE_COL + VALUE_COL + FORMATTED_VALUE_COL + SPACE_COL + PERSISTENT_COL + DHCP_CLIENT_CLASS_COL + DHCP_SUBNET_ID_COL + HOST_ID_COL + SCOPE_ID_COL + OPTION_COLUMNS + value_ + value_len_ + option_ + + PgSqlOptionExchange() + createBindForSend() + + + + + + + + + + + + + + + + + + + + + <<:shared_ptr>> + + + + + + BaseHostDataSource + + + ~BaseHostDataSource() + getAll() + getAll() + getAll4() + get4() + get4() + get4() + get6() + get6() + get6() + add() + getType() + commit() + rollback() + + + + + + + + diff --git a/src/lib/dhcpsrv/libdhcpsrv.dox b/src/lib/dhcpsrv/libdhcpsrv.dox index e757c051f2..20defeb4d7 100644 --- a/src/lib/dhcpsrv/libdhcpsrv.dox +++ b/src/lib/dhcpsrv/libdhcpsrv.dox @@ -110,6 +110,15 @@ data source (if present) and concatenate results. For more information about the \ref isc::dhcp::HostMgr please refer to its documentation. +@subsection postgreSQLHostMgr PostgreSQL Host Reservation Management + +Storing and retrieving host reservations within a PostgreSQL schema is +provided by the class, \ref isc::dhcp::PgSqlHostDataSource, a derivation of +\ref isc::dhcp::BaseHostDataSource and is depicted in the following +class diagram: + +@image html pgsql_host_data_source.svg "PgSqlHostDataSource Class Diagram" + @section optionsConfig Options Configuration Information The \ref isc::dhcp::CfgOption object holds a collection of options being diff --git a/src/lib/dhcpsrv/pgsql_connection.h b/src/lib/dhcpsrv/pgsql_connection.h index d75e818275..92bcd4b5ed 100755 --- a/src/lib/dhcpsrv/pgsql_connection.h +++ b/src/lib/dhcpsrv/pgsql_connection.h @@ -132,6 +132,7 @@ public: /// /// @param col index of the column name to fetch /// @return string containing the name of the column + /// This method is exception safe. std::string getColumnLabel(const int col) const; /// @brief Conversion Operator diff --git a/src/lib/dhcpsrv/pgsql_exchange.h b/src/lib/dhcpsrv/pgsql_exchange.h index 5658b8bc32..ea21627913 100644 --- a/src/lib/dhcpsrv/pgsql_exchange.h +++ b/src/lib/dhcpsrv/pgsql_exchange.h @@ -271,7 +271,9 @@ public: /// string "Unknown column:". Note this is NOT from the /// list of columns defined in the exchange. /// + /// @param r the result set containing the query results /// @param col index of the column name to fetch + /// /// @return string containing the name of the column static std::string getColumnLabel(const PgSqlResult& r, const size_t col);