Interfaces
Retries preserve the same loan. Which conditions enforce this rule?
A response may be lost after allocation.
Starting point Size the index and allocation path separately.
Assumptions for the example case
A fictional library with one licensed copy and reading devices that verify entitlements online. Every new read checks the current entitlement; offline use is outside the scope. All quantities, thresholds and operational targets in this design are illustrative assumptions.
Issuance and return
Issuance and return
Issuance and revocation use separate keys bound to the same loan identity.
Proposed domain contracts
- POST
/titel/T-52/ausleihenAllocate a free copy.
- Input
- commandKey, readerId, titleId=T-52, entitlementPolicyVersion
- Result
- A-52 with X-52 allocated and a licensing command, or unavailable.
- Retry behaviour
- An identical replay reads the same loan; a different reader under the same key produces a conflict.
- POST
/ausleihen/A-52/rueckgabenRequest withdrawal of rights.
- Input
- returnKey, expectedVersion, licenseReference
- Result
- Return pending; only confirmed revocation makes the copy available.
- Retry behaviour
- The same return command; no second release.
Retries preserve the same loan.
commandKey returns the existing A-52.
A response may be lost after allocation.
Return the existing loan and state. A different reader under the same key produces a conflict; no new allocation.
- Alternative considered
- Creating a new loan on every retry allocates additional copies.
- Trade-off
- The client retains command keys.
- Reassess
- Contract versions require a clear retention policy.
Try it yourself
Compare an identical replay with a retry for a different reader.
A hint for your attempt
A response may be lost after allocation.
Compare with a possible solution
- Replay
- Return the existing loan and state.
- Different reader
- Conflict under the same key; no new allocation.
Apply to your project
What is the equivalent of preserving the same loan on retry in your project?