32 const size_t max_transactions)
33 :queue_mgr_(queue_mgr), cfg_mgr_(cfg_mgr), io_service_(io_service) {
40 "D2UpdateMgr configuration manager cannot be null");
52 transaction_store_.clear();
86 auto siter = sidx.begin();
87 while (siter != sidx.end()) {
88 if ((*siter)->isModelDone()) {
89 siter = transaction_store_.get<
SequenceTag>().erase(siter);
104 for (
size_t index = 0; index < queue_count; ) {
111 queue_mgr_->dequeueAt(index);
130 int direction_count = 0;
133 if (next_ncr->isForwardChange()) {
134 if (!cfg_mgr_->forwardUpdatesEnabled()) {
135 next_ncr->setForwardChange(
false);
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);
164 .arg(next_ncr->getRequestId())
165 .arg(next_ncr->toText());
167 bool matched = cfg_mgr_->matchReverse(next_ncr->getIpAddress(),
169 next_ncr->getReverseZone());
176 .arg(next_ncr->getRequestId())
177 .arg(next_ncr->toText());
187 if (!direction_count) {
190 .arg(next_ncr->getRequestId())
191 .arg(next_ncr->toText());
201 if (next_ncr->getChangeType() ==
CHG_ADD) {
202 switch(next_ncr->getConflictResolutionMode()) {
205 forward_domain, reverse_domain,
210 forward_domain, reverse_domain,
215 forward_domain, reverse_domain,
221 forward_domain, reverse_domain,
226 switch(next_ncr->getConflictResolutionMode()) {
229 forward_domain, reverse_domain,
234 forward_domain, reverse_domain,
239 forward_domain, reverse_domain,
245 forward_domain, reverse_domain,
252 auto ret = transaction_store_.push_back(trans);
253 if (ret.second ==
false) {
256 << trans->getFqdn() <<
" or address " << trans->getIOAddress());
260 trans->startTransaction();
268 "D2UpdateMgr::hasTransaction() ncr cannot be null");
272 auto& fidx = transaction_store_.get<
FqdnTag>();
273 auto fiter = fidx.find(ncr->getFqdnLower());
274 if (fiter != fidx.end()) {
279 auto& aidx = transaction_store_.get<
AddressTag>();
280 auto aiter = aidx.find(ncr->getIOAddress());
281 if (aiter != aidx.end()) {
292 transaction_store_.clear();
298 if (new_trans_max < 1) {
300 " maximum transactions limit must be greater than zero");
306 "cannot be less than the current transaction count :"
310 max_transactions_ = new_trans_max;
315 return (queue_mgr_->getQueueSize());
320 return (transaction_store_.size());
323TransactionSequenceIndex::iterator
325 return (transaction_store_.get<
SequenceTag>().begin());
328TransactionSequenceIndex::iterator
330 return (transaction_store_.get<
SequenceTag>().end());
333TransactionFqdnIndex::iterator
335 return (transaction_store_.get<
FqdnTag>().find(fqdn));
338TransactionFqdnIndex::iterator
340 return (transaction_store_.get<
FqdnTag>().begin());
343TransactionFqdnIndex::iterator
345 return (transaction_store_.get<
FqdnTag>().end());
348TransactionAddressIndex::iterator
350 return (transaction_store_.get<
AddressTag>().find(address));
353TransactionAddressIndex::iterator
355 return (transaction_store_.get<
AddressTag>().begin());
358TransactionAddressIndex::iterator
360 return (transaction_store_.get<
AddressTag>().end());
This file defines the class CheckExistsAddTransaction.
This file defines the class CheckExistsRemoveTransaction.
The IOAddress class represents an IP addresses (version agnostic).
Embodies the "life-cycle" required to carry out a DDNS Add update.
Embodies the "life-cycle" required to carry out a DDNS Remove update.
Thrown if the update manager encounters a general error.
TransactionFqdnIndex::iterator transactionFqdnBegin()
Returns the transaction store begin iterator, ordered by FQDN.
TransactionAddressIndex::iterator transactionAddressEnd()
Returns the transaction store end iterator, ordered by address.
virtual ~D2UpdateMgr()
Destructor.
bool makeTransaction(isc::dhcp_ddns::NameChangeRequestPtr &ncr)
Create a new transaction for the given request.
TransactionFqdnIndex::iterator transactionFqdnEnd()
Returns the transaction store end iterator, ordered by FQDN.
TransactionAddressIndex::iterator transactionAddressBegin()
Returns the transaction store begin iterator, ordered by address.
TransactionSequenceIndex::iterator transactionSequenceEnd()
Returns the transaction store sequence end position.
void checkFinishedTransactions()
Performs post-completion cleanup on completed transactions.
void setMaxTransactions(const size_t max_transactions)
Sets the maximum number of entries allowed in the queue.
void sweep()
Check current transactions; start transactions for new requests.
TransactionAddressIndex::iterator findTransactionByAddress(const asiolink::IOAddress &address) const
Search the transaction store for a given address.
size_t getMaxTransactions() const
Returns the maximum number of concurrent transactions.
size_t getQueueCount() const
Convenience method that returns the number of requests queued.
bool hasTransaction(const dhcp_ddns::NameChangeRequestPtr &ncr) const
Checks if there is an active transaction matching the FQDN or ip address of an NCR.
D2UpdateMgr(D2QueueMgrPtr &queue_mgr, D2CfgMgrPtr &cfg_mgr, asiolink::IOServicePtr &io_service, const size_t max_transactions=MAX_TRANSACTIONS_DEFAULT)
Constructor.
size_t getTransactionCount() const
Returns the current number of transactions.
void pickNextJob()
Starts a transaction for the next eligible request in the queue.
void clearTransactions()
Immediately discards all entries in the transaction list.
TransactionFqdnIndex::iterator findTransactionByFqdn(const std::string &fqdn) const
Search the transaction store for an FQDN.
static const size_t MAX_TRANSACTIONS_DEFAULT
Maximum number of concurrent transactions NOTE that 32 is an arbitrary choice picked for the initial ...
TransactionSequenceIndex::iterator transactionSequenceBegin()
Returns the transaction store sequence begin position.
Embodies the "life-cycle" required to carry out a DDNS Add update.
Embodies the "life-cycle" required to carry out a DDNS Remove update.
Embodies the "life-cycle" required to carry out a DDNS Add update.
Embodies the "life-cycle" required to carry out a DDNS Add update without checking for conflicts.
Embodies the "life-cycle" required to carry out a DDNS Remove update.
Embodies the "life-cycle" required to carry out a DDNS Remove update without removing any matching DH...
This file defines the class D2UpdateMgr.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug 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
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
const isc::log::MessageID DHCP_DDNS_NO_REV_MATCH_ERROR
const isc::log::MessageID DHCP_DDNS_FWD_REQUEST_IGNORED
const isc::log::MessageID DHCP_DDNS_REV_REQUEST_IGNORED
isc::log::Logger dhcp_to_d2_logger("dhcp-to-d2")
const isc::log::MessageID DHCP_DDNS_AT_MAX_TRANSACTIONS
boost::shared_ptr< NameChangeTransaction > NameChangeTransactionPtr
Defines a pointer to a NameChangeTransaction.
boost::shared_ptr< D2QueueMgr > D2QueueMgrPtr
Defines a pointer for manager instances.
const isc::log::MessageID DHCP_DDNS_NO_ELIGIBLE_JOBS
const isc::log::MessageID DHCP_DDNS_NO_FWD_MATCH_ERROR
@ CHECK_EXISTS_WITH_DHCID
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
const int DBGLVL_TRACE_DETAIL_DATA
Trace data associated with detailed operations.
Defines the logger used by the top-level component of kea-lfc.
This file defines the class NameAddTransaction.
This file defines the class NameRemoveTransaction.
This file defines the class SimpleAddWithoutDHCIDTransaction.
This file defines the class SimpleRemoveWithoutDHCIDTransaction.
Tag for index by ip-address.
Tag for insertion order index.