From c98b694a70bb1ec41437c8cd0f1428e023cfd186 Mon Sep 17 00:00:00 2001 From: Codex Bot Date: Mon, 30 Nov 2026 04:40:53 +0800 Subject: [PATCH] Name the shared database module common --- README.md | 2 +- crates/db/src/{store.rs => common.rs} | 0 crates/db/src/connection.rs | 2 +- crates/db/src/lib.rs | 6 +++--- crates/db/src/mysql.rs | 2 +- crates/db/src/postgres.rs | 2 +- crates/db/src/sqlite.rs | 2 +- deploy/bedrock-deployment.svg | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) rename crates/db/src/{store.rs => common.rs} (100%) diff --git a/README.md b/README.md index 2aaed51..37bbfcd 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Bedrock stores JSON documents in SQLite, PostgreSQL or MySQL. Each backend has i ## Storage boundaries -`db` owns the transactional document data, revisions, and snapshots used by the application. `clusters` resolves deployment settings. The `db` connection module selects the SQL driver and read endpoints. The backend modules share the connection pools and transaction implementation in `store.rs`. +`db` owns the transactional document data, revisions, and snapshots used by the application. `clusters` resolves deployment settings. The `db` connection module selects the SQL driver and read endpoints. The backend modules share the connection pools and transaction implementation in `common.rs`. Notion describes sharding online PostgreSQL block data by workspace and feeding a downstream S3 data lake from PostgreSQL changes. Bedrock currently supports selecting a configured SQL cluster and using its read replicas. Workspace sharding, S3 object storage, and data-lake ingestion are future work. [Notion's PostgreSQL sharding](https://www.notion.com/blog/sharding-postgres-at-notion) · [Notion's data lake](https://www.notion.com/blog/building-and-scaling-notions-data-lake) diff --git a/crates/db/src/store.rs b/crates/db/src/common.rs similarity index 100% rename from crates/db/src/store.rs rename to crates/db/src/common.rs diff --git a/crates/db/src/connection.rs b/crates/db/src/connection.rs index 0fa87d0..708094f 100644 --- a/crates/db/src/connection.rs +++ b/crates/db/src/connection.rs @@ -6,9 +6,9 @@ use clusters::{Address, ConfigError, DeploymentConfig, Driver, ResolvedDeploymen use thiserror::Error; use crate::{ + common::{Error as StorageError, Mutation, Reader, Revision, Snapshot, Store}, mysql::{self, MySql}, postgres, sqlite, - store::{Error as StorageError, Mutation, Reader, Revision, Snapshot, Store}, }; #[derive(Debug, Error)] diff --git a/crates/db/src/lib.rs b/crates/db/src/lib.rs index b5cb6b1..4253f53 100644 --- a/crates/db/src/lib.rs +++ b/crates/db/src/lib.rs @@ -1,17 +1,17 @@ //! Bedrock's transactional document storage for SQL databases. +mod common; mod connection; pub mod mysql; pub mod postgres; pub mod sqlite; -mod store; pub use clusters::{Address, Cluster, ConfigError, DeploymentConfig, Driver, Tls}; pub use connection::{ConnectError, Connection, ReadPreference, connect}; pub use mysql::{Lease, MySql}; -pub use store::Error as StorageError; -pub use store::{ +pub use common::Error as StorageError; +pub use common::{ Dialect, Document, Error, MYSQL_NOW, Mutation, Reader, Result, Revision, Snapshot, Store, lock_mysql_deployment, pool, }; diff --git a/crates/db/src/mysql.rs b/crates/db/src/mysql.rs index 20c3024..83c851e 100644 --- a/crates/db/src/mysql.rs +++ b/crates/db/src/mysql.rs @@ -2,7 +2,7 @@ use std::{sync::Arc, time::Duration}; -use crate::store::{ +use crate::common::{ Dialect, Error, MYSQL_NOW, Mutation, Reader, Result, Revision, Store, lock_mysql_deployment, pool, }; diff --git a/crates/db/src/postgres.rs b/crates/db/src/postgres.rs index 1164b90..d857daf 100644 --- a/crates/db/src/postgres.rs +++ b/crates/db/src/postgres.rs @@ -1,6 +1,6 @@ //! PostgreSQL connection pools and the Bedrock document layout. -use crate::store::{Dialect, Reader, Result, Store, pool}; +use crate::common::{Dialect, Reader, Result, Store, pool}; const SCHEMA: &[&str] = &[ "CREATE TABLE IF NOT EXISTS bedrock_deployments ( diff --git a/crates/db/src/sqlite.rs b/crates/db/src/sqlite.rs index 88a0592..ed338b6 100644 --- a/crates/db/src/sqlite.rs +++ b/crates/db/src/sqlite.rs @@ -1,6 +1,6 @@ //! File-backed Bedrock storage for self-hosted deployments. -use crate::store::{Dialect, Reader, Result, Store, pool}; +use crate::common::{Dialect, Reader, Result, Store, pool}; const SCHEMA: &[&str] = &[ "CREATE TABLE IF NOT EXISTS bedrock_deployments ( diff --git a/deploy/bedrock-deployment.svg b/deploy/bedrock-deployment.svg index 73c2a2c..c07065e 100644 --- a/deploy/bedrock-deployment.svg +++ b/deploy/bedrock-deployment.svg @@ -76,7 +76,7 @@ 配置由 BEDROCK_DB_CONFIG 指定。 在已有 PostgreSQL 数据库内初始化 -postgres.rs 提供 SQL,store.rs 在事务里执行。 +postgres.rs 提供 SQL,common.rs 在事务里执行。 创建 Bedrock 表并登记 production 部署。 进入 Store::initialize() 成功