24 const size_t max_transactions)
25 :queue_mgr_(queue_mgr), cfg_mgr_(cfg_mgr), io_service_(io_service) {
32 "D2UpdateMgr configuration manager cannot be null");
44 transaction_list_.clear();
81 TransactionList::iterator it = transaction_list_.begin();
82 while (it != transaction_list_.end()) {
84 if (trans->isModelDone()) {
87 transaction_list_.erase(it++);
102 for (
size_t index = 0; index < queue_count; ++index) {
105 queue_mgr_->dequeueAt(index);
114 DHCP_DDNS_NO_ELIGIBLE_JOBS)
130 int direction_count = 0;
133 if (next_ncr->isForwardChange()) {
134 if (!cfg_mgr_->forwardUpdatesEnabled()) {
135 next_ncr->setForwardChange(
false);
137 DHCP_DDNS_FWD_REQUEST_IGNORED)
138 .arg(next_ncr->getRequestId())
139 .arg(next_ncr->toText());
141 bool matched = cfg_mgr_->matchForward(next_ncr->getFqdn(),
148 .arg(next_ncr->getRequestId())
149 .arg(next_ncr->toText());
159 if (next_ncr->isReverseChange()) {
160 if (!cfg_mgr_->reverseUpdatesEnabled()) {
161 next_ncr->setReverseChange(
false);
163 DHCP_DDNS_REV_REQUEST_IGNORED)
164 .arg(next_ncr->getRequestId())
165 .arg(next_ncr->toText());
167 bool matched = cfg_mgr_->matchReverse(next_ncr->getIpAddress(),
174 .arg(next_ncr->getRequestId())
175 .arg(next_ncr->toText());
185 if (!direction_count) {
187 DHCP_DDNS_REQUEST_DROPPED)
188 .arg(next_ncr->getRequestId())
189 .arg(next_ncr->toText());
201 forward_domain, reverse_domain,
205 forward_domain, reverse_domain,
210 transaction_list_[key] = trans;
213 trans->startTransaction();
216 TransactionList::iterator
218 return (transaction_list_.find(key));
230 transaction_list_.erase(pos);
234 TransactionList::iterator
236 return (transaction_list_.begin());
239 TransactionList::iterator
241 return (transaction_list_.end());
248 transaction_list_.clear();
254 if (new_trans_max < 1) {
256 " maximum transactions limit must be greater than zero");
262 "cannot be less than the current transaction count :" 266 max_transactions_ = new_trans_max;
271 return (queue_mgr_->getQueueSize());
276 return (transaction_list_.size());
size_t getMaxTransactions() const
Returns the maximum number of concurrent transactions.
void clearTransactionList()
Immediately discards all entries in the transaction list.
boost::shared_ptr< NameChangeTransaction > NameChangeTransactionPtr
Defines a pointer to a NameChangeTransaction.
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
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.
size_t getTransactionCount() const
Returns the current number of transactions.
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.
TransactionList::iterator transactionListBegin()
Returns the transaction list beg position.
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
std::string toStr() const
Returns the DHCID value as a string of hexadecimal digits.
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.
Embodies the "life-cycle" required to carry out a DDNS Remove update.
const int DBGLVL_TRACE_DETAIL_DATA
Trace data associated with detailed operations.
isc::log::Logger dhcp_to_d2_logger("dhcp-to-d2")
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
This file defines the class NameRemoveTransaction.
TransactionList::iterator transactionListEnd()
Returns the transaction list end position.
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.
size_t getQueueCount() const
Convenience method that returns the number of requests queued.
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 ...