domain tier

domain-reservations

Capacity management and reservation system to prevent overbooking

Capacity management and reservation system to prevent overbooking

Tierdomain
Roleunclassified (baselined)
Pathcrates/domain/reservations
Edition2021
Targetsdomain_reservations, pool_lock_tenant_key
Public items0 across 0 modules
Tests61

What it is for

domain-reservations: Capacity management and reservation system

Overview

This crate provides a reservation system to prevent overbooking and overselling. It manages capacity pools, temporary holds, and confirmed reservations with automatic expiration and concurrency safety.

Layer

Domain - depends on: foundation-basemodels

Key Concepts

Key Types

Example

use domain_reservations::{
ReservationService, CreatePoolRequest, CreateHoldRequest, CreateReservationRequest
};

let service = ReservationService::new(pool);

// Create a capacity pool (e.g., 50 seats)
let (pool, event) = service.create_pool(CreatePoolRequest {
tenant_id,
name: "General Admission".to_string(),
description: Some("Standard seating".to_string()),
total_capacity: 50,
..Default::default()
}).await?;

// Create a hold (temporary reservation)
let (hold, events) = service.create_hold(CreateHoldRequest {
tenant_id,
pool_id: pool.id,
party_id: user_id,
quantity: 2,
duration_minutes: Some(15),
..Default::default()
}).await?;

// Convert hold to confirmed reservation
let (reservation, events) = service.convert_hold(hold.id).await?;

// Or create direct reservation (without hold)
let (reservation, events) = service.create_reservation(CreateReservationRequest {
tenant_id,
pool_id: pool.id,
party_id: user_id,
quantity: 3,
..Default::default()
}).await?;

println!("Confirmation: {}", reservation.confirmation_code);

Capabilities

No public items.

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

No public modules: the crate root is its whole surface.

Public surface

No public items.

No pub use re-exports: every item above is declared in this crate.

Boundary

Reaches into foundation.

Shares tier domain with 41 other crates: domain-agreements, domain-ai-report, domain-billing, domain-catalog, domain-classify, domain-comments, domain-competitive-intel, domain-contact, … (41 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)domain
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/domain/reservations
Vocabulary in force (lexicon)current

Tier flow. Which tiers this crate's own edges cross.

flowchart LR
  n_domain["domain"] --> n_foundation["foundation"]

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`foundation-basemodels`foundationnoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
async-trait^0.1noalways
chrono^0.4serdenoalways
serde^1derivenoalways
serde_json^1noalways
sqlx^0.8runtime-tokio, postgres, chrono, uuid, jsonnoalways
thiserror^2noalways
uuid^1v4, serdenoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
sqlx^0.8runtime-tokio, postgres, chrono, uuid, jsonnoalways
tokio^1full, test-utilnoalways
uuid^1v4, serdenoalways

Build. None.

Depended on by. 2 workspace crates.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_application_conversation["application-conversation"] -->|uses| SELF
  n_application_reservations["application-reservations"] -->|uses| SELF
  SELF["domain-reservations"]
  SELF -->|runtime| n_foundation_basemodels["foundation-basemodels"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
libdomain_reservations`src/lib.rs`
testpool_lock_tenant_key`tests/pool_lock_tenant_key.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessyes
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

2 workspace crates depend on this one: application-conversation, application-reservations.

Verification

KindCount
Unit tests57
Integration tests4
Examples0
Doctests0

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc00
Public modules with a //! block00

Metrics

MetricValue
Rust source files6
Source lines3188
Code lines2369
Public API items0
Public modules0
Tests61
Examples0
Cargo features0
Direct runtime dependencies8
Workspace reverse dependencies2
pie showData
    title Rust source composition
    "Code" : 2369
    "Blank or comment" : 819

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

All domain · Manual