Skip to content

Commit 6b14a2f

Browse files
authored
refactor: rename sync core and export s3 boundaries (#15)
1 parent 635c6bd commit 6b14a2f

38 files changed

Lines changed: 3738 additions & 37 deletions

Cargo.lock

Lines changed: 13 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[workspace]
22
members = [
33
"apps/convex-sync",
4-
"crates/convex-cdc-core",
5-
"crates/convex-target-s3",
4+
"crates/convex-sync-core",
5+
"crates/convex-export-s3",
66
]
77
resolver = "2"
88

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ extraction model:
2424
flowchart TD
2525
Root[convex-streaming-olap-export]
2626
CLI[apps/convex-sync]
27-
Core[crates/convex-cdc-core]
28-
S3[crates/convex-target-s3]
27+
Core[crates/convex-sync-core]
28+
S3[crates/convex-export-s3]
2929
AWS[platform/aws]
3030
DBS3[platform/databricks/s3]
3131
DBN[platform/databricks/native]
@@ -40,8 +40,8 @@ flowchart TD
4040
Read the repo by layer:
4141

4242
- [`apps/convex-sync/README.md`](apps/convex-sync/README.md): CLI surface and S3/export runtime commands
43-
- `crates/convex-cdc-core/`: shared Convex client, checkpoint FSM, event normalization, sync engine
44-
- `crates/convex-target-s3/`: raw parquet sink, staging materialization, S3 publish flow
43+
- `crates/convex-sync-core/`: shared Convex client, checkpoint FSM, event normalization, sync engine
44+
- `crates/convex-export-s3/`: raw parquet sink, staging materialization, S3 publish flow
4545
- [`platform/aws/README.md`](platform/aws/README.md): AWS assets for publishing and downstream readers
4646
- [`platform/databricks/README.md`](platform/databricks/README.md): Databricks target family overview
4747
- [`platform/databricks/s3/README.md`](platform/databricks/s3/README.md): Databricks consuming the S3 export path

apps/convex-sync/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ path = "src/main.rs"
1111

1212
[dependencies]
1313
clap.workspace = true
14-
convex-cdc-core = { path = "../../crates/convex-cdc-core" }
15-
convex-target-s3 = { path = "../../crates/convex-target-s3" }
14+
convex-sync-core = { path = "../../crates/convex-sync-core" }
15+
convex-export-s3 = { path = "../../crates/convex-export-s3" }
1616
dotenvy.workspace = true
1717
tokio.workspace = true
1818
url.workspace = true

apps/convex-sync/src/main.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@ use std::{
55
};
66

77
use clap::{Args, Parser, Subcommand};
8-
use convex_cdc_core::{
8+
use convex_export_s3::{
9+
publish::{publish_staging_to_s3, PublishS3Options},
10+
service::{run_service, RunOptions},
11+
sink::parquet::ParquetRawChangeLogWriter,
12+
staging::materialize::{MaterializeStagingOptions, StagingMaterializer},
13+
};
14+
use convex_sync_core::{
915
config::{ConvexConnectionConfig, OutputConfig, OutputFormat},
1016
convex::{client::ConvexClient, schemas::JsonSchemasQuery},
1117
errors::AppResult,
1218
model::schema::SchemaCatalog,
19+
output::{write_jsonl_stream, write_value},
1320
state::checkpoint_store::FileCheckpointStore,
1421
sync::{
1522
delta_sync::{fetch_delta_events, DeltaSyncOptions},
@@ -18,15 +25,6 @@ use convex_cdc_core::{
1825
},
1926
telemetry::{logging, metrics},
2027
};
21-
use convex_target_s3::{
22-
publish::{publish_staging_to_s3, PublishS3Options},
23-
service::{run_service, RunOptions},
24-
sink::{
25-
jsonl::{write_jsonl_stream, write_value},
26-
parquet::ParquetRawChangeLogWriter,
27-
},
28-
staging::materialize::{MaterializeStagingOptions, StagingMaterializer},
29-
};
3028
use url::Url;
3129

3230
const CLI_VERSION: &str = match option_env!("CONVEX_SYNC_VERSION") {
@@ -246,7 +244,7 @@ async fn handle_snapshot(client: &ConvexClient, args: SnapshotArgs) -> AppResult
246244
let mut writer = open_writer(&output)?;
247245
if args.raw {
248246
let response = client
249-
.list_snapshot(&convex_cdc_core::convex::snapshot::ListSnapshotQuery {
247+
.list_snapshot(&convex_sync_core::convex::snapshot::ListSnapshotQuery {
250248
snapshot: args.snapshot,
251249
cursor: args.cursor,
252250
table_name: args.table_name,
@@ -287,7 +285,7 @@ async fn handle_deltas(client: &ConvexClient, args: DeltasArgs) -> AppResult<()>
287285
let mut writer = open_writer(&output)?;
288286
if args.raw {
289287
let response = client
290-
.document_deltas(&convex_cdc_core::convex::deltas::DocumentDeltasQuery {
288+
.document_deltas(&convex_sync_core::convex::deltas::DocumentDeltasQuery {
291289
cursor: args.cursor,
292290
table_name: args.table_name,
293291
})
@@ -394,10 +392,10 @@ async fn load_schema_catalog(client: &ConvexClient) -> AppResult<SchemaCatalog>
394392

395393
fn build_client(connection: &ConnectionArgs) -> AppResult<ConvexClient> {
396394
let deployment_url = connection.deployment_url.clone().ok_or(
397-
convex_cdc_core::errors::AppError::MissingRequiredConfig("CONVEX_DEPLOYMENT_URL"),
395+
convex_sync_core::errors::AppError::MissingRequiredConfig("CONVEX_DEPLOYMENT_URL"),
398396
)?;
399397
let deploy_key = connection.deploy_key.clone().ok_or(
400-
convex_cdc_core::errors::AppError::MissingRequiredConfig("CONVEX_DEPLOY_KEY"),
398+
convex_sync_core::errors::AppError::MissingRequiredConfig("CONVEX_DEPLOY_KEY"),
401399
)?;
402400
ConvexClient::new(ConvexConnectionConfig::new(deployment_url, deploy_key)?)
403401
}

crates/convex-export-s3/Cargo.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[package]
2+
name = "convex-export-s3"
3+
edition.workspace = true
4+
license.workspace = true
5+
publish.workspace = true
6+
version = "0.0.1"
7+
8+
[lib]
9+
name = "convex_export_s3"
10+
path = "src/lib.rs"
11+
12+
[dependencies]
13+
arrow-array.workspace = true
14+
arrow-schema.workspace = true
15+
aws-config.workspace = true
16+
aws-sdk-s3.workspace = true
17+
convex-sync-core = { path = "../convex-sync-core" }
18+
hex.workspace = true
19+
parquet.workspace = true
20+
serde.workspace = true
21+
serde_json.workspace = true
22+
sha2.workspace = true
23+
tokio.workspace = true
24+
tracing.workspace = true
25+
url.workspace = true
26+
walkdir.workspace = true

crates/convex-export-s3/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pub mod publish;
2+
pub mod service;
3+
pub mod sink;
4+
pub mod staging;

0 commit comments

Comments
 (0)