Skip to content

Commit b6bf526

Browse files
committed
[#1415] Use "queue" rather than "container"
The descriptions in FreeLeaseQueue refer to the data structures as queue rather than container. This was suggested in the review.
1 parent 6113018 commit b6bf526

File tree

1 file changed

+51
-57
lines changed

1 file changed

+51
-57
lines changed

src/lib/dhcpsrv/free_lease_queue.h

Lines changed: 51 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -27,67 +27,61 @@
2727
namespace isc {
2828
namespace dhcp {
2929

30-
/// @brief Container holding free leases for various address and
31-
/// prefix ranges.
30+
/// @brief Queue holding free leases for various address and prefix ranges.
3231
///
33-
/// Free leases can be stored in this container to provide the DHCP
34-
/// allocation engine with the fast lookup mechanism for available
35-
/// leases. This avoids costly lookup for available leases in the
36-
/// lease database backend when the client's packet is being processed.
37-
/// Instead, when the server is being configured, it iterates over
38-
/// the addresses and/or prefixes in respective pools, verifies if leases
39-
/// exist for these addresses and/or prefixes and for each of them for
40-
/// which it doesn't find the lease it creates an appropriate entry in
41-
/// this container.
32+
/// Free leases can be stored in this queue to provide the DHCP allocation
33+
/// engine with the fast lookup mechanism for available leases. This avoids
34+
/// costly lookup for available leases in the lease database backend when
35+
/// the client's packet is being processed. Instead, when the server is being
36+
/// configured, it iterates over the addresses and/or prefixes in respective
37+
/// pools, verifies if leases exist for these addresses and/or prefixes and
38+
/// for each of them for which it doesn't find the lease it creates an
39+
/// appropriate entry in the queue.
4240
///
43-
/// This effectively moves the free lease lookup to the configuration
44-
/// phase. When the server is going to allocate a new lease, it will
45-
/// make an appropriate query to this container to get the next
46-
/// available lease for the given pool. If the server decides to
47-
/// use this lease, it is removed from this container. Conversely,
48-
/// when the lease expires (and is reclaimed) or is released it is
49-
/// returned to this container so it can be offered to a
50-
/// requesting client at some later time.
41+
/// This effectively moves the free lease lookup to the configuration phase.
42+
/// When the server is going to allocate a new lease, it will make an
43+
/// appropriate query to this queue to get the next available lease for the
44+
/// given pool. If the server decides to use this lease, it is removed from
45+
/// this queue. Conversely, when the lease expires (and is reclaimed) or is
46+
/// released it is returned to this queue so it can be offered to a requesting
47+
/// client at some later time.
5148
///
52-
/// The container with free leases is optimized for two use cases.
53-
/// Firstly, it is optimized to get the next available address or
54-
/// prefix efficiently. In order to the get the next available lease
55-
/// one should call the @c FreeLeaseQueue::next function. The range
56-
/// from which the lease is to be returned must be specified in
57-
/// the call. The range corresponds to the address or prefix pool
58-
/// boundaries. If the lease returned is rejected by the allocation
59-
/// engine for any reason, e.g. conflict with existing host reservations,
60-
/// the lease goes to the end of the queue for that range. The allocation
61-
/// engine may need to perform multiple calls to the @c next function
62-
/// until it gets the satifactionary lease. However, it should be
63-
/// typically one call per allocation when no reservations are present
64-
/// or there is a low number of in pool reservations.
49+
/// The queue with free leases is optimized for two use cases. Firstly, it is
50+
/// optimized to get the next available address or prefix efficiently. In order
51+
/// to the get the next available lease one should call the
52+
/// @c FreeLeaseQueue::next function. The range from which the lease is to be
53+
/// returned must be specified in the call. The range corresponds to the address
54+
/// or prefix pool boundaries. If the lease returned is rejected by the
55+
/// allocation engine for any reason, e.g. conflict with existing host
56+
/// reservations, the lease goes to the end of the queue for that range. The
57+
/// allocation engine may need to perform multiple calls to the @c next function
58+
/// until it gets the satifactionary lease. However, it should be typically one
59+
/// call per allocation when no reservations are present or there is a low
60+
/// number of in pool reservations.
6561
///
66-
/// The second use case for which this container is optimized is
67-
/// the lease reclamation. This is the process by which expired
68-
/// leases are again made available for allocation. The leases
69-
/// belonging to different pools expire at various times. When the
70-
/// expired leases are reclaimed the server doesn't know to which
71-
/// pools they belong. Since this container associates free leases
72-
/// with certain ranges it is important that this container can
73-
/// efficiently identify the range. Once the range is identified,
74-
/// the reclaimed lease is appended at the end of the queue for that
75-
/// range.
62+
/// The second use case for which this queue is optimized is the lease
63+
/// reclamation. This is the process by which expired leases are again made
64+
/// available for allocation. The leases belonging to different pools expire at
65+
/// various times. When the expired leases are reclaimed the server doesn't know
66+
/// to which pools they belong. Since this queue associates free leases with
67+
/// certain ranges it is important that this container can efficiently identify
68+
/// the range. Once the range is identified, the reclaimed lease is appended to
69+
/// the end of the queue for that range.
7670
class FreeLeaseQueue {
7771
public:
7872

7973
/// @brief Constructor.
8074
FreeLeaseQueue();
8175

82-
/// @brief Adds new address range to the container.
76+
/// @brief Adds new address range to the queue.
8377
///
8478
/// The new range must not overlap with existing ranges.
8579
///
8680
/// @param range the new range to be added.
8781
/// @throw BadValue if the new range overlaps with any of the existing ranges.
8882
void addRange(const AddressRange& range);
8983

90-
/// @brief Adds new address range to the container.
84+
/// @brief Adds new address range to the queue.
9185
///
9286
/// This variant of the method accepts the address range as a pair of
9387
/// start/end arguments.
@@ -97,15 +91,15 @@ class FreeLeaseQueue {
9791
/// @throw BadValue if the new range overlaps with any of the existing ranges.
9892
void addRange(const asiolink::IOAddress& start, const asiolink::IOAddress& end);
9993

100-
/// @brief Adds new delegated prefix range to the container.
94+
/// @brief Adds new delegated prefix range to the queue.
10195
///
10296
/// The new range must not overlap with existing ranges.
10397
///
10498
/// @param range the new range to be added.
10599
/// @throw BadValue of the new range overlaps with any of the existing ranges.
106100
void addRange(const PrefixRange& range);
107101

108-
/// @brief Adds new delegated prefix range to the container.
102+
/// @brief Adds new delegated prefix range to the queue.
109103
///
110104
/// This variant of the method accepts the prefix range specified with three
111105
/// parameters: prefix, prefix length and delegated prefix length.
@@ -117,7 +111,7 @@ class FreeLeaseQueue {
117111
void addRange(const asiolink::IOAddress& prefix, const uint8_t prefix_length,
118112
const uint8_t delegated_length);
119113

120-
/// @brief Removes the range from the container.
114+
/// @brief Removes the range from the queue.
121115
///
122116
/// It removes all free leases associated with the removed address range.
123117
///
@@ -185,7 +179,7 @@ class FreeLeaseQueue {
185179
/// reconfiguration. It is considered faster than the overload of this
186180
/// method taking the @c Range structure as an argument. The range is
187181
/// identified by the @c range_index which designates the range index
188-
/// in the container returned by the @c getRangeIndex method. Use
182+
/// in the queue returned by the @c getRangeIndex method. Use
189183
/// this method variant to add many addresses to the same range.
190184
///
191185
/// @param range_index address range index returned by @c getRangeIndex.
@@ -247,7 +241,7 @@ class FreeLeaseQueue {
247241

248242
/// @brief Returns range index.
249243
///
250-
/// The range index designates the position of the range within the container.
244+
/// The range index designates the position of the range within the queue.
251245
/// Searching for a range using the index is faster than searching by the
252246
/// range itself because it uses random access index.
253247
///
@@ -267,7 +261,7 @@ class FreeLeaseQueue {
267261

268262
private:
269263

270-
/// @brief Container holding free leases for a range.
264+
/// @brief Queue holding free leases for a range.
271265
///
272266
/// This container holds free leases for a given range. It contains two
273267
/// indexes. The first index orders free leases by address values. The
@@ -283,10 +277,10 @@ class FreeLeaseQueue {
283277
>
284278
> Leases;
285279

286-
/// Pointer to the container of free leases for a range.
280+
/// Pointer to the queue of free leases for a range.
287281
typedef boost::shared_ptr<Leases> LeasesPtr;
288282

289-
/// @brief Helper structure associating a range with the container of
283+
/// @brief Helper structure associating a range with the queue of
290284
/// free leases.
291285
struct RangeDescriptor {
292286
/// Range start.
@@ -295,7 +289,7 @@ class FreeLeaseQueue {
295289
asiolink::IOAddress range_end_;
296290
/// Delegated length (used in prefix delegation).
297291
uint8_t delegated_length_;
298-
/// Container holding free addresses for the range.
292+
/// Queue holding free addresses for the range.
299293
LeasesPtr leases_;
300294
};
301295

@@ -342,24 +336,24 @@ class FreeLeaseQueue {
342336
void checkRangeOverlaps(const asiolink::IOAddress& start,
343337
const asiolink::IOAddress& end) const;
344338

345-
/// @brief Returns container for a given address range.
339+
/// @brief Returns queue for a given address range.
346340
///
347341
/// @param range range for which the container should be returned.
348342
/// @return Pointer to the container (if found).
349343
/// @throw BadValue if the specified range does not exist.
350344
LeasesPtr getLeases(const AddressRange& range) const;
351345

352-
/// @brief Returns container for a given prefix range.
346+
/// @brief Returns queue for a given prefix range.
353347
///
354348
/// @param range range for which the container should be returned.
355349
/// @return Pointer to the container (if found).
356350
/// @throw BadValue if the specified range does not exist.
357351
LeasesPtr getLeases(const PrefixRange& range) const;
358352

359-
/// @brief Returns container descriptor for a given range index.
353+
/// @brief Returns descriptor for a given range index.
360354
///
361355
/// The returned descriptor includes the range boundaries and also the
362-
/// pointer to the container with free leases for the range.
356+
/// pointer to the queue with free leases for the range.
363357
///
364358
/// @param range_index index of the range which descriptor should be
365359
/// returned.

0 commit comments

Comments
 (0)