Struct mz_coord::catalog::CatalogState
source · [−]pub struct CatalogState {
database_by_name: BTreeMap<String, DatabaseId>,
database_by_id: BTreeMap<DatabaseId, Database>,
entry_by_id: BTreeMap<GlobalId, CatalogEntry>,
ambient_schemas_by_name: BTreeMap<String, SchemaId>,
ambient_schemas_by_id: BTreeMap<SchemaId, Schema>,
temporary_schemas: HashMap<u32, Schema>,
compute_instances_by_id: HashMap<ComputeInstanceId, ComputeInstance>,
compute_instances_by_name: HashMap<String, ComputeInstanceId>,
roles: HashMap<String, Role>,
config: CatalogConfig,
oid_counter: u32,
}
Fields
database_by_name: BTreeMap<String, DatabaseId>
database_by_id: BTreeMap<DatabaseId, Database>
entry_by_id: BTreeMap<GlobalId, CatalogEntry>
ambient_schemas_by_name: BTreeMap<String, SchemaId>
ambient_schemas_by_id: BTreeMap<SchemaId, Schema>
temporary_schemas: HashMap<u32, Schema>
compute_instances_by_id: HashMap<ComputeInstanceId, ComputeInstance>
compute_instances_by_name: HashMap<String, ComputeInstanceId>
roles: HashMap<String, Role>
config: CatalogConfig
oid_counter: u32
Implementations
sourceimpl CatalogState
impl CatalogState
pub(super) fn pack_database_update(
&self,
id: &DatabaseId,
diff: Diff
) -> BuiltinTableUpdate
pub(super) fn pack_schema_update(
&self,
database_spec: &ResolvedDatabaseSpecifier,
schema_id: &SchemaId,
diff: Diff
) -> BuiltinTableUpdate
pub(super) fn pack_role_update(
&self,
name: &str,
diff: Diff
) -> BuiltinTableUpdate
pub(super) fn pack_compute_instance_update(
&self,
name: &str,
diff: Diff
) -> BuiltinTableUpdate
pub(super) fn pack_compute_instance_replica_update(
&self,
compute_instance_id: ComputeInstanceId,
name: &str,
diff: Diff
) -> BuiltinTableUpdate
pub(super) fn pack_compute_instance_status_update(
&self,
compute_instance_id: ComputeInstanceId,
replica_id: ReplicaId,
process_id: ProcessId,
diff: Diff
) -> BuiltinTableUpdate
pub(super) fn pack_item_update(
&self,
id: GlobalId,
diff: Diff
) -> Vec<BuiltinTableUpdate>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
fn pack_table_update(
&self,
id: GlobalId,
oid: u32,
schema_id: &SchemaSpecifier,
name: &str,
diff: Diff
) -> Vec<BuiltinTableUpdate>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
fn pack_source_update(
&self,
id: GlobalId,
oid: u32,
schema_id: &SchemaSpecifier,
name: &str,
source_desc_name: &str,
diff: Diff
) -> Vec<BuiltinTableUpdate>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
fn pack_connection_update(
&self,
id: GlobalId,
oid: u32,
schema_id: &SchemaSpecifier,
name: &str,
connection: &Connection,
diff: Diff
) -> Vec<BuiltinTableUpdate>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
fn pack_view_update(
&self,
id: GlobalId,
oid: u32,
schema_id: &SchemaSpecifier,
name: &str,
view: &View,
diff: Diff
) -> Vec<BuiltinTableUpdate>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
fn pack_sink_update(
&self,
id: GlobalId,
oid: u32,
schema_id: &SchemaSpecifier,
name: &str,
sink: &Sink,
diff: Diff
) -> Vec<BuiltinTableUpdate>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
fn pack_index_update(
&self,
id: GlobalId,
oid: u32,
name: &str,
index: &Index,
diff: Diff
) -> Vec<BuiltinTableUpdate>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
fn pack_type_update(
&self,
id: GlobalId,
oid: u32,
schema_id: &SchemaSpecifier,
name: &str,
typ: &Type,
diff: Diff
) -> Vec<BuiltinTableUpdate>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
fn pack_func_update(
&self,
id: GlobalId,
schema_id: &SchemaSpecifier,
name: &str,
func: &Func,
diff: Diff
) -> Vec<BuiltinTableUpdate>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
fn pack_secret_update(
&self,
id: GlobalId,
schema_id: &SchemaSpecifier,
name: &str,
diff: Diff
) -> Vec<BuiltinTableUpdate>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn pack_audit_log_update(
&self,
event: &VersionedEvent
) -> Result<BuiltinTableUpdate, Error>
pub fn pack_replica_heartbeat_update(
&self,
id: ReplicaId,
md: ReplicaMetadata,
diff: Diff
) -> BuiltinTableUpdate
sourceimpl CatalogState
impl CatalogState
pub fn allocate_oid(&mut self) -> Result<u32, Error>
sourcepub fn dependent_indexes(&self, id: GlobalId) -> Vec<GlobalId>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn dependent_indexes(&self, id: GlobalId) -> Vec<GlobalId>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Computes the IDs of any indexes that transitively depend on this catalog entry.
fn dependent_indexes_inner(&self, id: GlobalId, out: &mut Vec<GlobalId>)
sourcepub fn log_dependencies(&self, id: GlobalId) -> Vec<GlobalId>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn log_dependencies(&self, id: GlobalId) -> Vec<GlobalId>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Computes the IDs of any log sources this catalog entry transitively depends on.
fn log_dependencies_inner(&self, id: GlobalId, out: &mut Vec<GlobalId>)
pub fn uses_tables(&self, id: GlobalId) -> bool
pub fn resolve_full_name(
&self,
name: &QualifiedObjectName,
conn_id: Option<u32>
) -> FullObjectName
pub fn get_entry(&self, id: &GlobalId) -> &CatalogEntry
pub fn try_get_entry_in_schema(
&self,
name: &QualifiedObjectName,
conn_id: u32
) -> Option<&CatalogEntry>
sourcefn get_entry_in_system_schemas(&self, item: &str) -> &CatalogEntry
fn get_entry_in_system_schemas(&self, item: &str) -> &CatalogEntry
Gets an entry named item
from exactly one of system schemas.
Panics
- If
item
is not an entry in any system schema - If more than one system schema has an entry named
item
.
pub fn item_exists(&self, name: &QualifiedObjectName, conn_id: u32) -> bool
fn find_available_name(
&self,
name: QualifiedObjectName,
conn_id: u32
) -> QualifiedObjectName
pub fn try_get_entry(&self, id: &GlobalId) -> Option<&CatalogEntry>
sourcepub fn get_indexes_on(
&self,
id: GlobalId,
compute_instance: ComputeInstanceId
) -> impl Iterator<Item = (GlobalId, &Index)>
pub fn get_indexes_on(
&self,
id: GlobalId,
compute_instance: ComputeInstanceId
) -> impl Iterator<Item = (GlobalId, &Index)>
Returns all indexes on the given object and compute instance known in the catalog.
fn insert_item(
&mut self,
id: GlobalId,
oid: u32,
name: QualifiedObjectName,
item: CatalogItem
)
fn get_database(&self, database_id: &DatabaseId) -> &Database
async fn insert_compute_instance(
&mut self,
id: ComputeInstanceId,
name: String,
introspection: Option<ComputeInstanceIntrospectionConfig>,
introspection_sources: Vec<(&'static BuiltinLog, GlobalId)>
)
fn insert_compute_instance_replica(
&mut self,
on_instance: ComputeInstanceId,
replica_name: String,
replica_id: ReplicaId,
config: ConcreteComputeInstanceReplicaConfig
)
sourcefn try_insert_compute_instance_status(
&mut self,
event: ComputeInstanceEvent
) -> bool
fn try_insert_compute_instance_status(
&mut self,
event: ComputeInstanceEvent
) -> bool
Try inserting/updating the status of a compute instance process as described by the given event.
This method returns true
if the insert was successful. It returns
false
if the insert was unsuccessful, i.e., the given compute instance
replica is not found.
This treatment of non-existing replicas allows us to gracefully handle scenarios where we receive status updates for replicas that we have already removed from the catalog.
sourcefn try_get_compute_instance_status(
&self,
instance_id: ComputeInstanceId,
replica_id: ReplicaId,
process_id: ProcessId
) -> Option<ComputeInstanceEvent>
fn try_get_compute_instance_status(
&self,
instance_id: ComputeInstanceId,
replica_id: ReplicaId,
process_id: ProcessId
) -> Option<ComputeInstanceEvent>
Try getting the status of the given compute instance process.
This method returns None
if no status was found for the given
compute instance process because:
- The given compute instance replica is not found. This can occur if we already dropped the replica from the catalog, but we still receive status updates.
- The given replica process is not found. This is the case when we receive the first status update for a new replica process.
sourcefn resolve_schema_in_database(
&self,
database_spec: &ResolvedDatabaseSpecifier,
schema_name: &str,
conn_id: u32
) -> Result<&Schema, SqlCatalogError>
fn resolve_schema_in_database(
&self,
database_spec: &ResolvedDatabaseSpecifier,
schema_name: &str,
conn_id: u32
) -> Result<&Schema, SqlCatalogError>
Gets the schema map for the database matching database_spec
.
pub fn get_schema(
&self,
database_spec: &ResolvedDatabaseSpecifier,
schema_spec: &SchemaSpecifier,
conn_id: u32
) -> &Schema
fn get_schema_mut(
&mut self,
database_spec: &ResolvedDatabaseSpecifier,
schema_spec: &SchemaSpecifier,
conn_id: u32
) -> &mut Schema
pub fn get_mz_catalog_schema_id(&self) -> &SchemaId
pub fn get_pg_catalog_schema_id(&self) -> &SchemaId
pub fn get_information_schema_id(&self) -> &SchemaId
pub fn is_system_schema(&self, schema: &str) -> bool
sourcepub fn resolve_builtin_table(&self, builtin: &'static BuiltinTable) -> GlobalId
pub fn resolve_builtin_table(&self, builtin: &'static BuiltinTable) -> GlobalId
Optimized lookup for a builtin table
Panics if the builtin table doesn’t exist in the catalog
sourcepub fn resolve_builtin_log(&self, builtin: &'static BuiltinLog) -> GlobalId
pub fn resolve_builtin_log(&self, builtin: &'static BuiltinLog) -> GlobalId
Optimized lookup for a builtin log
Panics if the builtin log doesn’t exist in the catalog
sourcepub fn resolve_builtin_object<T: TypeReference>(
&self,
builtin: &Builtin<T>
) -> GlobalId
pub fn resolve_builtin_object<T: TypeReference>(
&self,
builtin: &Builtin<T>
) -> GlobalId
Optimized lookup for a builtin object
Panics if the builtin object doesn’t exist in the catalog
pub fn config(&self) -> &CatalogConfig
pub fn resolve_database(
&self,
database_name: &str
) -> Result<&Database, SqlCatalogError>
pub fn resolve_schema(
&self,
current_database: Option<&DatabaseId>,
database_name: Option<&str>,
schema_name: &str,
conn_id: u32
) -> Result<&Schema, SqlCatalogError>
pub fn resolve_compute_instance(
&self,
name: &str
) -> Result<&ComputeInstance, SqlCatalogError>
sourcepub fn resolve(
&self,
get_schema_entries: fn(_: &Schema) -> &BTreeMap<String, GlobalId>,
current_database: Option<&DatabaseId>,
search_path: &Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>,
name: &PartialObjectName,
conn_id: u32
) -> Result<&CatalogEntry, SqlCatalogError>
pub fn resolve(
&self,
get_schema_entries: fn(_: &Schema) -> &BTreeMap<String, GlobalId>,
current_database: Option<&DatabaseId>,
search_path: &Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>,
name: &PartialObjectName,
conn_id: u32
) -> Result<&CatalogEntry, SqlCatalogError>
Resolves PartialObjectName
into a CatalogEntry
.
If name
does not specify a database, the current_database
is used.
If name
does not specify a schema, then the schemas in search_path
are searched in order.
sourcepub fn resolve_entry(
&self,
current_database: Option<&DatabaseId>,
search_path: &Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>,
name: &PartialObjectName,
conn_id: u32
) -> Result<&CatalogEntry, SqlCatalogError>
pub fn resolve_entry(
&self,
current_database: Option<&DatabaseId>,
search_path: &Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>,
name: &PartialObjectName,
conn_id: u32
) -> Result<&CatalogEntry, SqlCatalogError>
Resolves name
to a non-function CatalogEntry
.
sourcepub fn resolve_function(
&self,
current_database: Option<&DatabaseId>,
search_path: &Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>,
name: &PartialObjectName,
conn_id: u32
) -> Result<&CatalogEntry, SqlCatalogError>
pub fn resolve_function(
&self,
current_database: Option<&DatabaseId>,
search_path: &Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>,
name: &PartialObjectName,
conn_id: u32
) -> Result<&CatalogEntry, SqlCatalogError>
Resolves name
to a function CatalogEntry
.
Trait Implementations
sourceimpl Clone for CatalogState
impl Clone for CatalogState
sourcefn clone(&self) -> CatalogState
fn clone(&self) -> CatalogState
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl !RefUnwindSafe for CatalogState
impl Send for CatalogState
impl Sync for CatalogState
impl Unpin for CatalogState
impl !UnwindSafe for CatalogState
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
sourceimpl<T> ProgressEventTimestamp for T where
T: Data + Debug + Any,
impl<T> ProgressEventTimestamp for T where
T: Data + Debug + Any,
sourceimpl<P, R> ProtoType<R> for P where
R: RustType<P>,
impl<P, R> ProtoType<R> for P where
R: RustType<P>,
sourcefn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See RustType::from_proto
.
sourcefn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See RustType::into_proto
.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more