System Design Atlas

Digital lending with limited licences

02 / 10Worked example

Verifiable requirements

The expiry instant is exclusive. Which conditions enforce this rule?

At the end of the loan period, the entitlement ends.

Starting point Allocation binds the specific licensed copy.

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.

Limits of entitlement

Entitlement validation

Read accessA-52 + now
Active?no → blocked
now < D-52?No → Expired
Reading allowedFor this online check only
Return pendingX-52 remains allocated
Revocation confirmedX-52 once free
Lesezugriff → Aktiv?Load entitlement
Aktiv? → now < D-52?Yes
now < D-52? → Lesen erlaubtYes
Rückgabe offen → Entzug bestätigtMatching evidence for A-52

Active and now < D-52 permit access; a return releases X-52 only after revocation evidence arrives.

Active and now<D permit access; Return pending keeps the copy allocated; revocation evidence releases it.

Business requirements (functional)

Further reading
Rule 1
A licensed copy belongs to at most one active or unresolved loan.
Rule 2
Search results show estimated availability; the authoritative datastore decides allocation.
Rule 3
A return releases the copy only after entitlement revocation is confirmed; expiry ends access at now>=D-52.

Quality goals (non-functional)

Further reading
Measurement window
95% of local allocations complete within 500 ms at 100/s over 15 min; external licence issuance is measured separately. An unknown licensing outcome enters the investigation worklist from 30 s.
Open results
Returned requires evidence of revocation; Expired requires an expired entitlement enforced by online checks. Each releases the copy once. An unknown issuance or return outcome keeps it allocated.

The expiry instant is exclusive.

The expiry instant is exclusive.

Online access requires now<D.

At the end of the loan period, the entitlement ends.

While Active, access at D−1 ms is allowed. Access at D and D+1 ms is denied; the copy is released once.

Alternative considered
A less-than-or-equal comparison incorrectly extends access to the expiry instant.
Trade-off
Clocks must be reliable.
Reassess
Offline reading requires a different contract.

Try it yourself

Evaluate D−1 ms, D and D+1 ms.

A hint for your attempt

At the end of the loan period, the entitlement ends.

Compare with a possible solution
Before
While Active, access at D−1 ms is allowed.
Boundary
Access at D and D+1 ms is denied; the copy is released once.

Apply to your project

What is the equivalent of an exclusive expiry instant in your project?

Step 3: search dominates the load. Which conditions determine the design?