Skip to content

Commit

Permalink
Remove dbverifier checks, db-info commands, serialization code for vi…
Browse files Browse the repository at this point in the history
…rtual tables (#29775)

GitOrigin-RevId: 237db74f26d520919ef41df530e16169b64583f7
  • Loading branch information
nipunn1313 authored and Convex, Inc. committed Sep 11, 2024
1 parent 09f2baa commit c349a71
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 113 deletions.
4 changes: 0 additions & 4 deletions crates/database/src/bootstrap_model/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ use crate::{
index_workers::IndexWorkerMetadataTable,
schema::SchemasTable,
table::TablesTable,
virtual_tables::VirtualTablesTable,
},
ComponentDefinitionsTable,
ComponentsTable,
INDEX_WORKER_METADATA_TABLE,
NUM_RESERVED_LEGACY_TABLE_NUMBERS,
SCHEMAS_TABLE,
VIRTUAL_TABLES_TABLE,
};

pub fn system_index(table: &impl Deref<Target = TableName>, name: &'static str) -> IndexName {
Expand Down Expand Up @@ -97,7 +95,6 @@ pub fn bootstrap_system_tables() -> Vec<&'static dyn SystemTable> {
&TablesTable,
&IndexTable,
&SchemasTable,
&VirtualTablesTable,
&IndexWorkerMetadataTable,
&ComponentDefinitionsTable,
&ComponentsTable,
Expand All @@ -111,7 +108,6 @@ pub static DEFAULT_BOOTSTRAP_TABLE_NUMBERS: LazyLock<BTreeMap<TableName, TableNu
TABLES_TABLE.clone() => tn(1),
INDEX_TABLE.clone() => tn(2),
SCHEMAS_TABLE.clone() => tn(20),
VIRTUAL_TABLES_TABLE.clone() => tn(26),
INDEX_WORKER_METADATA_TABLE.clone() => tn(30),
COMPONENT_DEFINITIONS_TABLE.clone() => tn(31),
COMPONENTS_TABLE.clone() => tn(32),
Expand Down
30 changes: 1 addition & 29 deletions crates/database/src/bootstrap_model/virtual_tables/mod.rs
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
use std::sync::LazyLock;

use common::document::{
ParsedDocument,
ResolvedDocument,
};
use value::TableName;

use crate::{
defaults::{
SystemIndex,
SystemTable,
},
VirtualTableMetadata,
};

pub mod types;

// Keep this around for a push so we can drop the table - table is unused.
pub static VIRTUAL_TABLES_TABLE: LazyLock<TableName> = LazyLock::new(|| {
"_virtual_tables"
.parse()
.expect("Invalid built-in virtual_tables table")
});

pub struct VirtualTablesTable;
impl SystemTable for VirtualTablesTable {
fn table_name(&self) -> &'static TableName {
&VIRTUAL_TABLES_TABLE
}

fn indexes(&self) -> Vec<SystemIndex> {
vec![]
}

fn validate_document(&self, document: ResolvedDocument) -> anyhow::Result<()> {
ParsedDocument::<VirtualTableMetadata>::try_from(document).map(|_| ())
}
}
72 changes: 0 additions & 72 deletions crates/database/src/bootstrap_model/virtual_tables/types.rs

This file was deleted.

6 changes: 1 addition & 5 deletions crates/database/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ pub use self::{
TABLES_INDEX,
},
user_facing::UserFacingModel,
virtual_tables::{
types::VirtualTableMetadata,
VirtualTablesTable,
VIRTUAL_TABLES_TABLE,
},
virtual_tables::VIRTUAL_TABLES_TABLE,
},
database::{
unauthorized_error,
Expand Down
3 changes: 0 additions & 3 deletions crates/model/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ use database::{
SchemasTable,
TablesTable,
Transaction,
VirtualTablesTable,
NUM_RESERVED_LEGACY_TABLE_NUMBERS,
};
use keybroker::Identity;
Expand Down Expand Up @@ -140,7 +139,6 @@ enum DefaultTableNumber {
CronJobLogs = 21,
BackendState = 24,
ExternalPackages = 25,
VirtualTables = 26,
ScheduledJobs = 27,
FileStorage = 28,
SnapshotImports = 29,
Expand Down Expand Up @@ -179,7 +177,6 @@ impl From<DefaultTableNumber> for &'static dyn SystemTable {
DefaultTableNumber::CronJobLogs => &CronJobLogsTable,
DefaultTableNumber::BackendState => &BackendStateTable,
DefaultTableNumber::ExternalPackages => &ExternalPackagesTable,
DefaultTableNumber::VirtualTables => &VirtualTablesTable,
DefaultTableNumber::ScheduledJobs => &ScheduledJobsTable,
DefaultTableNumber::FileStorage => &FileStorageTable,
DefaultTableNumber::SnapshotImports => &SnapshotImportsTable,
Expand Down

0 comments on commit c349a71

Please sign in to comment.