Holds
A hold sets supply aside while your app waits to commit. Each line is a claim on a resource and scope. The hold reserves every line together or reserves none.
Placement and extension
Each request gives a ttl. ResourceShark sets expiresAt from that duration. A line names the place if the resource is kept by place, the holder if it is held per holder, and a finite span if it counts time in buckets. A line for a named unit sends scope.instanceId and a quantity of 1.
An extension requests a new expiry measured from the time ResourceShark processes it. The current expiry stays if it is already at least that far away.
Refusals
insufficient_supplygives each short line’s requested and available quantities indetails.lines.exhausted_until_supplyalso givesdetails.nextSupplyAt, the earliest start of more supply for the short lines.assignment_infeasiblesays at least one named unit is unavailable for its line. Its error entry explains which code applies when several lines are short and where to read any next supply times.
A reschedule that runs short is refused with insufficient_supply or assignment_infeasible. Each short line in details.lines gives its index in the request as line, and nothing moves.
Use a new Idempotency-Key for a new attempt after a shortage. Repeating the original key repeats the error.
Resolution
An open hold can be committed or released. A commit takes every line in full when lines is omitted or empty. A nonempty lines list specifies a quantity for every claim, with at least one positive quantity. The commit takes those amounts and releases the rest. A claim it takes any of ends committed, and one it takes none of ends released. A hold that committed less than every line in full reads partially_committed. A committed line over time becomes a booking. A release frees everything the open hold reserved.
At expiresAt, an open hold expires and stops counting against availability. A commit or extension refused with hold_expired gives the expiry time. An expired commit includes the availability for each line while ResourceShark still keeps the hold’s details. When a different action already resolved a hold, hold_resolved tells you how it ended.
A cancellation gives back the committed lines it names, or all committed lines if it omits the list. Your server applies your cancellation policy before it sends a cancel. The hold reads cancelled once cancellation has given back every committed line.
A reschedule moves held or committed lines on resources that count time in buckets, from one hold or several, to another span, another resource, or another scope. It gives back every old position and takes every new one in one write, or changes nothing, so two bookings on two full resources can swap. Each line keeps its claim, its quantity, and its status, and an open hold keeps its expiresAt. Your server applies your rules for moves before it sends a reschedule. Book time slots moves and swaps bookings, and Reschedule a hold has the request.
Retention
The retention sweep replaces a resolved hold with a smaller record after retention.resolvedHolds. When a hold with booked spans commits, ResourceShark sets the retention deadline from the later of the commit and the last span’s end. A retained hold keeps its outcome and the lines that took supply. Ordinary hold lists omit it. Repeating a hold or its commit with the same source key can still answer with it.
Limits
- A hold takes 1 to 50 lines.
ttlis a positive whole number followed byms,s,m,h, ord, up to1000000d. A day is 24 hours.
Where to act on it
- The ResourceShark quickstart places, extends, and commits a hold and sees a shortage refusal.
- Book time slots commits a booking. Limit hold length and booking window sets app rules. Cap a holder’s open holds enforces a cap across requests. Take a payment after a hold expired checks whether the order can still be filled.
- Holds has the hold operations. ResourceShark errors lists the refusal details.