Skip to content

About

stock reservation logic

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StockGuard

StockGuard is a Java inventory reservation engine for limited-stock commerce workflows. It prevents overselling within a shared process, handles idempotent retries, and releases expired reservations.

Capabilities

  • Atomic stock reservation under concurrent requests.
  • Customer-scoped idempotency keys with payload conflict detection.
  • Explicit reservation confirmation, cancellation, and expiration.
  • Immutable price snapshots and exact decimal arithmetic.
  • UTF-8 inventory report export.
  • Automated regression tests on Windows and Linux.

Requirements

Java 17 or later and PowerShell.

powershell -NoProfile -ExecutionPolicy Bypass -File .\run.ps1 test
powershell -NoProfile -ExecutionPolicy Bypass -File .\run.ps1 demo
powershell -NoProfile -ExecutionPolicy Bypass -File .\run.ps1 stress

Scope

This version stores data in memory and provides guarantees only for threads sharing the same inventory store instance. It does not provide database persistence, HTTP endpoints, authentication, or distributed coordination. CSV reports are exports and are not loaded as application state.

Validation

The regression suite covers stock conservation, concurrent requests, duplicate retries, ownership matching, state transitions, expiry boundaries, decimal arithmetic, and CSV encoding. The concurrency scenario is a correctness check rather than a throughput benchmark.

About

stock reservation logic

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages