Permits counting for reservations. A collection which hands out Permits, of which a limited number of are allowed exist at once. Permits can be granted immediately, or can be reserved in first-come-first-serve order, with a Future which resolves to a Permit once one becomes available.
Permits are released upon drop and will be automatically handed off to the next reservation or returned to the available pool if no one is waiting.
Permits can be revokable by providing a function which will return a valid Permit when called. That function can also make a reservation for a future Permit if desired. (see examples in tests)
A client can take a permit (revoking one if necessary), by using
A client can also seize all permits, taking out all permits left unclaimed and revoking all
Permits taken or seized are not revokable.
- A Reservation is a future that will eventually receive a permit once one becomes available.