Expand description
Schema Cache module
The schema cache is the heart of dbrest. It introspects the PostgreSQL database and caches:
- Tables/Views metadata
- Column information
- Foreign key relationships
- Functions/Procedures
§Architecture
The cache is immutable and wrapped in ArcSwap for lock-free reads and atomic
replacement during schema reload.
┌─────────────────────────────────────────────────┐
│ SchemaCache │
├─────────────────────────────────────────────────┤
│ tables: HashMap<QualifiedIdentifier, Table> │
│ relationships: HashMap<..., Vec<Relationship>> │
│ routines: HashMap<QualifiedIdentifier, Vec> │
│ timezones: HashSet<String> │
└─────────────────────────────────────────────────┘Re-exports§
pub use db::ComputedFieldRow;pub use db::DbIntrospector;pub use db::RelationshipRow;pub use db::RoutineRow;pub use db::TableRow;pub use media_handler::MediaHandler;pub use media_handler::MediaHandlerMap;pub use media_handler::ResolvedHandler;pub use relationship::AnyRelationship;pub use relationship::Cardinality;pub use relationship::ComputedRelationship;pub use relationship::Junction;pub use relationship::Relationship;pub use representations::DataRepresentation;pub use representations::RepresentationsMap;pub use routine::PgType;pub use routine::ReturnType;pub use routine::Routine;pub use routine::RoutineParam;pub use routine::Volatility;pub use table::Column;pub use table::ComputedField;pub use table::Table;
Modules§
- db
- Database introspection trait
- media_
handler - Media handler types for dbrest content negotiation
- queries
- Database introspection queries
- relationship
- Relationship types for schema cache
- representations
- Data representation types for dbrest
- routine
- Routine (function/procedure) types for schema cache
- table
- Table and Column types for schema cache
Structs§
- Schema
Cache - Immutable schema cache
- Schema
Cache Holder - Schema cache holder with atomic swap capability
Type Aliases§
- Relationships
Map - Type alias for the relationships map Key: (source_table, schema) -> list of relationships from that table
- Routines
Map - Type alias for the routines map Key: QualifiedIdentifier -> list of overloaded functions
- Tables
Map - Type alias for the tables map