Skip to content

Commit f1a8b70

Browse files
committed
[#1415] Extended FreeLeaseQueue description
Explained differences between next() and pop().
1 parent 054ce77 commit f1a8b70

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/lib/dhcpsrv/free_lease_queue.h

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,25 @@ namespace dhcp {
4848
///
4949
/// The queue with free leases is optimized for two use cases. Firstly, it is
5050
/// optimized to get the next available address or prefix efficiently. In order
51-
/// to the get the next available lease one should call the
51+
/// to the get the next available lease the allocation engine can call the
5252
/// @c FreeLeaseQueue::next function. The range from which the lease is to be
5353
/// 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.
54+
/// or prefix pool boundaries. The @c next function puts the returned lease
55+
/// at the end of the queue. If the lease is rejected by the allocation engine
56+
/// for any reason, e.g. conflict with existing host reservations, the allocation
57+
/// engine simply calls @c next function again. It may need to perform multiple
58+
/// calls to the @c next function until it gets the satifactionary lease.
59+
/// However, it should be typically one call per allocation when no reservations
60+
/// are present or there is a low number of in pool reservations. If the
61+
/// allocation engine decides to allocate the returned lease, it must call
62+
/// @c FreeLeaseQueue::use to remove this lease from the queue.
63+
///
64+
/// If the @c FreeLeaseQueue::pop method is used instead of @c next to get
65+
/// the next available lease the returned lease is removed from the queue.
66+
/// In that case, the allocation engine must not call @c FreeLeaseQueue::use
67+
/// function when this lease is allocated. However, if the allocation engine
68+
/// rejects this lease the @c FreeLeaseQueue::append must be called to return
69+
/// the lease to the queue.
6170
///
6271
/// The second use case for which this queue is optimized is the lease
6372
/// reclamation. This is the process by which expired leases are again made

0 commit comments

Comments
 (0)