How drhsqlite/fossil-mirror works
Main Components
• Repository Engine & Core Library:
– Located in the “src” directory, this core contains all the commands (e.g., checkin, checkout, diff, merge, branching) along with the logic for delta encoding, repository storage, and synchronization.
• Command-Line Interface (CLI):
– Fossil’s CLI calls into the core libraries and executes version control operations. Many of the “.c” files in “src” (like main.c, login.c, diff.c, merge.c, etc.) and accompanying scripts support this.
• Web Interface & HTTP/CGI Module:
– Fossil runs as its own web server and presents a web UI. Files under “src” (e.g., cgi.c, http.c, http_ssl.c) and the “www” directory (which holds various wiki pages, JSON APIs, and server configuration documents) indicate this dual usage.
• Database / Repository Storage:
• External Tools & Utilities:
– The “tools” directory includes various conversion utilities (e.g., cvs2fossil), build utilities, and scripts for maintenance and automation.
• Compatibility & Auxiliary Libraries:
– The “compat” folder provides bundled versions of third-party libraries such as zlib and Tcl, which are essential for compression and script execution functions.
Relationships and Interactions
• User Interfaces (CLI & Web UI) act as entry points that invoke corresponding commands in the core repository engine.
• The core repository engine communicates with external libraries (e.g., zlib for compression and Tcl scripts for automation/merging) that are bundled in “compat” and “autosetup” respectively.
• The “tools” and “extsrc” directories represent auxiliary components for tasks such as repository maintenance, migration, or additional scripting features.
• The web interface also exposes a REST/JSON API (as seen in the “www/json-api” folder) to support programmatic access.
Architectural Patterns and Design Principles
• Modular Monolith: Despite being a single repository, Fossil logically separates functionality into discrete modules (UI, core logic, database, and external integrations) which communicate via clear APIs.
• Self-Hosting & Integration: The architecture supports self-hosting (it serves its own web pages and documentation) so the web server component is embedded.
• Extensibility: The use of external tools and compatibility layers suggests plug-in points where additional functionality or alternative libraries can be integrated.
• Robustness via Extensive Testing: The “test” directory indicates a rigorous testing strategy, which should be noted as part of the quality assurance in the overall architecture.
Relevant Technologies
• Language & Build: Primarily C (with auxiliary Tcl scripts) and make/CMake based build configuration.
• Database: Embedded SQLite (implied by the README) for repository storage.
• Libraries: zlib (for compression), Tcl (for scripting), and potentially CSS/JS for the web UI.
• Web Protocols: HTTP/HTTPS handling as indicated by the “http.c” and “http_ssl.c” files.
• Version Control components: Core command handlers for operations like checkin, diff, merge, branch, as detailed in “src”.