diff --git a/Cargo.lock b/Cargo.lock
index b23b241..55805f1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -159,8 +159,8 @@ name = "db_connection"
version = "0.1.0"
dependencies = [
"clusters",
- "persistence",
"serde_json",
+ "sql_storage",
"tempfile",
"thiserror",
"tokio",
@@ -771,15 +771,6 @@ version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
-[[package]]
-name = "persistence"
-version = "0.1.0"
-dependencies = [
- "serde_json",
- "sqlx",
- "thiserror",
-]
-
[[package]]
name = "pin-project-lite"
version = "0.2.18"
@@ -1139,6 +1130,15 @@ dependencies = [
"der",
]
+[[package]]
+name = "sql_storage"
+version = "0.1.0"
+dependencies = [
+ "serde_json",
+ "sqlx",
+ "thiserror",
+]
+
[[package]]
name = "sqlx"
version = "0.8.6"
diff --git a/Cargo.toml b/Cargo.toml
index c574d7a..baaaf58 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,7 +9,7 @@ rust-version = "1.91"
[workspace.dependencies]
clusters = { path = "crates/clusters" }
db_connection = { path = "crates/db_connection" }
-persistence = { path = "crates/persistence" }
+sql_storage = { path = "crates/sql_storage" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sqlx = { version = "0.8.6", default-features = false, features = ["any", "runtime-tokio", "tls-rustls-ring-webpki"] }
diff --git a/README.md b/README.md
index 0365b65..1bb5d2a 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,14 @@
# Bedrock storage
-Bedrock stores JSON documents in SQLite, PostgreSQL or MySQL. Each backend has its own module in the `persistence` crate. SQLite is the default and creates `bedrock.sqlite3` in the current directory on first start.
+Bedrock stores JSON documents in SQLite, PostgreSQL or MySQL. Each backend has its own module in the `sql_storage` crate. SQLite is the default and creates `bedrock.sqlite3` in the current directory on first start.
+
+## Storage boundaries
+
+`sql_storage` owns the transactional document data, revisions, and snapshots used by the application. `clusters` resolves deployment settings and `db_connection` selects the SQL driver and read endpoints.
+
+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)
+
+## Database configuration
Set `BEDROCK_DB_CONFIG` to the path of a private JSON deployment configuration to select a different cluster. For example:
diff --git a/crates/db_connection/Cargo.toml b/crates/db_connection/Cargo.toml
index 2ac602b..652c873 100644
--- a/crates/db_connection/Cargo.toml
+++ b/crates/db_connection/Cargo.toml
@@ -6,7 +6,7 @@ rust-version.workspace = true
[dependencies]
clusters.workspace = true
-persistence.workspace = true
+sql_storage.workspace = true
thiserror.workspace = true
[dev-dependencies]
diff --git a/crates/db_connection/src/lib.rs b/crates/db_connection/src/lib.rs
index 2dc78d9..123f7dd 100644
--- a/crates/db_connection/src/lib.rs
+++ b/crates/db_connection/src/lib.rs
@@ -3,11 +3,11 @@
use std::sync::atomic::{AtomicUsize, Ordering};
pub use clusters::{Address, Cluster, ConfigError, DeploymentConfig, Driver, Tls};
-pub use persistence::mysql::{Lease, MySql};
-pub use persistence::{Document, Error as StorageError, Mutation, Revision, Snapshot};
+pub use sql_storage::mysql::{Lease, MySql};
+pub use sql_storage::{Document, Error as StorageError, Mutation, Revision, Snapshot};
use clusters::ResolvedDeployment;
-use persistence::{Reader, Store, mysql, postgres, sqlite};
+use sql_storage::{Reader, Store, mysql, postgres, sqlite};
use thiserror::Error;
#[derive(Debug, Error)]
diff --git a/crates/persistence/Cargo.toml b/crates/sql_storage/Cargo.toml
similarity index 91%
rename from crates/persistence/Cargo.toml
rename to crates/sql_storage/Cargo.toml
index 8b7ed65..09251b4 100644
--- a/crates/persistence/Cargo.toml
+++ b/crates/sql_storage/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "persistence"
+name = "sql_storage"
version = "0.1.0"
edition.workspace = true
rust-version.workspace = true
diff --git a/crates/persistence/src/lib.rs b/crates/sql_storage/src/lib.rs
similarity index 99%
rename from crates/persistence/src/lib.rs
rename to crates/sql_storage/src/lib.rs
index dedbf43..c2a1d60 100644
--- a/crates/persistence/src/lib.rs
+++ b/crates/sql_storage/src/lib.rs
@@ -1,4 +1,4 @@
-//! Shared storage contract and SQL backends for Bedrock.
+//! Bedrock's transactional document storage for SQL databases.
pub mod mysql;
pub mod postgres;
diff --git a/crates/persistence/src/mysql.rs b/crates/sql_storage/src/mysql.rs
similarity index 100%
rename from crates/persistence/src/mysql.rs
rename to crates/sql_storage/src/mysql.rs
diff --git a/crates/persistence/src/postgres.rs b/crates/sql_storage/src/postgres.rs
similarity index 100%
rename from crates/persistence/src/postgres.rs
rename to crates/sql_storage/src/postgres.rs
diff --git a/crates/persistence/src/sqlite.rs b/crates/sql_storage/src/sqlite.rs
similarity index 100%
rename from crates/persistence/src/sqlite.rs
rename to crates/sql_storage/src/sqlite.rs
diff --git a/deploy/README.md b/deploy/README.md
index b7f1139..e253b9f 100644
--- a/deploy/README.md
+++ b/deploy/README.md
@@ -6,7 +6,7 @@ Deployments pass the path of a JSON configuration file to the Bedrock executable
- **PostgreSQL** injects the Gitea Actions variable values `BEDROCK_PG_HOST`, `BEDROCK_PG_PORT`, `BEDROCK_PG_DATABASE` and `BEDROCK_PG_USER`, and the secret `BEDROCK_PG_PASSWORD`, into the deployment step. Run `python3 deploy/render-postgres.py /path/to/private/bedrock.json --deployment production`. The renderer writes a private file and does not print its contents. Mount that file for the Bedrock service and set `BEDROCK_DB_CONFIG` to the mounted path. The configured database must already exist and the server must present a trusted certificate matching the database address.
- **MySQL** accepts the same cluster shape described in the [storage configuration](../README.md) with `"driver": "mysql"` and a `mysql://` endpoint.
-Keep `BEDROCK_S3_SECRET_KEY`, `BEDROCK_S3_ENDPOINT`, and `BEDROCK_S3_ACCESS_KEY` scoped to the deployment that consumes object storage. The SQL renderer and crates have no S3 dependency.
+Keep `BEDROCK_S3_SECRET_KEY`, `BEDROCK_S3_ENDPOINT`, and `BEDROCK_S3_ACCESS_KEY` scoped to the deployment that consumes object storage. S3 integration is pending. The PostgreSQL renderer and `sql_storage` use only SQL configuration.
Pull requests currently run without an automatic storage check. The optional `ci/check-sql.sh` script uses isolated database containers and generated fixture credentials when run on an approved remote runner.
diff --git a/deploy/bedrock-deployment.svg b/deploy/bedrock-deployment.svg
index 2f62e66..ae00a0f 100644
--- a/deploy/bedrock-deployment.svg
+++ b/deploy/bedrock-deployment.svg
@@ -76,7 +76,7 @@
配置由 BEDROCK_DB_CONFIG 指定。
在已有 PostgreSQL 数据库内初始化
-postgres 模块提供 SQL,共用存储层在事务里执行。
+postgres 模块提供 SQL,sql_storage 在事务里执行。
创建 Bedrock 表并登记 production 部署。
进入 Store::initialize()
成功