26 const size_t max_transactions)
27 :queue_mgr_(queue_mgr), cfg_mgr_(cfg_mgr), io_service_(io_service) {
34 "D2UpdateMgr configuration manager cannot be null");
46 transaction_list_.clear();
83 TransactionList::iterator it = transaction_list_.begin();
84 while (it != transaction_list_.end()) {
86 if (trans->isModelDone()) {
89 transaction_list_.erase(it++);
104 for (
size_t index = 0; index < queue_count; ++index) {
107 queue_mgr_->dequeueAt(index);
132 int direction_count = 0;
135 if (next_ncr->isForwardChange()) {
136 if (!cfg_mgr_->forwardUpdatesEnabled()) {
137 next_ncr->setForwardChange(
false);
140 .arg(next_ncr->getRequestId())
141 .arg(next_ncr->toText());
143 bool matched = cfg_mgr_->matchForward(next_ncr->getFqdn(),
150 .arg(next_ncr->getRequestId())
151 .arg(next_ncr->toText());
161 if (next_ncr->isReverseChange()) {
162 if (!cfg_mgr_->reverseUpdatesEnabled()) {
163 next_ncr->setReverseChange(
false);
166 .arg(next_ncr->getRequestId())
167 .arg(next_ncr->toText());
169 bool matched = cfg_mgr_->matchReverse(next_ncr->getIpAddress(),
176 .arg(next_ncr->getRequestId())
177 .arg(next_ncr->toText());
187 if (!direction_count) {
190 .arg(next_ncr->getRequestId())
191 .arg(next_ncr->toText());
202 if (next_ncr->useConflictResolution()) {
204 forward_domain, reverse_domain,
208 forward_domain, reverse_domain,
212 if (next_ncr->useConflictResolution()) {
214 forward_domain, reverse_domain,
218 forward_domain, reverse_domain,
224 transaction_list_[key] = trans;
227 trans->startTransaction();
230 TransactionList::iterator
232 return (transaction_list_.find(key));
244 transaction_list_.erase(pos);
248 TransactionList::iterator
250 return (transaction_list_.begin());
253 TransactionList::iterator
255 return (transaction_list_.end());
262 transaction_list_.clear();
268 if (new_trans_max < 1) {
270 " maximum transactions limit must be greater than zero");
276 "cannot be less than the current transaction count :"
280 max_transactions_ = new_trans_max;
285 return (queue_mgr_->getQueueSize());
290 return (transaction_list_.size());
void clearTransactionList()
Immediately discards all entries in the transaction list.
std::string toStr() const
Returns the DHCID value as a string of hexadecimal digits.
Embodies the "life-cycle" required to carry out a DDNS Add update.
boost::shared_ptr< NameChangeTransaction > NameChangeTransactionPtr
Defines a pointer to a NameChangeTransaction.
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
const isc::log::MessageID DHCP_DDNS_REV_REQUEST_IGNORED
This file defines the class NameAddTransaction.
virtual ~D2UpdateMgr()
Destructor.
void makeTransaction(isc::dhcp_ddns::NameChangeRequestPtr &ncr)
Create a new transaction for the given request.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
const isc::log::MessageID DHCP_DDNS_REQUEST_DROPPED
void sweep()
Check current transactions; start transactions for new requests.
bool hasTransaction(const TransactionKey &key)
Convenience method that checks transaction list for the given key.
TransactionList::iterator findTransaction(const TransactionKey &key)
Search the transaction list for the given key.
size_t getQueueCount() const
Convenience method that returns the number of requests queued.
TransactionList::iterator transactionListBegin()
Returns the transaction list beg position.
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
void removeTransaction(const TransactionKey &key)
Removes the entry pointed to by key from the transaction list.
void pickNextJob()
Starts a transaction for the next eligible request in the queue.
D2UpdateMgr(D2QueueMgrPtr &queue_mgr, D2CfgMgrPtr &cfg_mgr, asiolink::IOServicePtr &io_service, const size_t max_transactions=MAX_TRANSACTIONS_DEFAULT)
Constructor.
boost::shared_ptr< D2QueueMgr > D2QueueMgrPtr
Defines a pointer for manager instances.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
size_t getTransactionCount() const
Returns the current number of transactions.
Embodies the "life-cycle" required to carry out a DDNS Remove update.
const int DBGLVL_TRACE_DETAIL_DATA
Trace data associated with detailed operations.
const isc::log::MessageID DHCP_DDNS_NO_REV_MATCH_ERROR
isc::log::Logger dhcp_to_d2_logger("dhcp-to-d2")
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
size_t getMaxTransactions() const
Returns the maximum number of concurrent transactions.
This file defines the class NameRemoveTransaction.
const isc::log::MessageID DHCP_DDNS_NO_FWD_MATCH_ERROR
TransactionList::iterator transactionListEnd()
Returns the transaction list end position.
const isc::log::MessageID DHCP_DDNS_AT_MAX_TRANSACTIONS
Embodies the "life-cycle" required to carry out a DDNS Add update.
Defines the logger used by the top-level component of kea-dhcp-ddns.
void checkFinishedTransactions()
Performs post-completion cleanup on completed transactions.
Container class for handling the DHCID value within a NameChangeRequest.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
Thrown if the update manager encounters a general error.
Embodies the "life-cycle" required to carry out a DDNS Remove update.
This file defines the class D2UpdateMgr.
void setMaxTransactions(const size_t max_transactions)
Sets the maximum number of entries allowed in the queue.
static const size_t MAX_TRANSACTIONS_DEFAULT
Maximum number of concurrent transactions NOTE that 32 is an arbitrary choice picked for the initial ...
const isc::log::MessageID DHCP_DDNS_FWD_REQUEST_IGNORED
const isc::log::MessageID DHCP_DDNS_NO_ELIGIBLE_JOBS