Name the shared database module common

This commit is contained in:
2026-11-30 04:40:53 +08:00
parent 6c51e68817
commit c98b694a70
8 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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)]
+3 -3
View File
@@ -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,
};
+1 -1
View File
@@ -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,
};
+1 -1
View File
@@ -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 (
+1 -1
View File
@@ -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 (
+1 -1
View File
@@ -76,7 +76,7 @@
<text x="104" y="732" class="detail">配置由 BEDROCK_DB_CONFIG 指定。</text>
<rect x="84" y="821" width="452" height="75" rx="9" fill="#e0eee0" stroke="#8eaf98"/>
<text x="104" y="847" class="headline">在已有 PostgreSQL 数据库内初始化</text>
<text x="104" y="869" class="detail">postgres.rs 提供 SQL,store.rs 在事务里执行。</text>
<text x="104" y="869" class="detail">postgres.rs 提供 SQL,common.rs 在事务里执行。</text>
<text x="104" y="887" class="detail">创建 Bedrock 表并登记 production 部署。</text>
<text x="328" y="787" class="detail">进入 Store::initialize()</text>
<text x="118" y="909" class="result">成功</text>

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB