Skip to content

Commit

Permalink
adding downloadable_model and more downloadable_model python binding
Browse files Browse the repository at this point in the history
  • Loading branch information
princefr committed Jan 26, 2025
1 parent 67391cf commit 72b76bc
Show file tree
Hide file tree
Showing 17 changed files with 1,203 additions and 256 deletions.
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ members = [
xmllint = ["proj"]
gtfs = []
parser = []
downloadable = []

[dependencies]
anyhow = "1"
Expand Down Expand Up @@ -69,6 +70,8 @@ wkt = "0.10"
zip = { version = "2", default-features = false, features = ["deflate"] }
git-version = "0.3"
pyo3 = "0.23.4"
reqwest = { version = "0.12.12", features = ["json"] }
tokio = "1.43.0"

[[test]]
name = "write_netex_france"
Expand All @@ -80,3 +83,6 @@ approx = "0.5"
log = "0.4"
rust_decimal_macros = "1"
testing_logger = "0.1"
mockito = "0.31"
tokio = { version = "1.0", features = ["full", "test-util"] }
futures = "0.3"
51 changes: 51 additions & 0 deletions downloadable_model_graph.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
```mermaid
graph TD
A[DownloadableTransitModel] --> B[ModelConfig]
A --> C[NavitiaConfig]
A --> D[Downloader]
A --> E[Arc<RwLock<Model>>]
A --> F[Arc<Mutex<String>>]
subgraph Initialization
G[Start] --> H[initialize_model]
H --> I[get_remote_version]
I --> J[Navitia API]
H --> K[run_download]
K --> L[Downloader]
H --> M[ntfs::read]
end
subgraph Background Updater
N[start_background_updater] --> O[check_and_update]
O --> P[get_remote_version]
O --> Q{Version Newer?}
Q -->|Yes| R[run_download]
Q -->|No| S[Return false]
R --> T[ntfs::read]
T --> U[Atomic Model Swap]
U --> V[Version Update]
end
subgraph External Components
J -->|HTTP GET| W((Navitia Server))
L -->|Storage| X[(S3/File System)]
M --> Y[NTFS Parser]
end
subgraph Concurrency
E -.->|RwLock| Z[Thread-safe Reads]
E -.->|Write Lock| AA[Atomic Updates]
F -.->|Mutex| AB[Version Safety]
N --> AC[Tokio Spawn]
end
style A fill:#f9f,stroke:#333
style B fill:#ccf,stroke:#333
style C fill:#ccf,stroke:#333
style D fill:#cfc,stroke:#333
style J fill:#fcc,stroke:#333
style L fill:#fcc,stroke:#333
style W fill:#cff,stroke:#333
style X fill:#cff,stroke:#333
style Y fill:#cff,stroke:#333
```
Loading

0 comments on commit 72b76bc

Please sign in to comment.