pub struct CatalogState {Show 29 fields
pub(super) database_by_name: BTreeMap<String, DatabaseId>,
pub(super) database_by_id: BTreeMap<DatabaseId, Database>,
pub(super) entry_by_id: BTreeMap<CatalogItemId, CatalogEntry>,
pub(super) entry_by_global_id: BTreeMap<GlobalId, CatalogItemId>,
pub(super) ambient_schemas_by_name: BTreeMap<String, SchemaId>,
pub(super) ambient_schemas_by_id: BTreeMap<SchemaId, Schema>,
pub(super) clusters_by_name: BTreeMap<String, ClusterId>,
pub(super) clusters_by_id: BTreeMap<ClusterId, Cluster>,
pub(super) roles_by_name: BTreeMap<String, RoleId>,
pub(super) roles_by_id: BTreeMap<RoleId, Role>,
pub(super) network_policies_by_name: BTreeMap<String, NetworkPolicyId>,
pub(super) network_policies_by_id: BTreeMap<NetworkPolicyId, NetworkPolicy>,
pub(super) role_auth_by_id: BTreeMap<RoleId, RoleAuth>,
pub(super) system_configuration: SystemVars,
pub(super) default_privileges: DefaultPrivileges,
pub(super) system_privileges: PrivilegeMap,
pub(super) comments: CommentsMap,
pub(super) source_references: BTreeMap<CatalogItemId, SourceReferences>,
pub(super) storage_metadata: StorageMetadata,
pub(super) mock_authentication_nonce: Option<String>,
pub(super) temporary_schemas: BTreeMap<ConnectionId, Schema>,
pub(super) config: CatalogConfig,
pub(super) cluster_replica_sizes: ClusterReplicaSizeMap,
pub(crate) availability_zones: Vec<String>,
pub(super) egress_addresses: Vec<IpNet>,
pub(super) aws_principal_context: Option<AwsPrincipalContext>,
pub(super) aws_privatelink_availability_zones: Option<BTreeSet<String>>,
pub(super) http_host_name: Option<String>,
pub(super) license_key: ValidatedLicenseKey,
}Expand description
The in-memory representation of the Catalog. This struct is not directly used to persist
metadata to persistent storage. For persistent metadata see
mz_catalog::durable::DurableCatalogState.
Serialize is implemented to create human readable dumps of the in-memory state, not for
storing the contents of this struct on disk.
Fields§
§database_by_name: BTreeMap<String, DatabaseId>§database_by_id: BTreeMap<DatabaseId, Database>§entry_by_id: BTreeMap<CatalogItemId, CatalogEntry>§entry_by_global_id: BTreeMap<GlobalId, CatalogItemId>§ambient_schemas_by_name: BTreeMap<String, SchemaId>§ambient_schemas_by_id: BTreeMap<SchemaId, Schema>§clusters_by_name: BTreeMap<String, ClusterId>§clusters_by_id: BTreeMap<ClusterId, Cluster>§roles_by_name: BTreeMap<String, RoleId>§roles_by_id: BTreeMap<RoleId, Role>§network_policies_by_name: BTreeMap<String, NetworkPolicyId>§network_policies_by_id: BTreeMap<NetworkPolicyId, NetworkPolicy>§role_auth_by_id: BTreeMap<RoleId, RoleAuth>§system_configuration: SystemVars§default_privileges: DefaultPrivileges§system_privileges: PrivilegeMap§comments: CommentsMap§source_references: BTreeMap<CatalogItemId, SourceReferences>§storage_metadata: StorageMetadata§mock_authentication_nonce: Option<String>§temporary_schemas: BTreeMap<ConnectionId, Schema>§config: CatalogConfig§cluster_replica_sizes: ClusterReplicaSizeMap§availability_zones: Vec<String>§egress_addresses: Vec<IpNet>§aws_principal_context: Option<AwsPrincipalContext>§aws_privatelink_availability_zones: Option<BTreeSet<String>>§http_host_name: Option<String>§license_key: ValidatedLicenseKeyImplementations§
Source§impl CatalogState
impl CatalogState
Sourcepub(crate) fn pack_optimizer_notices<'a>(
&self,
updates: &mut Vec<BuiltinTableUpdate>,
notices: impl Iterator<Item = &'a Arc<OptimizerNotice>>,
diff: Diff,
)
pub(crate) fn pack_optimizer_notices<'a>( &self, updates: &mut Vec<BuiltinTableUpdate>, notices: impl Iterator<Item = &'a Arc<OptimizerNotice>>, diff: Diff, )
Pack a BuiltinTableUpdate with the given diff for each
OptimizerNotice in notices into updates.
Source§impl CatalogState
impl CatalogState
pub fn resolve_builtin_table_updates( &self, builtin_table_update: Vec<BuiltinTableUpdate<&'static BuiltinTable>>, ) -> Vec<BuiltinTableUpdate<CatalogItemId>>
pub fn resolve_builtin_table_update( &self, _: BuiltinTableUpdate<&'static BuiltinTable>, ) -> BuiltinTableUpdate<CatalogItemId>
pub fn pack_depends_update( &self, depender: CatalogItemId, dependee: CatalogItemId, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
pub(super) fn pack_database_update( &self, database_id: &DatabaseId, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
pub(super) fn pack_schema_update( &self, database_spec: &ResolvedDatabaseSpecifier, schema_id: &SchemaId, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
pub(super) fn pack_role_auth_update( &self, id: RoleId, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
pub(super) fn pack_role_update( &self, id: RoleId, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
pub(super) fn pack_role_members_update( &self, role_id: RoleId, member_id: RoleId, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
pub(super) fn pack_cluster_update( &self, name: &str, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
pub(super) fn pack_cluster_replica_update( &self, cluster_id: ClusterId, name: &str, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
pub(crate) fn pack_network_policy_update( &self, policy_id: &NetworkPolicyId, diff: Diff, ) -> Result<Vec<BuiltinTableUpdate<&'static BuiltinTable>>, Error>
pub(super) fn pack_item_update( &self, id: CatalogItemId, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_history_retention_strategy_update( &self, id: CatalogItemId, cw: CompactionWindow, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
fn pack_table_update( &self, id: CatalogItemId, oid: u32, schema_id: &SchemaSpecifier, name: &str, owner_id: &RoleId, privileges: Datum<'_>, diff: Diff, table: &Table, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_source_update( &self, id: CatalogItemId, oid: u32, schema_id: &SchemaSpecifier, name: &str, source_desc_name: &str, connection_id: Option<CatalogItemId>, envelope: Option<&str>, key_format: Option<&str>, value_format: Option<&str>, cluster_id: Option<&str>, owner_id: &RoleId, privileges: Datum<'_>, diff: Diff, create_sql: Option<&String>, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_postgres_source_update( &self, id: CatalogItemId, postgres: &PostgresSourceConnection<ReferencedConnection>, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_kafka_source_update( &self, item_id: CatalogItemId, collection_id: GlobalId, kafka: &KafkaSourceConnection<ReferencedConnection>, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_postgres_source_tables_update( &self, id: CatalogItemId, schema_name: &str, table_name: &str, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_mysql_source_tables_update( &self, id: CatalogItemId, schema_name: &str, table_name: &str, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_sql_server_source_table_update( &self, id: CatalogItemId, schema_name: &str, table_name: &str, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_kafka_source_tables_update( &self, id: CatalogItemId, topic: &str, envelope: Option<&str>, key_format: Option<&str>, value_format: Option<&str>, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_connection_update( &self, id: CatalogItemId, oid: u32, schema_id: &SchemaSpecifier, name: &str, owner_id: &RoleId, privileges: Datum<'_>, connection: &Connection, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
pub(crate) fn pack_ssh_tunnel_connection_update( &self, id: CatalogItemId, key_1: &SshKey, key_2: &SshKey, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
fn pack_kafka_connection_update( &self, id: CatalogItemId, kafka: &KafkaConnection<ReferencedConnection>, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
pub fn pack_aws_privatelink_connection_update( &self, connection_id: CatalogItemId, aws_principal_context: &AwsPrincipalContext, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
pub fn pack_aws_connection_update( &self, connection_id: CatalogItemId, aws_config: &AwsConnection, diff: Diff, ) -> Result<BuiltinTableUpdate<&'static BuiltinTable>, Error>
fn pack_view_update( &self, id: CatalogItemId, oid: u32, schema_id: &SchemaSpecifier, name: &str, owner_id: &RoleId, privileges: Datum<'_>, view: &View, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_materialized_view_update( &self, id: CatalogItemId, oid: u32, schema_id: &SchemaSpecifier, name: &str, owner_id: &RoleId, privileges: Datum<'_>, mview: &MaterializedView, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_continual_task_update( &self, id: CatalogItemId, oid: u32, schema_id: &SchemaSpecifier, name: &str, owner_id: &RoleId, privileges: Datum<'_>, ct: &ContinualTask, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_sink_update( &self, id: CatalogItemId, oid: u32, schema_id: &SchemaSpecifier, name: &str, owner_id: &RoleId, sink: &Sink, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_index_update( &self, id: CatalogItemId, oid: u32, name: &str, owner_id: &RoleId, index: &Index, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_type_update( &self, id: CatalogItemId, oid: u32, schema_id: &SchemaSpecifier, name: &str, owner_id: &RoleId, privileges: Datum<'_>, typ: &Type, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
fn pack_func_update( &self, id: CatalogItemId, schema_id: &SchemaSpecifier, name: &str, owner_id: &RoleId, func: &Func, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
pub fn pack_op_update( &self, operator: &str, func_impl_details: FuncImplCatalogDetails, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
fn pack_secret_update( &self, id: CatalogItemId, oid: u32, schema_id: &SchemaSpecifier, name: &str, owner_id: &RoleId, privileges: Datum<'_>, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
pub fn pack_audit_log_update( &self, event: &VersionedEvent, diff: Diff, ) -> Result<BuiltinTableUpdate<&'static BuiltinTable>, Error>
pub fn pack_storage_usage_update( &self, VersionedStorageUsage::V1: VersionedStorageUsage, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
pub fn pack_egress_ip_update( &self, ip: &IpNet, ) -> Result<BuiltinTableUpdate<&'static BuiltinTable>, Error>
pub fn pack_license_key_update( &self, license_key: &ValidatedLicenseKey, ) -> Result<BuiltinTableUpdate<&'static BuiltinTable>, Error>
pub fn pack_all_replica_size_updates( &self, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
pub fn pack_subscribe_update( &self, id: GlobalId, subscribe: &ActiveSubscribe, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
pub fn pack_session_update( &self, conn: &ConnMeta, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
pub fn pack_default_privileges_update( &self, default_privilege_object: &DefaultPrivilegeObject, grantee: &RoleId, acl_mode: &AclMode, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
pub fn pack_system_privileges_update( &self, privileges: MzAclItem, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
fn pack_privilege_array_row(&self, privileges: &PrivilegeMap) -> Row
pub fn pack_comment_update( &self, object_id: CommentObjectId, column_pos: Option<usize>, comment: &str, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
pub fn pack_webhook_source_update( &self, item_id: CatalogItemId, diff: Diff, ) -> BuiltinTableUpdate<&'static BuiltinTable>
pub fn pack_source_references_update( &self, source_references: &SourceReferences, diff: Diff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
Source§impl CatalogState
impl CatalogState
Sourcepub fn check_consistency(&self) -> Result<(), Box<CatalogInconsistencies>>
pub fn check_consistency(&self) -> Result<(), Box<CatalogInconsistencies>>
Checks the CatalogState to make sure we’re internally consistent.
Sourcefn check_internal_fields(&self) -> Result<(), Vec<InternalFieldsInconsistency>>
fn check_internal_fields(&self) -> Result<(), Vec<InternalFieldsInconsistency>>
§Invariants:
- Any fields within
CatalogStatethat reference another field need to be kept in sync.
TODO(parkmycar): Check the reverse direction for these collections, e.g. all of the
DatabaseIds in database_by_id also exist in database_by_name.
Sourcefn check_roles(&self) -> Result<(), Vec<RoleInconsistency>>
fn check_roles(&self) -> Result<(), Vec<RoleInconsistency>>
§Invariants:
- All RoleIds referenced from other objects must exist.
Sourcefn check_comments(&self) -> Result<(), Vec<CommentInconsistency>>
fn check_comments(&self) -> Result<(), Vec<CommentInconsistency>>
§Invariants:
- Comments should only reference existing objects.
- A comment should only have a column position if it references a relation.
Sourcefn check_object_dependencies(
&self,
) -> Result<(), Vec<ObjectDependencyInconsistency>>
fn check_object_dependencies( &self, ) -> Result<(), Vec<ObjectDependencyInconsistency>>
§Invariants:
- All of the objects in the “uses” collection of a CatalogEntry, should contain said CatalogEntry in their own “used_by” collection.
- All of the objects in the “used_by” collection of a CatalogEntry, should contain said CatalogEntry in their own “uses” collection.
Sourcefn check_items(&self) -> Result<(), Vec<ItemInconsistency>>
fn check_items(&self) -> Result<(), Vec<ItemInconsistency>>
§Invariants
- Every schema that exists in the
schemas_by_namemap, also exists inschemas_by_id. - The name present in the
schemas_by_namemap matches the name in the associatedSchemastruct. - All items that exist in a
Schemastruct, also exist in theentries_by_idmap. - Parsing the
create_sqlstring from anEntrysucceeds. - The result of parsing the
create_sqlmust return a singleStatement. - The names in the returned
Statement, must match that of the parent struct. - The item from the parsed
create_sqlmust be fully qualified.
Source§impl CatalogState
impl CatalogState
Sourcepub(crate) async fn apply_updates_for_bootstrap(
&mut self,
updates: Vec<StateUpdate>,
local_expression_cache: &mut LocalExpressionCache,
) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
pub(crate) async fn apply_updates_for_bootstrap( &mut self, updates: Vec<StateUpdate>, local_expression_cache: &mut LocalExpressionCache, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
Update in-memory catalog state from a list of updates made to the durable catalog state.
Returns builtin table updates corresponding to the changes to catalog state.
This is meant specifically for bootstrapping because it batches and applies builtin view additions separately from other update types.
Sourcepub(crate) fn apply_updates(
&mut self,
updates: Vec<StateUpdate>,
) -> Result<Vec<BuiltinTableUpdate<&'static BuiltinTable>>, CatalogError>
pub(crate) fn apply_updates( &mut self, updates: Vec<StateUpdate>, ) -> Result<Vec<BuiltinTableUpdate<&'static BuiltinTable>>, CatalogError>
Update in-memory catalog state from a list of updates made to the durable catalog state.
Returns builtin table updates corresponding to the changes to catalog state.
fn apply_updates_inner( &mut self, updates: Vec<StateUpdate>, retractions: &mut InProgressRetractions, local_expression_cache: &mut LocalExpressionCache, ) -> Result<Vec<BuiltinTableUpdate<&'static BuiltinTable>>, CatalogError>
fn apply_update( &mut self, kind: StateUpdateKind, diff: StateDiff, retractions: &mut InProgressRetractions, local_expression_cache: &mut LocalExpressionCache, ) -> Result<(), CatalogError>
fn apply_role_auth_update( &mut self, role_auth: RoleAuth, diff: StateDiff, retractions: &mut InProgressRetractions, )
fn apply_role_update( &mut self, role: Role, diff: StateDiff, retractions: &mut InProgressRetractions, )
fn apply_database_update( &mut self, database: Database, diff: StateDiff, retractions: &mut InProgressRetractions, )
fn apply_schema_update( &mut self, schema: Schema, diff: StateDiff, retractions: &mut InProgressRetractions, )
fn apply_default_privilege_update( &mut self, default_privilege: DefaultPrivilege, diff: StateDiff, _retractions: &mut InProgressRetractions, )
fn apply_system_privilege_update( &mut self, system_privilege: MzAclItem, diff: StateDiff, _retractions: &mut InProgressRetractions, )
fn apply_system_configuration_update( &mut self, system_configuration: SystemConfiguration, diff: StateDiff, _retractions: &mut InProgressRetractions, )
fn apply_cluster_update( &mut self, cluster: Cluster, diff: StateDiff, retractions: &mut InProgressRetractions, )
fn apply_network_policy_update( &mut self, policy: NetworkPolicy, diff: StateDiff, retractions: &mut InProgressRetractions, )
fn apply_introspection_source_index_update( &mut self, introspection_source_index: IntrospectionSourceIndex, diff: StateDiff, retractions: &mut InProgressRetractions, )
fn apply_cluster_replica_update( &mut self, cluster_replica: ClusterReplica, diff: StateDiff, _retractions: &mut InProgressRetractions, )
fn apply_system_object_mapping_update( &mut self, system_object_mapping: SystemObjectMapping, diff: StateDiff, retractions: &mut InProgressRetractions, local_expression_cache: &mut LocalExpressionCache, )
fn apply_temporary_item_update( &mut self, _: TemporaryItem, diff: StateDiff, retractions: &mut InProgressRetractions, )
fn apply_item_update( &mut self, item: Item, diff: StateDiff, retractions: &mut InProgressRetractions, local_expression_cache: &mut LocalExpressionCache, ) -> Result<(), CatalogError>
fn apply_comment_update( &mut self, comment: Comment, diff: StateDiff, _retractions: &mut InProgressRetractions, )
fn apply_source_references_update( &mut self, source_references: SourceReferences, diff: StateDiff, _retractions: &mut InProgressRetractions, )
fn apply_storage_collection_metadata_update( &mut self, storage_collection_metadata: StorageCollectionMetadata, diff: StateDiff, _retractions: &mut InProgressRetractions, )
fn apply_unfinalized_shard_update( &mut self, unfinalized_shard: UnfinalizedShard, diff: StateDiff, _retractions: &mut InProgressRetractions, )
Sourcepub(crate) fn generate_builtin_table_updates(
&self,
updates: Vec<StateUpdate>,
) -> Vec<BuiltinTableUpdate>
pub(crate) fn generate_builtin_table_updates( &self, updates: Vec<StateUpdate>, ) -> Vec<BuiltinTableUpdate>
Generate a list of BuiltinTableUpdates that correspond to a list of updates made to the
durable catalog.
Sourcepub(crate) fn generate_builtin_table_update(
&self,
kind: StateUpdateKind,
diff: StateDiff,
) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
pub(crate) fn generate_builtin_table_update( &self, kind: StateUpdateKind, diff: StateDiff, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
Generate a list of BuiltinTableUpdates that correspond to a single update made to the
durable catalog.
fn get_entry_mut(&mut self, id: &CatalogItemId) -> &mut CatalogEntry
fn get_schema_mut( &mut self, database_spec: &ResolvedDatabaseSpecifier, schema_spec: &SchemaSpecifier, conn_id: &ConnectionId, ) -> &mut Schema
Sourceasync fn parse_builtin_views(
state: &mut CatalogState,
builtin_views: Vec<(&'static BuiltinView, CatalogItemId, GlobalId)>,
retractions: &mut InProgressRetractions,
local_expression_cache: &mut LocalExpressionCache,
) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
async fn parse_builtin_views( state: &mut CatalogState, builtin_views: Vec<(&'static BuiltinView, CatalogItemId, GlobalId)>, retractions: &mut InProgressRetractions, local_expression_cache: &mut LocalExpressionCache, ) -> Vec<BuiltinTableUpdate<&'static BuiltinTable>>
Install builtin views to the catalog. This is its own function so that views can be optimized in parallel.
The implementation is similar to apply_updates_for_bootstrap and determines dependency
problems by sniffing out specific errors and then retrying once those dependencies are
complete. This doesn’t work for everything (casts, function implementations) so we also need
to have a bucket for everything at the end. Additionally, because this executes in parellel,
we must maintain a completed set otherwise races could result in orphaned views languishing
in awaiting with nothing retriggering the attempt.
Sourcefn insert_entry(&mut self, entry: CatalogEntry)
fn insert_entry(&mut self, entry: CatalogEntry)
Associates a name, CatalogItemId, and entry.
Sourcefn insert_item(
&mut self,
id: CatalogItemId,
oid: u32,
name: QualifiedItemName,
item: CatalogItem,
owner_id: RoleId,
privileges: PrivilegeMap,
)
fn insert_item( &mut self, id: CatalogItemId, oid: u32, name: QualifiedItemName, item: CatalogItem, owner_id: RoleId, privileges: PrivilegeMap, )
Associates a name, CatalogItemId, and entry.
fn drop_item(&mut self, id: CatalogItemId) -> CatalogEntry
fn insert_introspection_source_index( &mut self, cluster_id: ClusterId, log: &'static BuiltinLog, item_id: CatalogItemId, global_id: GlobalId, oid: u32, )
fn create_introspection_source_index( &self, cluster_id: ClusterId, log: &'static BuiltinLog, global_id: GlobalId, ) -> (QualifiedItemName, CatalogItem)
Source§impl CatalogState
impl CatalogState
Source§impl CatalogState
impl CatalogState
Sourcepub fn empty_test() -> Self
pub fn empty_test() -> Self
Returns an empty CatalogState that can be used in tests.
pub fn for_session<'a>(&'a self, session: &'a Session) -> ConnCatalog<'a>
pub fn for_sessionless_user(&self, role_id: RoleId) -> ConnCatalog<'_>
pub fn for_system_session(&self) -> ConnCatalog<'_>
Sourcepub fn transitive_uses(
&self,
id: CatalogItemId,
) -> impl Iterator<Item = CatalogItemId> + '_
pub fn transitive_uses( &self, id: CatalogItemId, ) -> impl Iterator<Item = CatalogItemId> + '_
Returns an iterator over the deduplicated identifiers of all
objects this catalog entry transitively depends on (where
“depends on” is meant in the sense of CatalogItem::uses, rather than
CatalogItem::references).
Sourcepub fn introspection_dependencies(
&self,
id: CatalogItemId,
) -> Vec<CatalogItemId>
pub fn introspection_dependencies( &self, id: CatalogItemId, ) -> Vec<CatalogItemId>
Computes the IDs of any log sources this catalog entry transitively depends on.
fn introspection_dependencies_inner( &self, id: CatalogItemId, out: &mut Vec<CatalogItemId>, )
Sourcepub(super) fn object_dependents(
&self,
object_ids: &Vec<ObjectId>,
conn_id: &ConnectionId,
seen: &mut BTreeSet<ObjectId>,
) -> Vec<ObjectId>
pub(super) fn object_dependents( &self, object_ids: &Vec<ObjectId>, conn_id: &ConnectionId, seen: &mut BTreeSet<ObjectId>, ) -> Vec<ObjectId>
Returns all the IDs of all objects that depend on ids, including ids themselves.
The order is guaranteed to be in reverse dependency order, i.e. the leafs will appear earlier in the list than the roots. This is particularly useful for the order to drop objects.
Sourcefn cluster_dependents(
&self,
cluster_id: ClusterId,
seen: &mut BTreeSet<ObjectId>,
) -> Vec<ObjectId>
fn cluster_dependents( &self, cluster_id: ClusterId, seen: &mut BTreeSet<ObjectId>, ) -> Vec<ObjectId>
Returns all the IDs of all objects that depend on cluster_id, including cluster_id
itself.
The order is guaranteed to be in reverse dependency order, i.e. the leafs will appear earlier in the list than the roots. This is particularly useful for the order to drop objects.
Sourcepub(super) fn cluster_replica_dependents(
&self,
cluster_id: ClusterId,
replica_id: ReplicaId,
seen: &mut BTreeSet<ObjectId>,
) -> Vec<ObjectId>
pub(super) fn cluster_replica_dependents( &self, cluster_id: ClusterId, replica_id: ReplicaId, seen: &mut BTreeSet<ObjectId>, ) -> Vec<ObjectId>
Returns all the IDs of all objects that depend on replica_id, including replica_id
itself.
The order is guaranteed to be in reverse dependency order, i.e. the leafs will appear earlier in the list than the roots. This is particularly useful for the order to drop objects.
Sourcefn database_dependents(
&self,
database_id: DatabaseId,
conn_id: &ConnectionId,
seen: &mut BTreeSet<ObjectId>,
) -> Vec<ObjectId>
fn database_dependents( &self, database_id: DatabaseId, conn_id: &ConnectionId, seen: &mut BTreeSet<ObjectId>, ) -> Vec<ObjectId>
Returns all the IDs of all objects that depend on database_id, including database_id
itself.
The order is guaranteed to be in reverse dependency order, i.e. the leafs will appear earlier in the list than the roots. This is particularly useful for the order to drop objects.
Sourcefn schema_dependents(
&self,
database_spec: ResolvedDatabaseSpecifier,
schema_spec: SchemaSpecifier,
conn_id: &ConnectionId,
seen: &mut BTreeSet<ObjectId>,
) -> Vec<ObjectId>
fn schema_dependents( &self, database_spec: ResolvedDatabaseSpecifier, schema_spec: SchemaSpecifier, conn_id: &ConnectionId, seen: &mut BTreeSet<ObjectId>, ) -> Vec<ObjectId>
Returns all the IDs of all objects that depend on schema_id, including schema_id
itself.
The order is guaranteed to be in reverse dependency order, i.e. the leafs will appear earlier in the list than the roots. This is particularly useful for the order to drop objects.
Sourcepub(super) fn item_dependents(
&self,
item_id: CatalogItemId,
seen: &mut BTreeSet<ObjectId>,
) -> Vec<ObjectId>
pub(super) fn item_dependents( &self, item_id: CatalogItemId, seen: &mut BTreeSet<ObjectId>, ) -> Vec<ObjectId>
Returns all the IDs of all objects that depend on item_id, including item_id
itself.
The order is guaranteed to be in reverse dependency order, i.e. the leafs will appear earlier in the list than the roots. This is particularly useful for the order to drop objects.
Sourcepub(super) fn network_policy_dependents(
&self,
network_policy_id: NetworkPolicyId,
_seen: &mut BTreeSet<ObjectId>,
) -> Vec<ObjectId>
pub(super) fn network_policy_dependents( &self, network_policy_id: NetworkPolicyId, _seen: &mut BTreeSet<ObjectId>, ) -> Vec<ObjectId>
Returns all the IDs of all objects that depend on network_policy_id, including network_policy_id
itself.
The order is guaranteed to be in reverse dependency order, i.e. the leafs will appear earlier in the list than the roots. This is particularly useful for the order to drop objects.
Sourcefn is_stable(&self, id: CatalogItemId) -> bool
fn is_stable(&self, id: CatalogItemId) -> bool
Indicates whether the indicated item is considered stable or not.
Only stable items can be used as dependencies of other catalog items.
pub(super) fn check_unstable_dependencies( &self, item: &CatalogItem, ) -> Result<(), Error>
pub fn resolve_full_name( &self, name: &QualifiedItemName, conn_id: Option<&ConnectionId>, ) -> FullItemName
pub(super) fn resolve_full_schema_name( &self, name: &QualifiedSchemaName, ) -> FullSchemaName
pub fn get_entry(&self, id: &CatalogItemId) -> &CatalogEntry
pub fn get_entry_by_global_id(&self, id: &GlobalId) -> CatalogCollectionEntry
pub fn get_entries( &self, ) -> impl Iterator<Item = (&CatalogItemId, &CatalogEntry)> + '_
pub fn get_temp_items( &self, conn: &ConnectionId, ) -> impl Iterator<Item = ObjectId> + '_
Sourcepub(super) fn get_system_type(&self, name: &str) -> &CatalogEntry
pub(super) fn get_system_type(&self, name: &str) -> &CatalogEntry
Gets a type named name from exactly one of the system schemas.
§Panics
- If
nameis not an entry in any system schema - If more than one system schema has an entry named
name.
pub fn get_item_by_name( &self, name: &QualifiedItemName, conn_id: &ConnectionId, ) -> Option<&CatalogEntry>
pub fn get_type_by_name( &self, name: &QualifiedItemName, conn_id: &ConnectionId, ) -> Option<&CatalogEntry>
pub(super) fn find_available_name( &self, name: QualifiedItemName, conn_id: &ConnectionId, ) -> QualifiedItemName
pub fn try_get_entry(&self, id: &CatalogItemId) -> Option<&CatalogEntry>
pub fn try_get_entry_by_global_id(&self, id: &GlobalId) -> Option<&CatalogEntry>
Sourcepub fn try_get_desc_by_global_id(
&self,
id: &GlobalId,
) -> Option<Cow<'_, RelationDesc>>
pub fn try_get_desc_by_global_id( &self, id: &GlobalId, ) -> Option<Cow<'_, RelationDesc>>
Returns the RelationDesc for a GlobalId, if the provided GlobalId refers to an
object that returns rows.
pub(crate) fn get_cluster(&self, cluster_id: ClusterId) -> &Cluster
pub(super) fn try_get_cluster(&self, cluster_id: ClusterId) -> Option<&Cluster>
pub(super) fn try_get_role(&self, id: &RoleId) -> Option<&Role>
pub fn get_role(&self, id: &RoleId) -> &Role
pub fn get_roles(&self) -> impl Iterator<Item = &RoleId>
pub(super) fn try_get_role_by_name(&self, role_name: &str) -> Option<&Role>
pub(super) fn get_role_auth(&self, id: &RoleId) -> &RoleAuth
pub(super) fn try_get_role_auth_by_id(&self, id: &RoleId) -> Option<&RoleAuth>
pub(super) fn try_get_network_policy_by_name( &self, policy_name: &str, ) -> Option<&NetworkPolicy>
pub(crate) fn collect_role_membership(&self, id: &RoleId) -> BTreeSet<RoleId>
pub fn get_network_policy(&self, id: &NetworkPolicyId) -> &NetworkPolicy
pub fn get_network_policies(&self) -> impl Iterator<Item = &NetworkPolicyId>
Sourcepub fn try_get_webhook_url(&self, id: &CatalogItemId) -> Option<Url>
pub fn try_get_webhook_url(&self, id: &CatalogItemId) -> Option<Url>
Returns the URL for POST-ing data to a webhook source, if id corresponds to a webhook
source.
Note: Identifiers for the source, e.g. item name, are URL encoded.
Sourcepub(crate) fn deserialize_plan_with_enable_for_item_parsing(
&mut self,
create_sql: &str,
force_if_exists_skip: bool,
) -> Result<(Plan, ResolvedIds), AdapterError>
pub(crate) fn deserialize_plan_with_enable_for_item_parsing( &mut self, create_sql: &str, force_if_exists_skip: bool, ) -> Result<(Plan, ResolvedIds), AdapterError>
Parses the given SQL string into a pair of Plan and a ResolvedIds.
This function will temporarily enable all “enable_for_item_parsing” feature flags. See
CatalogState::with_enable_for_item_parsing for more details.
NOTE: While this method takes a &mut self, all mutations are temporary and restored to
their original state before the method returns.
Sourcepub(crate) fn parse_plan(
create_sql: &str,
pcx: Option<&PlanContext>,
catalog: &ConnCatalog<'_>,
) -> Result<(Plan, ResolvedIds), AdapterError>
pub(crate) fn parse_plan( create_sql: &str, pcx: Option<&PlanContext>, catalog: &ConnCatalog<'_>, ) -> Result<(Plan, ResolvedIds), AdapterError>
Parses the given SQL string into a pair of Plan and a ResolvedIds.
Sourcepub(crate) fn deserialize_item(
&self,
global_id: GlobalId,
create_sql: &str,
extra_versions: &BTreeMap<RelationVersion, GlobalId>,
local_expression_cache: &mut LocalExpressionCache,
previous_item: Option<CatalogItem>,
) -> Result<CatalogItem, AdapterError>
pub(crate) fn deserialize_item( &self, global_id: GlobalId, create_sql: &str, extra_versions: &BTreeMap<RelationVersion, GlobalId>, local_expression_cache: &mut LocalExpressionCache, previous_item: Option<CatalogItem>, ) -> Result<CatalogItem, AdapterError>
Parses the given SQL string into a pair of CatalogItem.
Sourcepub(crate) fn parse_item(
&self,
global_id: GlobalId,
create_sql: &str,
extra_versions: &BTreeMap<RelationVersion, GlobalId>,
pcx: Option<&PlanContext>,
is_retained_metrics_object: bool,
custom_logical_compaction_window: Option<CompactionWindow>,
local_expression_cache: &mut LocalExpressionCache,
previous_item: Option<CatalogItem>,
) -> Result<CatalogItem, AdapterError>
pub(crate) fn parse_item( &self, global_id: GlobalId, create_sql: &str, extra_versions: &BTreeMap<RelationVersion, GlobalId>, pcx: Option<&PlanContext>, is_retained_metrics_object: bool, custom_logical_compaction_window: Option<CompactionWindow>, local_expression_cache: &mut LocalExpressionCache, previous_item: Option<CatalogItem>, ) -> Result<CatalogItem, AdapterError>
Parses the given SQL string into a CatalogItem.
Sourcepub(crate) fn parse_item_inner(
&self,
global_id: GlobalId,
create_sql: &str,
extra_versions: &BTreeMap<RelationVersion, GlobalId>,
pcx: Option<&PlanContext>,
is_retained_metrics_object: bool,
custom_logical_compaction_window: Option<CompactionWindow>,
cached_expr: Option<LocalExpressions>,
previous_item: Option<CatalogItem>,
) -> Result<(CatalogItem, Option<(OptimizedMirRelationExpr, OptimizerFeatures)>), (AdapterError, Option<LocalExpressions>)>
pub(crate) fn parse_item_inner( &self, global_id: GlobalId, create_sql: &str, extra_versions: &BTreeMap<RelationVersion, GlobalId>, pcx: Option<&PlanContext>, is_retained_metrics_object: bool, custom_logical_compaction_window: Option<CompactionWindow>, cached_expr: Option<LocalExpressions>, previous_item: Option<CatalogItem>, ) -> Result<(CatalogItem, Option<(OptimizedMirRelationExpr, OptimizerFeatures)>), (AdapterError, Option<LocalExpressions>)>
Parses the given SQL string into a CatalogItem, using cached_expr if it’s Some.
On success returns the CatalogItem and an optimized expression iff the expression was
not cached.
On failure returns an error and cached_expr so it can be used later.
Sourcepub fn with_enable_for_item_parsing<T>(
&mut self,
f: impl FnOnce(&mut Self) -> T,
) -> T
pub fn with_enable_for_item_parsing<T>( &mut self, f: impl FnOnce(&mut Self) -> T, ) -> T
Execute function f on self, with all “enable_for_item_parsing” feature flags enabled.
Calling this method will not permanently modify any system configuration variables.
WARNING:
Any modifications made to the system configuration variables in f, will be lost.
Sourcepub fn get_indexes_on(
&self,
id: GlobalId,
cluster: ClusterId,
) -> impl Iterator<Item = (GlobalId, &Index)>
pub fn get_indexes_on( &self, id: GlobalId, cluster: ClusterId, ) -> impl Iterator<Item = (GlobalId, &Index)>
Returns all indexes on the given object and cluster known in the catalog.
pub(super) fn get_database(&self, database_id: &DatabaseId) -> &Database
Sourcepub(super) fn try_get_cluster_replica(
&self,
id: ClusterId,
replica_id: ReplicaId,
) -> Option<&ClusterReplica>
pub(super) fn try_get_cluster_replica( &self, id: ClusterId, replica_id: ReplicaId, ) -> Option<&ClusterReplica>
Gets a reference to the specified replica of the specified cluster.
Returns None if either the cluster or the replica does not
exist.
Sourcepub(super) fn get_cluster_replica(
&self,
cluster_id: ClusterId,
replica_id: ReplicaId,
) -> &ClusterReplica
pub(super) fn get_cluster_replica( &self, cluster_id: ClusterId, replica_id: ReplicaId, ) -> &ClusterReplica
Gets a reference to the specified replica of the specified cluster.
Panics if either the cluster or the replica does not exist.
pub(super) fn resolve_replica_in_cluster( &self, cluster_id: &ClusterId, replica_name: &str, ) -> Result<&ClusterReplica, SqlCatalogError>
Sourcepub fn get_system_configuration(&self, name: &str) -> Result<&dyn Var, Error>
pub fn get_system_configuration(&self, name: &str) -> Result<&dyn Var, Error>
Get system configuration name.
Sourcepub(super) fn parse_system_configuration(
&self,
name: &str,
value: VarInput<'_>,
) -> Result<String, Error>
pub(super) fn parse_system_configuration( &self, name: &str, value: VarInput<'_>, ) -> Result<String, Error>
Parse system configuration name with value int.
Returns the parsed value as a string.
Sourcepub(super) fn resolve_schema_in_database(
&self,
database_spec: &ResolvedDatabaseSpecifier,
schema_name: &str,
conn_id: &ConnectionId,
) -> Result<&Schema, SqlCatalogError>
pub(super) fn resolve_schema_in_database( &self, database_spec: &ResolvedDatabaseSpecifier, schema_name: &str, conn_id: &ConnectionId, ) -> 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: &ConnectionId, ) -> &Schema
pub(super) fn find_non_temp_schema(&self, schema_id: &SchemaId) -> &Schema
pub fn get_mz_catalog_schema_id(&self) -> SchemaId
pub fn get_mz_catalog_unstable_schema_id(&self) -> SchemaId
pub fn get_pg_catalog_schema_id(&self) -> SchemaId
pub fn get_information_schema_id(&self) -> SchemaId
pub fn get_mz_internal_schema_id(&self) -> SchemaId
pub fn get_mz_introspection_schema_id(&self) -> SchemaId
pub fn get_mz_unsafe_schema_id(&self) -> SchemaId
pub fn system_schema_ids(&self) -> impl Iterator<Item = SchemaId> + '_
pub fn is_system_schema_id(&self, id: SchemaId) -> bool
pub fn is_system_schema_specifier(&self, spec: SchemaSpecifier) -> bool
pub fn unstable_schema_ids(&self) -> impl Iterator<Item = SchemaId> + '_
pub fn is_unstable_schema_id(&self, id: SchemaId) -> bool
pub fn is_unstable_schema_specifier(&self, spec: SchemaSpecifier) -> bool
Sourcepub fn create_temporary_schema(
&mut self,
conn_id: &ConnectionId,
owner_id: RoleId,
) -> Result<(), Error>
pub fn create_temporary_schema( &mut self, conn_id: &ConnectionId, owner_id: RoleId, ) -> Result<(), Error>
Creates a new schema in the Catalog for temporary items
indicated by the TEMPORARY or TEMP keywords.
Sourcepub(crate) fn get_temporary_oids(&self) -> impl Iterator<Item = u32> + '_
pub(crate) fn get_temporary_oids(&self) -> impl Iterator<Item = u32> + '_
Return all OIDs that are allocated to temporary objects.
Sourcepub fn resolve_builtin_table(
&self,
builtin: &'static BuiltinTable,
) -> CatalogItemId
pub fn resolve_builtin_table( &self, builtin: &'static BuiltinTable, ) -> CatalogItemId
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,
) -> (CatalogItemId, GlobalId)
pub fn resolve_builtin_log( &self, builtin: &'static BuiltinLog, ) -> (CatalogItemId, GlobalId)
Optimized lookup for a builtin log.
Panics if the builtin log doesn’t exist in the catalog.
Sourcepub fn resolve_builtin_source(
&self,
builtin: &'static BuiltinSource,
) -> CatalogItemId
pub fn resolve_builtin_source( &self, builtin: &'static BuiltinSource, ) -> CatalogItemId
Optimized lookup for a builtin storage collection.
Panics if the builtin storage collection doesn’t exist in the catalog.
Sourcepub fn resolve_builtin_object<T: TypeReference>(
&self,
builtin: &Builtin<T>,
) -> CatalogItemId
pub fn resolve_builtin_object<T: TypeReference>( &self, builtin: &Builtin<T>, ) -> CatalogItemId
Optimized lookup for a builtin object.
Panics if the builtin object doesn’t exist in the catalog.
Sourcepub fn resolve_builtin_type_references(
&self,
builtin: &BuiltinType<NameReference>,
) -> BuiltinType<IdReference>
pub fn resolve_builtin_type_references( &self, builtin: &BuiltinType<NameReference>, ) -> BuiltinType<IdReference>
Resolve a BuiltinType<NameReference> to a BuiltinType<IdReference>.
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: &ConnectionId, ) -> Result<&Schema, SqlCatalogError>
Sourcepub fn resolve_system_schema(&self, name: &'static str) -> SchemaId
pub fn resolve_system_schema(&self, name: &'static str) -> SchemaId
Optimized lookup for a system schema.
Panics if the system schema doesn’t exist in the catalog.
pub fn resolve_search_path( &self, session: &dyn SessionMetadata, ) -> Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>
pub fn effective_search_path( &self, search_path: &[(ResolvedDatabaseSpecifier, SchemaSpecifier)], include_temp_schema: bool, ) -> Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>
pub fn resolve_cluster(&self, name: &str) -> Result<&Cluster, SqlCatalogError>
pub fn resolve_builtin_cluster(&self, cluster: &BuiltinCluster) -> &Cluster
pub fn resolve_cluster_replica( &self, cluster_replica_name: &QualifiedReplica, ) -> Result<&ClusterReplica, SqlCatalogError>
Sourcepub fn resolve(
&self,
get_schema_entries: fn(&Schema) -> &BTreeMap<String, CatalogItemId>,
current_database: Option<&DatabaseId>,
search_path: &Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>,
name: &PartialItemName,
conn_id: &ConnectionId,
err_gen: fn(String) -> SqlCatalogError,
) -> Result<&CatalogEntry, SqlCatalogError>
pub fn resolve( &self, get_schema_entries: fn(&Schema) -> &BTreeMap<String, CatalogItemId>, current_database: Option<&DatabaseId>, search_path: &Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>, name: &PartialItemName, conn_id: &ConnectionId, err_gen: fn(String) -> SqlCatalogError, ) -> Result<&CatalogEntry, SqlCatalogError>
Resolves PartialItemName 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: &PartialItemName,
conn_id: &ConnectionId,
) -> Result<&CatalogEntry, SqlCatalogError>
pub fn resolve_entry( &self, current_database: Option<&DatabaseId>, search_path: &Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>, name: &PartialItemName, conn_id: &ConnectionId, ) -> 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: &PartialItemName,
conn_id: &ConnectionId,
) -> Result<&CatalogEntry, SqlCatalogError>
pub fn resolve_function( &self, current_database: Option<&DatabaseId>, search_path: &Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>, name: &PartialItemName, conn_id: &ConnectionId, ) -> Result<&CatalogEntry, SqlCatalogError>
Resolves name to a function CatalogEntry.
Sourcepub fn resolve_type(
&self,
current_database: Option<&DatabaseId>,
search_path: &Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>,
name: &PartialItemName,
conn_id: &ConnectionId,
) -> Result<&CatalogEntry, SqlCatalogError>
pub fn resolve_type( &self, current_database: Option<&DatabaseId>, search_path: &Vec<(ResolvedDatabaseSpecifier, SchemaSpecifier)>, name: &PartialItemName, conn_id: &ConnectionId, ) -> Result<&CatalogEntry, SqlCatalogError>
Resolves name to a type CatalogEntry.
Sourcepub(super) fn get_comment_id(&self, object_id: ObjectId) -> CommentObjectId
pub(super) fn get_comment_id(&self, object_id: ObjectId) -> CommentObjectId
For an ObjectId gets the corresponding CommentObjectId.
Sourcepub fn system_config(&self) -> &SystemVars
pub fn system_config(&self) -> &SystemVars
Return current system configuration.
Sourcepub fn system_config_mut(&mut self) -> &mut SystemVars
pub fn system_config_mut(&mut self) -> &mut SystemVars
Return a mutable reference to the current system configuration.
Sourcepub fn dump(
&self,
unfinalized_shards: Option<BTreeSet<String>>,
) -> Result<String, Error>
pub fn dump( &self, unfinalized_shards: Option<BTreeSet<String>>, ) -> Result<String, Error>
Serializes the catalog’s in-memory state.
There are no guarantees about the format of the serialized state, except that the serialized state for two identical catalogs will compare identically.
Some consumers would like the ability to overwrite the unfinalized_shards catalog field,
which they can accomplish by passing in a value of Some for the unfinalized_shards
argument.
pub fn availability_zones(&self) -> &[String]
pub fn concretize_replica_location( &self, location: ReplicaLocation, allowed_sizes: &Vec<String>, allowed_availability_zones: Option<&[String]>, ) -> Result<ReplicaLocation, Error>
Sourcepub(crate) fn cluster_replica_size_has_disk(&self, size: &str) -> bool
pub(crate) fn cluster_replica_size_has_disk(&self, size: &str) -> bool
Return whether the given replica size requests a disk.
Note that here we treat replica sizes that enable swap as not requesting disk. For swap replicas, the provided disk limit is informational and mostly ignored. Whether an instance has access to swap depends on the configuration of the node it gets scheduled on, and is not something we can know at this point.
§Panics
Panics if the given size doesn’t exist in cluster_replica_sizes.
pub(crate) fn ensure_valid_replica_size( &self, allowed_sizes: &[String], size: &String, ) -> Result<(), Error>
pub fn ensure_not_reserved_role(&self, role_id: &RoleId) -> Result<(), Error>
pub fn ensure_not_reserved_network_policy( &self, network_policy_id: &NetworkPolicyId, ) -> Result<(), Error>
pub fn ensure_grantable_role(&self, role_id: &RoleId) -> Result<(), Error>
pub fn ensure_not_system_role(&self, role_id: &RoleId) -> Result<(), Error>
pub fn ensure_not_predefined_role(&self, role_id: &RoleId) -> Result<(), Error>
pub(crate) fn add_to_audit_log( system_configuration: &SystemVars, oracle_write_ts: Timestamp, session: Option<&ConnMeta>, tx: &mut Transaction<'_>, audit_events: &mut Vec<VersionedEvent>, event_type: EventType, object_type: ObjectType, details: EventDetails, ) -> Result<(), Error>
pub(super) fn get_owner_id( &self, id: &ObjectId, conn_id: &ConnectionId, ) -> Option<RoleId>
pub(super) fn get_object_type(&self, object_id: &ObjectId) -> ObjectType
pub(super) fn get_system_object_type( &self, id: &SystemObjectId, ) -> SystemObjectType
Sourcepub fn storage_metadata(&self) -> &StorageMetadata
pub fn storage_metadata(&self) -> &StorageMetadata
Returns a read-only view of the current StorageMetadata.
To write to this struct, you must use a catalog transaction.
Sourcepub fn source_compaction_windows(
&self,
ids: impl IntoIterator<Item = CatalogItemId>,
) -> BTreeMap<CompactionWindow, BTreeSet<CatalogItemId>>
pub fn source_compaction_windows( &self, ids: impl IntoIterator<Item = CatalogItemId>, ) -> BTreeMap<CompactionWindow, BTreeSet<CatalogItemId>>
For the Sources ids in ids, return their compaction windows.
pub fn comment_id_to_item_id(id: &CommentObjectId) -> Option<CatalogItemId>
pub fn get_comment_id_entry( &self, id: &CommentObjectId, ) -> Option<&CatalogEntry>
pub fn comment_id_to_audit_log_name( &self, id: CommentObjectId, conn_id: &ConnectionId, ) -> String
pub fn mock_authentication_nonce(&self) -> String
Trait Implementations§
Source§impl Clone for CatalogState
impl Clone for CatalogState
Source§fn clone(&self) -> CatalogState
fn clone(&self) -> CatalogState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ConnectionResolver for CatalogState
impl ConnectionResolver for CatalogState
fn resolve_connection(&self, id: CatalogItemId) -> Connection<InlinedConnection>
Source§impl Debug for CatalogState
impl Debug for CatalogState
Source§impl OptimizerCatalog for CatalogState
impl OptimizerCatalog for CatalogState
fn get_entry(&self, id: &GlobalId) -> CatalogCollectionEntry
fn get_entry_by_item_id(&self, id: &CatalogItemId) -> &CatalogEntry
fn resolve_full_name( &self, name: &QualifiedItemName, conn_id: Option<&ConnectionId>, ) -> FullItemName
Auto Trait Implementations§
impl Freeze for CatalogState
impl !RefUnwindSafe for CatalogState
impl Send for CatalogState
impl Sync for CatalogState
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for T
impl<T> Downcast for T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
Source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto.Source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto.Source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
Source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign, for types that do not implement AddAssign.Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Source§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Source§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.