Kea 2.7.5
lease_update_backlog.h
Go to the documentation of this file.
1// Copyright (C) 2020-2021 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#include <deque>
12#include <mutex>
13#include <utility>
14
15namespace isc {
16namespace ha {
17
46public:
47
49 enum OpType {
51 DELETE
52 };
53
58 LeaseUpdateBacklog(const size_t limit);
59
66 bool push(const OpType op_type, const dhcp::LeasePtr& lease);
67
73 dhcp::LeasePtr pop(OpType& op_type);
74
88 bool wasOverflown();
89
93 void clear();
94
96 size_t size();
97
98private:
99
106 bool pushInternal(const OpType op_type, const dhcp::LeasePtr& lease);
107
113 dhcp::LeasePtr popInternal(OpType& op_type);
114
116 size_t limit_;
117
119 bool overflown_;
120
122 std::deque<std::pair<OpType, dhcp::LeasePtr> > outstanding_updates_;
123
125 std::mutex mutex_;
126};
127
128} // end of namespace isc::ha
129} // end of namespace isc
130
131#endif // HA_LEASE_BACKLOG_H
Queue holding a backlog of unsent lease updates.
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.
OpType
Type of the lease update (operation type).
void clear()
Removes all lease updates from the queue.
bool wasOverflown()
Checks if the queue was overflown.
LeaseUpdateBacklog(const size_t limit)
Constructor.
boost::shared_ptr< Lease > LeasePtr
Pointer to the lease object.
Definition lease.h:25
Defines the logger used by the top-level component of kea-lfc.