How yixiaojiu/kimika works
Main Components
• CLI Client (kimika): This crate handles parsing user input, configuration (see the config directory), and the initiation of sending, receiving, and requesting file transfers. It comprises submodules like:
– send (local and remote sending logic)
– receive (handling local and remote receipt of data)
– request (managing the handshake and initiation of transfers, including over UDP)
– server (acting as a coordinator for incoming file requests or notifications)
– utils (helper functions for command-line parsing with clap, terminal UI with crossterm, etc.)
• Server (kimika-server): This is the backend service that manages transfer operations via gRPC. Its components include:
– service layer modules for various API endpoints (e.g., get_metadata, post_upload, post_download, post_register, etc.)
– utilities to support HTTP/hyper integration and type definitions.
• Infrastructure/External Services:
– gRPC: Used as the communication protocol between the CLI and the server.
Relationships and Interactions
• Interaction for local network transfers: indicate the path where the CLI directly communicates with local receivers.
• In the server component, display the different service functions (get_metadata, post_upload, etc.) as submodules that process incoming gRPC messages.
Architectural Patterns and Design Principles
• Modularity: Both main crates are organized into clear submodules. The services in kimika-server are decomposed into several components, which aids testing and maintainability.
• Separation of Concerns: The client handles command line interaction and file/request management while the server focuses on processing transfers and coordinating metadata.
• gRPC as a Core Communication Mechanism: Show this as a central conduit between the CLI and the server.
• Use of Rust’s Cargo workspaces: Although not explicitly a workspace, the project uses multiple Cargo.toml files indicating separation into independent but related crates.
Relevant Technologies and Libraries
• Rust: The language overall.
• tonic (based on gRPC): Mention this as the library facilitating remote procedure calls.
• clap: For CLI and command-line argument processing.
• crossterm: For enhancing terminal UI interactions.
• Other standard libraries for networking and file operations in Rust.