Skip to main content

Module schema_cache

Module schema_cache 

Source
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§

SchemaCache
Immutable schema cache
SchemaCacheHolder
Schema cache holder with atomic swap capability

Type Aliases§

RelationshipsMap
Type alias for the relationships map Key: (source_table, schema) -> list of relationships from that table
RoutinesMap
Type alias for the routines map Key: QualifiedIdentifier -> list of overloaded functions
TablesMap
Type alias for the tables map