Kea 3.3.3
lease_update_backlog.h
Go to the documentation of this file.
1// Copyright (C) 2020-2026 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef HA_LEASE_BACKLOG_H
8#define HA_LEASE_BACKLOG_H
9
10#include <dhcpsrv/lease.h>
11
12#include <cstdint>
13#include <deque>
14#include <mutex>
15#include <utility>
16
17namespace isc {
18namespace ha {
19
48public:
49
51 enum OpType : uint16_t {
54 };
55
60 LeaseUpdateBacklog(const size_t limit);
61
68 bool push(const OpType op_type, const dhcp::LeasePtr& lease);
69
75 dhcp::LeasePtr pop(OpType& op_type);
76
90 bool wasOverflown();
91
95 void clear();
96
98 size_t size();
99
100private:
101
108 bool pushInternal(const OpType op_type, const dhcp::LeasePtr& lease);
109
115 dhcp::LeasePtr popInternal(OpType& op_type);
116
118 size_t limit_;
119
121 bool overflown_;
122
124 std::deque<std::pair<OpType, dhcp::LeasePtr> > outstanding_updates_;
125
127 std::mutex mutex_;
128};
129
130} // end of namespace isc::ha
131} // end of namespace isc
132
133#endif // HA_LEASE_BACKLOG_H
dhcp::LeasePtr pop(OpType &op_type)
Returns the next lease update and removes it from the queue.
size_t size()
Returns the current size of the queue.
bool push(const OpType op_type, const dhcp::LeasePtr &lease)
Appends lease update to the queue.
void clear()
Removes all lease updates from the queue.
bool wasOverflown()
Checks if the queue was overflown.
OpType
Type of the lease update (operation type).
LeaseUpdateBacklog(const size_t limit)
Constructor.
boost::shared_ptr< Lease > LeasePtr
Pointer to the lease object.
Definition lease.h:27
Defines the logger used by the top-level component of kea-lfc.