pub struct CatalogState {
pub tables: HashMap<TableId, TableSchema>,
pub databases: HashMap<DatabaseId, DatabaseSchema>,
pub types: HashMap<TypeId, TypeSchema>,
pub global_types: HashMap<TypeId, TypeSchema>,
/* private fields */
}Fields§
§tables: HashMap<TableId, TableSchema>Contains the definitions of all tables, accessible through their unique, stable ID.
databases: HashMap<DatabaseId, DatabaseSchema>Contains the definitions of all databases, accessible through their unique, stable ID.
types: HashMap<TypeId, TypeSchema>Contains the definitions of all user-created types, accessible through their unique, stable ID.
global_types: HashMap<TypeId, TypeSchema>Global built-in types (e.g. Option[T]). Populated at startup, never journaled.
TypeIds use reserved values descending from u32::MAX.
Implementations§
Source§impl CatalogState
impl CatalogState
Sourcepub fn get_type(&self, id: TypeId) -> Option<&TypeSchema>
pub fn get_type(&self, id: TypeId) -> Option<&TypeSchema>
Looks up a type by ID, checking user types then global types.
Sourcepub fn pk_path_name(
&self,
path: &[FieldId],
table_schema: &TableSchema,
) -> String
pub fn pk_path_name( &self, path: &[FieldId], table_schema: &TableSchema, ) -> String
Returns the dot-separated flat field name for a primary key path.
e.g. [FieldId(1), FieldId(0)] → "address.city".
pub fn tables_in_database( &self, database: &str, ) -> impl Iterator<Item = (TableId, &TableSchema)>
pub fn types_in_database( &self, database: &str, ) -> impl Iterator<Item = (TypeId, &TypeSchema)>
Trait Implementations§
Source§impl Clone for CatalogState
impl Clone for CatalogState
Source§fn clone(&self) -> CatalogState
fn clone(&self) -> CatalogState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CatalogState
impl Debug for CatalogState
Source§impl Default for CatalogState
impl Default for CatalogState
Source§impl Replayable for CatalogState
impl Replayable for CatalogState
Source§type Edit = CatalogEdit
type Edit = CatalogEdit
This atomic edit is serialized into the journal for later
reconstruction via sequential replay.
Source§fn apply(&mut self, edit: Self::Edit)
fn apply(&mut self, edit: Self::Edit)
Apply another
Self::Edit to the current state.Source§fn snapshot(&self) -> Self::Edit
fn snapshot(&self) -> Self::Edit
Calculate a new edit that can be used to reconstruct the current state.
This is required to create the initial edit for file rotations.
Source§fn filename_prefix() -> &'static str
fn filename_prefix() -> &'static str
This prefix is used to create new files for rotation internally.
Auto Trait Implementations§
impl Freeze for CatalogState
impl RefUnwindSafe for CatalogState
impl Send for CatalogState
impl Sync for CatalogState
impl Unpin for CatalogState
impl UnsafeUnpin for CatalogState
impl UnwindSafe for CatalogState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more