mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-01 22:45:18 +00:00
[#1074] implemented connection pool for pgsql host mgr
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -17,6 +17,15 @@ namespace dhcp {
|
|||||||
/// Forward declaration to the implementation of the @ref PgSqlHostDataSource.
|
/// Forward declaration to the implementation of the @ref PgSqlHostDataSource.
|
||||||
class PgSqlHostDataSourceImpl;
|
class PgSqlHostDataSourceImpl;
|
||||||
|
|
||||||
|
/// @brief Type of pointers to PgSqlHostDataSourceImpl.
|
||||||
|
typedef boost::shared_ptr<PgSqlHostDataSourceImpl> PgSqlHostDataSourceImplPtr;
|
||||||
|
|
||||||
|
/// Forward declaration for the thread context for the manager pool.
|
||||||
|
class PgSqlHostContext;
|
||||||
|
|
||||||
|
/// @brief Type of pointers to contexts.
|
||||||
|
typedef boost::shared_ptr<PgSqlHostContext> PgSqlHostContextPtr;
|
||||||
|
|
||||||
/// @brief PostgreSQL Host Data Source
|
/// @brief PostgreSQL Host Data Source
|
||||||
///
|
///
|
||||||
/// This class implements the @ref isc::dhcp::BaseHostDataSource interface to
|
/// This class implements the @ref isc::dhcp::BaseHostDataSource interface to
|
||||||
@@ -32,7 +41,7 @@ class PgSqlHostDataSourceImpl;
|
|||||||
/// - IDENT_CIRCUIT_ID
|
/// - IDENT_CIRCUIT_ID
|
||||||
/// - IDENT_CLIENT_ID
|
/// - IDENT_CLIENT_ID
|
||||||
///
|
///
|
||||||
class PgSqlHostDataSource: public BaseHostDataSource {
|
class PgSqlHostDataSource : public BaseHostDataSource {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
@@ -107,7 +116,8 @@ public:
|
|||||||
/// @param addr specified address.
|
/// @param addr specified address.
|
||||||
/// @return true if deletion was successful, false if the host was not there.
|
/// @return true if deletion was successful, false if the host was not there.
|
||||||
/// @throw various exceptions in case of errors
|
/// @throw various exceptions in case of errors
|
||||||
virtual bool del(const SubnetID& subnet_id, const asiolink::IOAddress& addr);
|
virtual bool del(const SubnetID& subnet_id,
|
||||||
|
const asiolink::IOAddress& addr);
|
||||||
|
|
||||||
/// @brief Attempts to delete a host by (subnet4-id, identifier type, identifier)
|
/// @brief Attempts to delete a host by (subnet4-id, identifier type, identifier)
|
||||||
///
|
///
|
||||||
@@ -123,7 +133,8 @@ public:
|
|||||||
/// @throw various exceptions in case of errors
|
/// @throw various exceptions in case of errors
|
||||||
virtual bool del4(const SubnetID& subnet_id,
|
virtual bool del4(const SubnetID& subnet_id,
|
||||||
const Host::IdentifierType& identifier_type,
|
const Host::IdentifierType& identifier_type,
|
||||||
const uint8_t* identifier_begin, const size_t identifier_len);
|
const uint8_t* identifier_begin,
|
||||||
|
const size_t identifier_len);
|
||||||
|
|
||||||
/// @brief Attempts to delete a host by (subnet6-id, identifier type, identifier)
|
/// @brief Attempts to delete a host by (subnet6-id, identifier type, identifier)
|
||||||
///
|
///
|
||||||
@@ -139,7 +150,8 @@ public:
|
|||||||
/// @throw various exceptions in case of errors
|
/// @throw various exceptions in case of errors
|
||||||
virtual bool del6(const SubnetID& subnet_id,
|
virtual bool del6(const SubnetID& subnet_id,
|
||||||
const Host::IdentifierType& identifier_type,
|
const Host::IdentifierType& identifier_type,
|
||||||
const uint8_t* identifier_begin, const size_t identifier_len);
|
const uint8_t* identifier_begin,
|
||||||
|
const size_t identifier_len);
|
||||||
|
|
||||||
/// @brief Return all hosts connected to any subnet for which reservations
|
/// @brief Return all hosts connected to any subnet for which reservations
|
||||||
/// have been made using a specified identifier.
|
/// have been made using a specified identifier.
|
||||||
@@ -154,9 +166,9 @@ public:
|
|||||||
/// @param identifier_len Identifier length.
|
/// @param identifier_len Identifier length.
|
||||||
///
|
///
|
||||||
/// @return Collection of const @c Host objects.
|
/// @return Collection of const @c Host objects.
|
||||||
virtual ConstHostCollection
|
virtual ConstHostCollection getAll(const Host::IdentifierType& identifier_type,
|
||||||
getAll(const Host::IdentifierType& identifier_type,
|
const uint8_t* identifier_begin,
|
||||||
const uint8_t* identifier_begin, const size_t identifier_len) const;
|
const size_t identifier_len) const;
|
||||||
|
|
||||||
/// @brief Return all hosts in a DHCPv4 subnet.
|
/// @brief Return all hosts in a DHCPv4 subnet.
|
||||||
///
|
///
|
||||||
@@ -167,8 +179,7 @@ public:
|
|||||||
/// @param subnet_id subnet identifier to filter by
|
/// @param subnet_id subnet identifier to filter by
|
||||||
///
|
///
|
||||||
/// @return Collection of const @ref Host objects.
|
/// @return Collection of const @ref Host objects.
|
||||||
virtual ConstHostCollection
|
virtual ConstHostCollection getAll4(const SubnetID& subnet_id) const;
|
||||||
getAll4(const SubnetID& subnet_id) const;
|
|
||||||
|
|
||||||
/// @brief Return all hosts in a DHCPv6 subnet.
|
/// @brief Return all hosts in a DHCPv6 subnet.
|
||||||
///
|
///
|
||||||
@@ -179,8 +190,7 @@ public:
|
|||||||
/// @param subnet_id subnet identifier to filter by
|
/// @param subnet_id subnet identifier to filter by
|
||||||
///
|
///
|
||||||
/// @return Collection of const @ref Host objects.
|
/// @return Collection of const @ref Host objects.
|
||||||
virtual ConstHostCollection
|
virtual ConstHostCollection getAll6(const SubnetID& subnet_id) const;
|
||||||
getAll6(const SubnetID& subnet_id) const;
|
|
||||||
|
|
||||||
/// @brief Return all hosts with a hostname.
|
/// @brief Return all hosts with a hostname.
|
||||||
///
|
///
|
||||||
@@ -192,8 +202,7 @@ public:
|
|||||||
/// @param hostname The lower case hostname.
|
/// @param hostname The lower case hostname.
|
||||||
///
|
///
|
||||||
/// @return Collection of const @c Host objects.
|
/// @return Collection of const @c Host objects.
|
||||||
virtual ConstHostCollection
|
virtual ConstHostCollection getAllbyHostname(const std::string& hostname) const;
|
||||||
getAllbyHostname(const std::string& hostname) const;
|
|
||||||
|
|
||||||
/// @brief Return all hosts with a hostname in a DHCPv4 subnet.
|
/// @brief Return all hosts with a hostname in a DHCPv4 subnet.
|
||||||
///
|
///
|
||||||
@@ -204,8 +213,8 @@ public:
|
|||||||
/// @param subnet_id Subnet identifier.
|
/// @param subnet_id Subnet identifier.
|
||||||
///
|
///
|
||||||
/// @return Collection of const @c Host objects.
|
/// @return Collection of const @c Host objects.
|
||||||
virtual ConstHostCollection
|
virtual ConstHostCollection getAllbyHostname4(const std::string& hostname,
|
||||||
getAllbyHostname4(const std::string& hostname, const SubnetID& subnet_id) const;
|
const SubnetID& subnet_id) const;
|
||||||
|
|
||||||
/// @brief Return all hosts with a hostname in a DHCPv6 subnet.
|
/// @brief Return all hosts with a hostname in a DHCPv6 subnet.
|
||||||
///
|
///
|
||||||
@@ -216,8 +225,8 @@ public:
|
|||||||
/// @param subnet_id Subnet identifier.
|
/// @param subnet_id Subnet identifier.
|
||||||
///
|
///
|
||||||
/// @return Collection of const @c Host objects.
|
/// @return Collection of const @c Host objects.
|
||||||
virtual ConstHostCollection
|
virtual ConstHostCollection getAllbyHostname6(const std::string& hostname,
|
||||||
getAllbyHostname6(const std::string& hostname, const SubnetID& subnet_id) const;
|
const SubnetID& subnet_id) const;
|
||||||
|
|
||||||
/// @brief Returns range of hosts in a DHCPv4 subnet.
|
/// @brief Returns range of hosts in a DHCPv4 subnet.
|
||||||
///
|
///
|
||||||
@@ -236,11 +245,10 @@ public:
|
|||||||
/// @param page_size maximum size of the page returned.
|
/// @param page_size maximum size of the page returned.
|
||||||
///
|
///
|
||||||
/// @return Collection of const @c Host objects (may be empty).
|
/// @return Collection of const @c Host objects (may be empty).
|
||||||
virtual ConstHostCollection
|
virtual ConstHostCollection getPage4(const SubnetID& subnet_id,
|
||||||
getPage4(const SubnetID& subnet_id,
|
size_t& source_index,
|
||||||
size_t& source_index,
|
uint64_t lower_host_id,
|
||||||
uint64_t lower_host_id,
|
const HostPageSize& page_size) const;
|
||||||
const HostPageSize& page_size) const;
|
|
||||||
|
|
||||||
/// @brief Returns range of hosts in a DHCPv6 subnet.
|
/// @brief Returns range of hosts in a DHCPv6 subnet.
|
||||||
///
|
///
|
||||||
@@ -259,11 +267,10 @@ public:
|
|||||||
/// @param page_size maximum size of the page returned.
|
/// @param page_size maximum size of the page returned.
|
||||||
///
|
///
|
||||||
/// @return Collection of const @c Host objects (may be empty).
|
/// @return Collection of const @c Host objects (may be empty).
|
||||||
virtual ConstHostCollection
|
virtual ConstHostCollection getPage6(const SubnetID& subnet_id,
|
||||||
getPage6(const SubnetID& subnet_id,
|
size_t& source_index,
|
||||||
size_t& source_index,
|
uint64_t lower_host_id,
|
||||||
uint64_t lower_host_id,
|
const HostPageSize& page_size) const;
|
||||||
const HostPageSize& page_size) const;
|
|
||||||
|
|
||||||
/// @brief Returns a collection of hosts using the specified IPv4 address.
|
/// @brief Returns a collection of hosts using the specified IPv4 address.
|
||||||
///
|
///
|
||||||
@@ -273,8 +280,7 @@ public:
|
|||||||
/// @param address IPv4 address for which the @c Host object is searched.
|
/// @param address IPv4 address for which the @c Host object is searched.
|
||||||
///
|
///
|
||||||
/// @return Collection of const @c Host objects.
|
/// @return Collection of const @c Host objects.
|
||||||
virtual ConstHostCollection
|
virtual ConstHostCollection getAll4(const asiolink::IOAddress& address) const;
|
||||||
getAll4(const asiolink::IOAddress& address) const;
|
|
||||||
|
|
||||||
/// @brief Returns a host connected to the IPv4 subnet.
|
/// @brief Returns a host connected to the IPv4 subnet.
|
||||||
///
|
///
|
||||||
@@ -286,9 +292,10 @@ public:
|
|||||||
///
|
///
|
||||||
/// @return Const @c Host object for which reservation has been made using
|
/// @return Const @c Host object for which reservation has been made using
|
||||||
/// the specified identifier.
|
/// the specified identifier.
|
||||||
virtual ConstHostPtr
|
virtual ConstHostPtr get4(const SubnetID& subnet_id,
|
||||||
get4(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type,
|
const Host::IdentifierType& identifier_type,
|
||||||
const uint8_t* identifier_begin, const size_t identifier_len) const;
|
const uint8_t* identifier_begin,
|
||||||
|
const size_t identifier_len) const;
|
||||||
|
|
||||||
/// @brief Returns a host connected to the IPv4 subnet and having
|
/// @brief Returns a host connected to the IPv4 subnet and having
|
||||||
/// a reservation for a specified IPv4 address.
|
/// a reservation for a specified IPv4 address.
|
||||||
@@ -304,8 +311,8 @@ public:
|
|||||||
///
|
///
|
||||||
/// @return Const @c Host object using a specified IPv4 address.
|
/// @return Const @c Host object using a specified IPv4 address.
|
||||||
/// @throw BadValue is given an IPv6 address
|
/// @throw BadValue is given an IPv6 address
|
||||||
virtual ConstHostPtr
|
virtual ConstHostPtr get4(const SubnetID& subnet_id,
|
||||||
get4(const SubnetID& subnet_id, const asiolink::IOAddress& address) const;
|
const asiolink::IOAddress& address) const;
|
||||||
|
|
||||||
/// @brief Returns a host connected to the IPv6 subnet.
|
/// @brief Returns a host connected to the IPv6 subnet.
|
||||||
///
|
///
|
||||||
@@ -317,9 +324,10 @@ public:
|
|||||||
///
|
///
|
||||||
/// @return Const @c Host object for which reservation has been made using
|
/// @return Const @c Host object for which reservation has been made using
|
||||||
/// the specified identifier.
|
/// the specified identifier.
|
||||||
virtual ConstHostPtr
|
virtual ConstHostPtr get6(const SubnetID& subnet_id,
|
||||||
get6(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type,
|
const Host::IdentifierType& identifier_type,
|
||||||
const uint8_t* identifier_begin, const size_t identifier_len) const;
|
const uint8_t* identifier_begin,
|
||||||
|
const size_t identifier_len) const;
|
||||||
|
|
||||||
/// @brief Returns a host using the specified IPv6 prefix.
|
/// @brief Returns a host using the specified IPv6 prefix.
|
||||||
///
|
///
|
||||||
@@ -327,8 +335,8 @@ public:
|
|||||||
/// @param prefix_len IPv6 prefix length.
|
/// @param prefix_len IPv6 prefix length.
|
||||||
///
|
///
|
||||||
/// @return Const @c Host object using a specified IPv6 prefix.
|
/// @return Const @c Host object using a specified IPv6 prefix.
|
||||||
virtual ConstHostPtr
|
virtual ConstHostPtr get6(const asiolink::IOAddress& prefix,
|
||||||
get6(const asiolink::IOAddress& prefix, const uint8_t prefix_len) const;
|
const uint8_t prefix_len) const;
|
||||||
|
|
||||||
/// @brief Returns a host connected to the IPv6 subnet and having
|
/// @brief Returns a host connected to the IPv6 subnet and having
|
||||||
/// a reservation for a specified IPv6 address or prefix.
|
/// a reservation for a specified IPv6 address or prefix.
|
||||||
@@ -337,8 +345,8 @@ public:
|
|||||||
/// @param address reserved IPv6 address/prefix.
|
/// @param address reserved IPv6 address/prefix.
|
||||||
///
|
///
|
||||||
/// @return Const @c Host object using a specified IPv6 address/prefix.
|
/// @return Const @c Host object using a specified IPv6 address/prefix.
|
||||||
virtual ConstHostPtr
|
virtual ConstHostPtr get6(const SubnetID& subnet_id,
|
||||||
get6(const SubnetID& subnet_id, const asiolink::IOAddress& address) const;
|
const asiolink::IOAddress& address) const;
|
||||||
|
|
||||||
/// @brief Return backend type
|
/// @brief Return backend type
|
||||||
///
|
///
|
||||||
@@ -387,9 +395,34 @@ public:
|
|||||||
/// Rolls back all pending database operations.
|
/// Rolls back all pending database operations.
|
||||||
virtual void rollback();
|
virtual void rollback();
|
||||||
|
|
||||||
|
/// @brief Context RAII Allocator.
|
||||||
|
class PgSqlHostContextAlloc {
|
||||||
|
public:
|
||||||
|
|
||||||
|
/// @brief Constructor
|
||||||
|
///
|
||||||
|
/// This constructor takes a context of the pool if one is available
|
||||||
|
/// or creates a new one.
|
||||||
|
///
|
||||||
|
/// @param mgr A parent instance
|
||||||
|
PgSqlHostContextAlloc(const PgSqlHostDataSourceImpl& mgr);
|
||||||
|
|
||||||
|
/// @brief Destructor
|
||||||
|
///
|
||||||
|
/// This destructor puts back the context in the pool.
|
||||||
|
~PgSqlHostContextAlloc();
|
||||||
|
|
||||||
|
/// @brief The context
|
||||||
|
PgSqlHostContextPtr ctx_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// @brief The manager
|
||||||
|
const PgSqlHostDataSourceImpl& mgr_;
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// @brief Pointer to the implementation of the @ref PgSqlHostDataSource.
|
/// @brief Pointer to the implementation of the @ref PgSqlHostDataSource.
|
||||||
PgSqlHostDataSourceImpl* impl_;
|
PgSqlHostDataSourceImplPtr impl_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -841,7 +841,7 @@ public:
|
|||||||
/// prevent cryptic errors during conversions from NULL
|
/// prevent cryptic errors during conversions from NULL
|
||||||
/// to actual values.
|
/// to actual values.
|
||||||
|
|
||||||
isc::asiolink::IOAddress addr(getIPv6Value(r, row, ADDRESS_COL));
|
IOAddress addr(getIPv6Value(r, row, ADDRESS_COL));
|
||||||
|
|
||||||
convertFromBytea(r, row, DUID_COL, duid_buffer_, sizeof(duid_buffer_), duid_length_);
|
convertFromBytea(r, row, DUID_COL, duid_buffer_, sizeof(duid_buffer_), duid_length_);
|
||||||
DuidPtr duid_ptr(new DUID(duid_buffer_, duid_length_));
|
DuidPtr duid_ptr(new DUID(duid_buffer_, duid_length_));
|
||||||
@@ -1147,8 +1147,8 @@ protected:
|
|||||||
|
|
||||||
// PgSqlLeaseContext Constructor
|
// PgSqlLeaseContext Constructor
|
||||||
|
|
||||||
PgSqlLeaseContext::PgSqlLeaseContext(
|
PgSqlLeaseContext::PgSqlLeaseContext(const DatabaseConnection::ParameterMap& parameters)
|
||||||
const DatabaseConnection::ParameterMap& parameters) : conn_(parameters) {
|
: conn_(parameters) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PgSqlLeaseContextAlloc Constructor and Destructor
|
// PgSqlLeaseContextAlloc Constructor and Destructor
|
||||||
@@ -1216,7 +1216,6 @@ PgSqlLeaseMgr::~PgSqlLeaseMgr() {
|
|||||||
|
|
||||||
PgSqlLeaseContextPtr
|
PgSqlLeaseContextPtr
|
||||||
PgSqlLeaseMgr::createContext() const {
|
PgSqlLeaseMgr::createContext() const {
|
||||||
|
|
||||||
PgSqlLeaseContextPtr ctx(new PgSqlLeaseContext(parameters_));
|
PgSqlLeaseContextPtr ctx(new PgSqlLeaseContext(parameters_));
|
||||||
|
|
||||||
// Open the database.
|
// Open the database.
|
||||||
@@ -1252,7 +1251,7 @@ PgSqlLeaseMgr::getDBVersion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PgSqlLeaseMgr::addLeaseCommon(PgSqlLeaseContextPtr ctx,
|
PgSqlLeaseMgr::addLeaseCommon(PgSqlLeaseContextPtr& ctx,
|
||||||
StatementIndex stindex,
|
StatementIndex stindex,
|
||||||
PsqlBindArray& bind_array) {
|
PsqlBindArray& bind_array) {
|
||||||
PgSqlResult r(PQexecPrepared(ctx->conn_, tagged_statements[stindex].name,
|
PgSqlResult r(PQexecPrepared(ctx->conn_, tagged_statements[stindex].name,
|
||||||
@@ -1318,7 +1317,7 @@ PgSqlLeaseMgr::addLease(const Lease6Ptr& lease) {
|
|||||||
|
|
||||||
template <typename Exchange, typename LeaseCollection>
|
template <typename Exchange, typename LeaseCollection>
|
||||||
void
|
void
|
||||||
PgSqlLeaseMgr::getLeaseCollection(PgSqlLeaseContextPtr ctx,
|
PgSqlLeaseMgr::getLeaseCollection(PgSqlLeaseContextPtr& ctx,
|
||||||
StatementIndex stindex,
|
StatementIndex stindex,
|
||||||
PsqlBindArray& bind_array,
|
PsqlBindArray& bind_array,
|
||||||
Exchange& exchange,
|
Exchange& exchange,
|
||||||
@@ -1346,7 +1345,7 @@ PgSqlLeaseMgr::getLeaseCollection(PgSqlLeaseContextPtr ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PgSqlLeaseMgr::getLease(PgSqlLeaseContextPtr ctx,
|
PgSqlLeaseMgr::getLease(PgSqlLeaseContextPtr& ctx,
|
||||||
StatementIndex stindex, PsqlBindArray& bind_array,
|
StatementIndex stindex, PsqlBindArray& bind_array,
|
||||||
Lease4Ptr& result) const {
|
Lease4Ptr& result) const {
|
||||||
// Create appropriate collection object and get all leases matching
|
// Create appropriate collection object and get all leases matching
|
||||||
@@ -1367,7 +1366,7 @@ PgSqlLeaseMgr::getLease(PgSqlLeaseContextPtr ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PgSqlLeaseMgr::getLease(PgSqlLeaseContextPtr ctx,
|
PgSqlLeaseMgr::getLease(PgSqlLeaseContextPtr& ctx,
|
||||||
StatementIndex stindex, PsqlBindArray& bind_array,
|
StatementIndex stindex, PsqlBindArray& bind_array,
|
||||||
Lease6Ptr& result) const {
|
Lease6Ptr& result) const {
|
||||||
// Create appropriate collection object and get all leases matching
|
// Create appropriate collection object and get all leases matching
|
||||||
@@ -1388,7 +1387,7 @@ PgSqlLeaseMgr::getLease(PgSqlLeaseContextPtr ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Lease4Ptr
|
Lease4Ptr
|
||||||
PgSqlLeaseMgr::getLease4(const isc::asiolink::IOAddress& addr) const {
|
PgSqlLeaseMgr::getLease4(const IOAddress& addr) const {
|
||||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET_ADDR4)
|
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET_ADDR4)
|
||||||
.arg(addr.toText());
|
.arg(addr.toText());
|
||||||
|
|
||||||
@@ -1597,7 +1596,7 @@ PgSqlLeaseMgr::getLeases4() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Lease4Collection
|
Lease4Collection
|
||||||
PgSqlLeaseMgr::getLeases4(const asiolink::IOAddress& lower_bound_address,
|
PgSqlLeaseMgr::getLeases4(const IOAddress& lower_bound_address,
|
||||||
const LeasePageSize& page_size) const {
|
const LeasePageSize& page_size) const {
|
||||||
// Expecting IPv4 address.
|
// Expecting IPv4 address.
|
||||||
if (!lower_bound_address.isV4()) {
|
if (!lower_bound_address.isV4()) {
|
||||||
@@ -1635,7 +1634,7 @@ PgSqlLeaseMgr::getLeases4(const asiolink::IOAddress& lower_bound_address,
|
|||||||
|
|
||||||
Lease6Ptr
|
Lease6Ptr
|
||||||
PgSqlLeaseMgr::getLease6(Lease::Type lease_type,
|
PgSqlLeaseMgr::getLease6(Lease::Type lease_type,
|
||||||
const isc::asiolink::IOAddress& addr) const {
|
const IOAddress& addr) const {
|
||||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET_ADDR6)
|
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET_ADDR6)
|
||||||
.arg(addr.toText())
|
.arg(addr.toText())
|
||||||
.arg(lease_type);
|
.arg(lease_type);
|
||||||
@@ -1824,7 +1823,7 @@ PgSqlLeaseMgr::getLeases6() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Lease6Collection
|
Lease6Collection
|
||||||
PgSqlLeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
|
PgSqlLeaseMgr::getLeases6(const IOAddress& lower_bound_address,
|
||||||
const LeasePageSize& page_size) const {
|
const LeasePageSize& page_size) const {
|
||||||
// Expecting IPv6 address.
|
// Expecting IPv6 address.
|
||||||
if (!lower_bound_address.isV6()) {
|
if (!lower_bound_address.isV6()) {
|
||||||
@@ -1915,7 +1914,7 @@ PgSqlLeaseMgr::getExpiredLeasesCommon(LeaseCollection& expired_leases,
|
|||||||
|
|
||||||
template<typename LeasePtr>
|
template<typename LeasePtr>
|
||||||
void
|
void
|
||||||
PgSqlLeaseMgr::updateLeaseCommon(PgSqlLeaseContextPtr ctx,
|
PgSqlLeaseMgr::updateLeaseCommon(PgSqlLeaseContextPtr& ctx,
|
||||||
StatementIndex stindex,
|
StatementIndex stindex,
|
||||||
PsqlBindArray& bind_array,
|
PsqlBindArray& bind_array,
|
||||||
const LeasePtr& lease) {
|
const LeasePtr& lease) {
|
||||||
@@ -2028,7 +2027,7 @@ PgSqlLeaseMgr::deleteLeaseCommon(StatementIndex stindex,
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
PgSqlLeaseMgr::deleteLease(const Lease4Ptr& lease) {
|
PgSqlLeaseMgr::deleteLease(const Lease4Ptr& lease) {
|
||||||
const isc::asiolink::IOAddress& addr = lease->addr_;
|
const IOAddress& addr = lease->addr_;
|
||||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_DELETE_ADDR)
|
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_DELETE_ADDR)
|
||||||
.arg(addr.toText());
|
.arg(addr.toText());
|
||||||
|
|
||||||
@@ -2062,7 +2061,7 @@ PgSqlLeaseMgr::deleteLease(const Lease4Ptr& lease) {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
PgSqlLeaseMgr::deleteLease(const Lease6Ptr& lease) {
|
PgSqlLeaseMgr::deleteLease(const Lease6Ptr& lease) {
|
||||||
const isc::asiolink::IOAddress& addr = lease->addr_;
|
const IOAddress& addr = lease->addr_;
|
||||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
|
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
|
||||||
DHCPSRV_PGSQL_DELETE_ADDR)
|
DHCPSRV_PGSQL_DELETE_ADDR)
|
||||||
.arg(addr.toText());
|
.arg(addr.toText());
|
||||||
|
@@ -668,8 +668,9 @@ private:
|
|||||||
///
|
///
|
||||||
/// @throw isc::db::DbOperationError An operation on the open database has
|
/// @throw isc::db::DbOperationError An operation on the open database has
|
||||||
/// failed.
|
/// failed.
|
||||||
bool addLeaseCommon(PgSqlLeaseContextPtr ctx,
|
bool addLeaseCommon(PgSqlLeaseContextPtr& ctx,
|
||||||
StatementIndex stindex, db::PsqlBindArray& bind_array);
|
StatementIndex stindex,
|
||||||
|
db::PsqlBindArray& bind_array);
|
||||||
|
|
||||||
/// @brief Get Lease Collection Common Code
|
/// @brief Get Lease Collection Common Code
|
||||||
///
|
///
|
||||||
@@ -693,7 +694,7 @@ private:
|
|||||||
/// @throw isc::db::MultipleRecords Multiple records were retrieved
|
/// @throw isc::db::MultipleRecords Multiple records were retrieved
|
||||||
/// from the database where only one was expected.
|
/// from the database where only one was expected.
|
||||||
template <typename Exchange, typename LeaseCollection>
|
template <typename Exchange, typename LeaseCollection>
|
||||||
void getLeaseCollection(PgSqlLeaseContextPtr ctx,
|
void getLeaseCollection(PgSqlLeaseContextPtr& ctx,
|
||||||
StatementIndex stindex,
|
StatementIndex stindex,
|
||||||
db::PsqlBindArray& bind_array,
|
db::PsqlBindArray& bind_array,
|
||||||
Exchange& exchange, LeaseCollection& result,
|
Exchange& exchange, LeaseCollection& result,
|
||||||
@@ -716,7 +717,7 @@ private:
|
|||||||
/// failed.
|
/// failed.
|
||||||
/// @throw isc::db::MultipleRecords Multiple records were retrieved
|
/// @throw isc::db::MultipleRecords Multiple records were retrieved
|
||||||
/// from the database where only one was expected.
|
/// from the database where only one was expected.
|
||||||
void getLeaseCollection(PgSqlLeaseContextPtr ctx,
|
void getLeaseCollection(PgSqlLeaseContextPtr& ctx,
|
||||||
StatementIndex stindex,
|
StatementIndex stindex,
|
||||||
db::PsqlBindArray& bind_array,
|
db::PsqlBindArray& bind_array,
|
||||||
Lease4Collection& result) const {
|
Lease4Collection& result) const {
|
||||||
@@ -739,7 +740,7 @@ private:
|
|||||||
/// failed.
|
/// failed.
|
||||||
/// @throw isc::db::MultipleRecords Multiple records were retrieved
|
/// @throw isc::db::MultipleRecords Multiple records were retrieved
|
||||||
/// from the database where only one was expected.
|
/// from the database where only one was expected.
|
||||||
void getLeaseCollection(PgSqlLeaseContextPtr ctx,
|
void getLeaseCollection(PgSqlLeaseContextPtr& ctx,
|
||||||
StatementIndex stindex,
|
StatementIndex stindex,
|
||||||
db::PsqlBindArray& bind_array,
|
db::PsqlBindArray& bind_array,
|
||||||
Lease6Collection& result) const {
|
Lease6Collection& result) const {
|
||||||
@@ -756,7 +757,7 @@ private:
|
|||||||
/// @param stindex Index of statement being executed
|
/// @param stindex Index of statement being executed
|
||||||
/// @param bind_array array for input parameters
|
/// @param bind_array array for input parameters
|
||||||
/// @param result Lease4 object returned
|
/// @param result Lease4 object returned
|
||||||
void getLease(PgSqlLeaseContextPtr ctx,
|
void getLease(PgSqlLeaseContextPtr& ctx,
|
||||||
StatementIndex stindex,
|
StatementIndex stindex,
|
||||||
db::PsqlBindArray& bind_array,
|
db::PsqlBindArray& bind_array,
|
||||||
Lease4Ptr& result) const;
|
Lease4Ptr& result) const;
|
||||||
@@ -771,7 +772,7 @@ private:
|
|||||||
/// @param stindex Index of statement being executed
|
/// @param stindex Index of statement being executed
|
||||||
/// @param bind_array array for input parameters
|
/// @param bind_array array for input parameters
|
||||||
/// @param result Lease6 object returned
|
/// @param result Lease6 object returned
|
||||||
void getLease(PgSqlLeaseContextPtr ctx,
|
void getLease(PgSqlLeaseContextPtr& ctx,
|
||||||
StatementIndex stindex,
|
StatementIndex stindex,
|
||||||
db::PsqlBindArray& bind_array,
|
db::PsqlBindArray& bind_array,
|
||||||
Lease6Ptr& result) const;
|
Lease6Ptr& result) const;
|
||||||
@@ -812,7 +813,7 @@ private:
|
|||||||
/// @throw isc::db::DbOperationError An operation on the open database has
|
/// @throw isc::db::DbOperationError An operation on the open database has
|
||||||
/// failed.
|
/// failed.
|
||||||
template <typename LeasePtr>
|
template <typename LeasePtr>
|
||||||
void updateLeaseCommon(PgSqlLeaseContextPtr ctx,
|
void updateLeaseCommon(PgSqlLeaseContextPtr& ctx,
|
||||||
StatementIndex stindex,
|
StatementIndex stindex,
|
||||||
db::PsqlBindArray& bind_array,
|
db::PsqlBindArray& bind_array,
|
||||||
const LeasePtr& lease);
|
const LeasePtr& lease);
|
||||||
|
Reference in New Issue
Block a user