Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Move photos crate under rust crates

Manav Rathi3be48b2a3377
diff --git a/.github/workflows/mobile-lint.yml b/.github/workflows/mobile-lint.yml
index 9418887468..370cce0293 100644
--- a/.github/workflows/mobile-lint.yml
+++ b/.github/workflows/mobile-lint.yml
@@ -6,7 +6,7 @@ on:
pull_request:
paths:
- "mobile/apps/photos/**"
- - "rust/photos/**"
+ - "rust/crates/photos/**"
- "rust/crates/core/**"
- "rust/crates/contacts/**"
- "rust/crates/image/**"
@@ -52,7 +52,7 @@ jobs:
esac
case "$file" in
- .github/workflows/mobile-lint.yml|mobile/apps/photos/rust_builder/*|rust/bindings/frb/photos/*|rust/photos/*|rust/crates/image/*|rust/apps/codegen/*|rust/Cargo.lock|rust/Cargo.toml)
+ .github/workflows/mobile-lint.yml|mobile/apps/photos/rust_builder/*|rust/bindings/frb/photos/*|rust/crates/photos/*|rust/crates/image/*|rust/apps/codegen/*|rust/Cargo.lock|rust/Cargo.toml)
ente_photos_rust=true
;;
esac
diff --git a/.github/workflows/mobile-packages-lint.yml b/.github/workflows/mobile-packages-lint.yml
index ad32eafa03..2277f3c4b7 100644
--- a/.github/workflows/mobile-packages-lint.yml
+++ b/.github/workflows/mobile-packages-lint.yml
@@ -7,7 +7,7 @@ on:
- "mobile/packages/**"
- "mobile/**/pubspec*.yaml"
- "mobile/**/pubspec.lock"
- - "rust/photos/**"
+ - "rust/crates/photos/**"
- "rust/bindings/frb/**"
- "rust/apps/codegen/**"
- "rust/Cargo.lock"
@@ -54,7 +54,7 @@ jobs:
- 'rust/apps/codegen/**'
- 'rust/Cargo.lock'
- 'rust/Cargo.toml'
- - 'rust/photos/**'
+ - 'rust/crates/photos/**'
- 'rust/crates/core/**/*.rs'
- 'rust/crates/contacts/**/*.rs'
workflow:
diff --git a/.github/workflows/rust-lint.yml b/.github/workflows/rust-lint.yml
index 4ab1c8f8f4..a5213620f5 100644
--- a/.github/workflows/rust-lint.yml
+++ b/.github/workflows/rust-lint.yml
@@ -10,7 +10,7 @@ on:
- "rust/crates/contacts/**"
- "rust/crates/image/**"
- "rust/bindings/wasm/ente-wasm/**"
- - "rust/photos/**"
+ - "rust/crates/photos/**"
- "rust/Cargo.lock"
- "rust/Cargo.toml"
- ".github/workflows/rust-lint.yml"
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 00f32bdb81..2f5404d23a 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -21,6 +21,6 @@ members = [
"crates/ensu/sync",
"crates/ensu/transcription",
"crates/image",
+ "crates/photos",
"e2e",
- "photos",
]
diff --git a/rust/README.md b/rust/README.md
index 5a32b80d0b..b8401a5d0b 100644
--- a/rust/README.md
+++ b/rust/README.md
@@ -35,14 +35,14 @@
β”‚ (ente_photos_rust crate) β”‚
β”‚ β”‚
β”‚ Thin app-specific #[frb] β”‚
-β”‚ wrappers for rust/photos β”‚
+β”‚ wrappers for crates/photos β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```
## Contents (this repo)
- `rust/crates/core/` (`ente-core`) - shared, pure Rust code used by clients (crypto + auth, plus small HTTP/URL helpers).
-- `rust/photos/` (`ente_photos`) - shared Photos Rust logic (motion photo, ML, image processing, vector DB).
+- `rust/crates/photos/` (`ente_photos`) - shared Photos Rust logic (motion photo, ML, image processing, vector DB).
- `rust/apps/cli/` (`ente-rs`) - Rust CLI.
- `rust/bindings/frb/ente-rust/` (`ente_rust`) - shared Flutter Rust Bridge bindings for mobile.
- `rust/bindings/frb/photos/` (`ente_photos_rust`) - Photos app-specific Flutter Rust Bridge bindings.
@@ -69,7 +69,8 @@ rust/
β”‚ β”œβ”€β”€ contacts/ # Shared contacts logic
β”‚ β”œβ”€β”€ core/ # Pure Rust shared logic (ente-core)
β”‚ β”œβ”€β”€ ensu/ # LLM chat stack
-β”‚ └── image/ # Shared image crate
+β”‚ β”œβ”€β”€ image/ # Shared image crate
+β”‚ └── photos/ # Shared Photos Rust logic
β”‚
β”œβ”€β”€ e2e/ # Rust e2e tests requiring live Museum
β”‚ β”œβ”€β”€ src/
@@ -77,14 +78,6 @@ rust/
β”‚ β”œβ”€β”€ tests/
β”‚ └── Cargo.toml
β”‚
-β”œβ”€β”€ photos/ # Shared Photos Rust logic
-β”‚ β”œβ”€β”€ src/
-β”‚ β”‚ β”œβ”€β”€ lib.rs
-β”‚ β”‚ β”œβ”€β”€ image/
-β”‚ β”‚ β”œβ”€β”€ ml/
-β”‚ β”‚ └── vector_db.rs
-β”‚ └── Cargo.toml
-β”‚
└── Cargo.toml # Rust workspace manifest
rust/bindings/uniffi/ # UniFFI bindings for core crypto/auth + ensu
@@ -98,7 +91,7 @@ rust/bindings/frb/ # Flutter Rust Bridge binding crates
β”‚ └── Cargo.toml # crate name: ente_rust
└── photos/
β”œβ”€β”€ src/
- β”‚ └── api/ # #[frb] thin wrappers over rust/photos
+ β”‚ └── api/ # #[frb] thin wrappers over rust/crates/photos
└── Cargo.toml # crate name: ente_photos_rust
rust/bindings/wasm/ente-wasm/ # WASM bindings Rust crate
@@ -151,7 +144,7 @@ wasm-pack is installed via npm as a devDependency, so `yarn install` handles it.
Used for Flutter integration. FRB is used on two crates:
- **`ente_rust`** (`rust/bindings/frb/ente-rust/`) - Shared wrappers around `ente-core`, used by multiple mobile apps (Photos, Auth, etc.)
-- **`ente_photos_rust`** (`rust/bindings/frb/photos/`) - Thin Photos-specific wrappers around `rust/photos`
+- **`ente_photos_rust`** (`rust/bindings/frb/photos/`) - Thin Photos-specific wrappers around `rust/crates/photos`
Both depend on `ente-core` and use `#[frb]` annotations to generate Dart bindings.
diff --git a/rust/bindings/frb/photos/Cargo.toml b/rust/bindings/frb/photos/Cargo.toml
index 7da7191869..6fac7d5433 100644
--- a/rust/bindings/frb/photos/Cargo.toml
+++ b/rust/bindings/frb/photos/Cargo.toml
@@ -8,7 +8,7 @@ crate-type = ["cdylib", "staticlib"]
[dependencies]
flutter_rust_bridge = "=2.12.0"
-ente_photos = { path = "../../../photos" }
+ente_photos = { path = "../../../crates/photos" }
ente_image = { path = "../../../crates/image" }
[lints.rust]
diff --git a/rust/photos/Cargo.toml b/rust/crates/photos/Cargo.toml
similarity index 97%
rename from rust/photos/Cargo.toml
rename to rust/crates/photos/Cargo.toml
index 2f67e06b36..7241a6ddc5 100644
--- a/rust/photos/Cargo.toml
+++ b/rust/crates/photos/Cargo.toml
@@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2024"
[dependencies]
-ente_image = { path = "../crates/image" }
+ente_image = { path = "../image" }
quick-xml = "0.37"
# The FRB photos bridge calls the SimSIMD symbol exported by usearch 2.21.x.
# Newer usearch releases switched that implementation to numkong symbols.
diff --git a/rust/photos/src/lib.rs b/rust/crates/photos/src/lib.rs
similarity index 100%
rename from rust/photos/src/lib.rs
rename to rust/crates/photos/src/lib.rs
diff --git a/rust/photos/src/ml/clip/image.rs b/rust/crates/photos/src/ml/clip/image.rs
similarity index 100%
rename from rust/photos/src/ml/clip/image.rs
rename to rust/crates/photos/src/ml/clip/image.rs
diff --git a/rust/photos/src/ml/clip/mod.rs b/rust/crates/photos/src/ml/clip/mod.rs
similarity index 100%
rename from rust/photos/src/ml/clip/mod.rs
rename to rust/crates/photos/src/ml/clip/mod.rs
diff --git a/rust/photos/src/ml/clip/text.rs b/rust/crates/photos/src/ml/clip/text.rs
similarity index 100%
rename from rust/photos/src/ml/clip/text.rs
rename to rust/crates/photos/src/ml/clip/text.rs
diff --git a/rust/photos/src/ml/clip/tokenizer.rs b/rust/crates/photos/src/ml/clip/tokenizer.rs
similarity index 100%
rename from rust/photos/src/ml/clip/tokenizer.rs
rename to rust/crates/photos/src/ml/clip/tokenizer.rs
diff --git a/rust/photos/src/ml/error.rs b/rust/crates/photos/src/ml/error.rs
similarity index 100%
rename from rust/photos/src/ml/error.rs
rename to rust/crates/photos/src/ml/error.rs
diff --git a/rust/photos/src/ml/face/align.rs b/rust/crates/photos/src/ml/face/align.rs
similarity index 100%
rename from rust/photos/src/ml/face/align.rs
rename to rust/crates/photos/src/ml/face/align.rs
diff --git a/rust/photos/src/ml/face/detect.rs b/rust/crates/photos/src/ml/face/detect.rs
similarity index 100%
rename from rust/photos/src/ml/face/detect.rs
rename to rust/crates/photos/src/ml/face/detect.rs
diff --git a/rust/photos/src/ml/face/embed.rs b/rust/crates/photos/src/ml/face/embed.rs
similarity index 100%
rename from rust/photos/src/ml/face/embed.rs
rename to rust/crates/photos/src/ml/face/embed.rs
diff --git a/rust/photos/src/ml/face/mod.rs b/rust/crates/photos/src/ml/face/mod.rs
similarity index 100%
rename from rust/photos/src/ml/face/mod.rs
rename to rust/crates/photos/src/ml/face/mod.rs
diff --git a/rust/photos/src/ml/face/thumbnail.rs b/rust/crates/photos/src/ml/face/thumbnail.rs
similarity index 100%
rename from rust/photos/src/ml/face/thumbnail.rs
rename to rust/crates/photos/src/ml/face/thumbnail.rs
diff --git a/rust/photos/src/ml/indexing.rs b/rust/crates/photos/src/ml/indexing.rs
similarity index 100%
rename from rust/photos/src/ml/indexing.rs
rename to rust/crates/photos/src/ml/indexing.rs
diff --git a/rust/photos/src/ml/mod.rs b/rust/crates/photos/src/ml/mod.rs
similarity index 100%
rename from rust/photos/src/ml/mod.rs
rename to rust/crates/photos/src/ml/mod.rs
diff --git a/rust/photos/src/ml/onnx.rs b/rust/crates/photos/src/ml/onnx.rs
similarity index 100%
rename from rust/photos/src/ml/onnx.rs
rename to rust/crates/photos/src/ml/onnx.rs
diff --git a/rust/photos/src/ml/pet/align.rs b/rust/crates/photos/src/ml/pet/align.rs
similarity index 100%
rename from rust/photos/src/ml/pet/align.rs
rename to rust/crates/photos/src/ml/pet/align.rs
diff --git a/rust/photos/src/ml/pet/detect.rs b/rust/crates/photos/src/ml/pet/detect.rs
similarity index 100%
rename from rust/photos/src/ml/pet/detect.rs
rename to rust/crates/photos/src/ml/pet/detect.rs
diff --git a/rust/photos/src/ml/pet/embed.rs b/rust/crates/photos/src/ml/pet/embed.rs
similarity index 100%
rename from rust/photos/src/ml/pet/embed.rs
rename to rust/crates/photos/src/ml/pet/embed.rs
diff --git a/rust/photos/src/ml/pet/mod.rs b/rust/crates/photos/src/ml/pet/mod.rs
similarity index 100%
rename from rust/photos/src/ml/pet/mod.rs
rename to rust/crates/photos/src/ml/pet/mod.rs
diff --git a/rust/photos/src/ml/pet/preprocess.rs b/rust/crates/photos/src/ml/pet/preprocess.rs
similarity index 100%
rename from rust/photos/src/ml/pet/preprocess.rs
rename to rust/crates/photos/src/ml/pet/preprocess.rs
diff --git a/rust/photos/src/ml/preprocess.rs b/rust/crates/photos/src/ml/preprocess.rs
similarity index 100%
rename from rust/photos/src/ml/preprocess.rs
rename to rust/crates/photos/src/ml/preprocess.rs
diff --git a/rust/photos/src/ml/runtime.rs b/rust/crates/photos/src/ml/runtime.rs
similarity index 100%
rename from rust/photos/src/ml/runtime.rs
rename to rust/crates/photos/src/ml/runtime.rs
diff --git a/rust/photos/src/ml/types.rs b/rust/crates/photos/src/ml/types.rs
similarity index 100%
rename from rust/photos/src/ml/types.rs
rename to rust/crates/photos/src/ml/types.rs
diff --git a/rust/photos/src/ml/vector_db.rs b/rust/crates/photos/src/ml/vector_db.rs
similarity index 100%
rename from rust/photos/src/ml/vector_db.rs
rename to rust/crates/photos/src/ml/vector_db.rs
diff --git a/rust/photos/src/motion_photo/ftyp.rs b/rust/crates/photos/src/motion_photo/ftyp.rs
similarity index 100%
rename from rust/photos/src/motion_photo/ftyp.rs
rename to rust/crates/photos/src/motion_photo/ftyp.rs
diff --git a/rust/photos/src/motion_photo/mod.rs b/rust/crates/photos/src/motion_photo/mod.rs
similarity index 100%
rename from rust/photos/src/motion_photo/mod.rs
rename to rust/crates/photos/src/motion_photo/mod.rs
diff --git a/rust/photos/src/motion_photo/xmp.rs b/rust/crates/photos/src/motion_photo/xmp.rs
similarity index 100%
rename from rust/photos/src/motion_photo/xmp.rs
rename to rust/crates/photos/src/motion_photo/xmp.rs
diff --git a/rust/photos/tests/motion_photos_assets_test.rs b/rust/crates/photos/tests/motion_photos_assets_test.rs
similarity index 96%
rename from rust/photos/tests/motion_photos_assets_test.rs
rename to rust/crates/photos/tests/motion_photos_assets_test.rs
index 10812d716f..a5fe4f47a0 100644
--- a/rust/photos/tests/motion_photos_assets_test.rs
+++ b/rust/crates/photos/tests/motion_photos_assets_test.rs
@@ -7,11 +7,11 @@ fn fixture_dir() -> Option<PathBuf> {
return Some(PathBuf::from(path).join("media/motion-photos/v1/files"));
}
- // CARGO_MANIFEST_DIR points to `<repo>/rust/photos`.
+ // CARGO_MANIFEST_DIR points to `<repo>/rust/crates/photos`.
// We resolve `<repo>/..../test-fixtures/media/motion-photos/v1/files`,
// where `test-fixtures` is expected to be a sibling of the main repo root.
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
- let repo_root = manifest_dir.parent()?.parent()?; // rust/photos -> rust -> <repo root>
+ let repo_root = manifest_dir.parent()?.parent()?.parent()?; // photos -> crates -> rust -> <repo root>
let parent_of_repo = repo_root.parent()?;
Some(
parent_of_repo