heroforge
A pure Rust client library for reading and writing Fossil SCM repositories.
Overview
heroforge provides a complete API for interacting with Fossil repositories programmatically, without requiring the Fossil CLI to be installed. It supports both reading from existing repositories and creating new ones from scratch.
Features
Read Operations
- Open and read existing Fossil repositories
- Browse repository history and check-ins
- List and read files at any check-in
- Find files using glob patterns
- Navigate directory structures
- Access branch and tag information
Write Operations
- Create new repositories from scratch
- Commit files with full manifest generation
- Create and manage branches
- Add tags to check-ins
- Manage users and permissions
Synchronization (Optional Features)
- HTTP sync - Standard Fossil sync over HTTP/HTTPS
- TCP sync - Direct TCP connections with optional LZ4 compression
- Encrypted sync - ChaCha20-Poly1305 encryption for TCP
- QUIC sync - Modern UDP-based protocol with TLS 1.3
Installation
Add heroforge to your Cargo.toml:
[]
= "0.1"
Optional Features
Enable additional sync protocols as needed:
[]
# HTTP sync support
= { = "0.1", = ["sync-http"] }
# TCP sync with compression and encryption
= { = "0.1", = ["sync-tcp-full"] }
# QUIC sync (modern, fast)
= { = "0.1", = ["sync-quic"] }
# All features
= { = "0.1", = ["sync-http", "sync-tcp-full", "sync-quic"] }
Quick Start
Reading from an Existing Repository
use Repository;
Creating a New Repository
use Repository;
Finding Files with Glob Patterns
use Repository;
Browsing History
use Repository;
HTTP Synchronization
use Repository;
use HttpSyncClient;
Using heroforge in Your Project
As a Library Dependency
- Add to your
Cargo.toml:
[]
= "0.1"
- Import and use:
use ;
Building a CLI Tool
use Repository;
use env;
Repository Compatibility
Repositories created with heroforge are fully compatible with the Fossil CLI:
- Use
fossil uito browse repositories created by this library heroforgecan read repositories created by the Fossil CLI- Sync with remote Fossil servers works seamlessly
Feature Flags
| Feature | Description | Dependencies |
|---|---|---|
sync-http |
HTTP/HTTPS sync support | ureq |
sync-tcp |
Basic TCP sync | - |
sync-tcp-compression |
TCP with LZ4 compression | lz4_flex |
sync-tcp-encryption |
TCP with ChaCha20-Poly1305 | chacha20poly1305, rand |
sync-tcp-full |
All TCP features | compression + encryption |
sync-quic |
QUIC protocol sync | quinn, rustls, tokio |
Examples
The repository includes many examples demonstrating various features:
# Basic repository reading
# Find files with glob patterns
# Full demo with repository creation
# HTTP sync (requires sync-http feature)
# TCP sync benchmark (requires sync-tcp-full feature)
# QUIC sync (requires sync-quic feature)
Documentation
Full API documentation is available at docs.rs/heroforge.
Generate local documentation with:
Architecture
A Fossil repository is a SQLite database containing:
- Blobs: Compressed file contents and manifests (zlib)
- Manifests: Check-in metadata with file lists, timestamps, comments
- Tags: Branch names, version tags, and other labels
- Events: Timeline of repository activity
- Delta encoding: Efficient storage of similar content
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.