Expand description
§Core HTTP API
This module provides the main HTTP API for the Guts node, including:
- Git Smart HTTP Protocol: Standard Git endpoints for clone, push, and pull
- Repository Management: CRUD operations for repositories
- Health Checks: Comprehensive liveness, readiness, and startup probes
- Metrics: Prometheus metrics endpoint
§Endpoint Overview
| Method | Path | Description |
|---|---|---|
| GET | /health | Overall health status |
| GET | /health/live | Liveness probe |
| GET | /health/ready | Readiness probe |
| GET | /health/startup | Startup probe |
| GET | /metrics | Prometheus metrics |
| GET | /api/repos | List all repositories |
| POST | /api/repos | Create a new repository |
| GET | /api/repos/{owner}/{name} | Get repository details |
| GET | /git/{owner}/{name}/info/refs | Git reference advertisement |
| POST | /git/{owner}/{name}/git-upload-pack | Git fetch/clone |
| POST | /git/{owner}/{name}/git-receive-pack | Git push |
§Git Smart HTTP Protocol
The node implements Git’s Smart HTTP protocol, enabling standard Git clients to interact with repositories:
# Clone a repository
git clone http://localhost:8080/git/alice/myrepo
# Push changes
git push origin main
# Fetch updates
git fetch origin§Application State
All handlers share an AppState containing:
repos: Repository storage (Git objects and refs)collaboration: Pull requests, issues, comments storageauth: Organizations, teams, permissions storagep2p: Optional P2P manager for network replicationrealtime: Event hub for WebSocket real-time updates
§Error Handling
Errors are returned as JSON with appropriate HTTP status codes:
{
"error": "repository not found: alice/myrepo"
}| Status | Meaning |
|---|---|
| 404 | Repository not found |
| 409 | Repository already exists |
| 422 | Validation error |
| 500 | Internal server error |
Structs§
- AppState
- Application state shared across handlers.
- Create
Repo Request - Request to create a repository.
- Repo
Info - Repository info for listing.
- Repo
Store - Re-export RepoStore for external use. Global repository store.
Enums§
- ApiError
- API error type.
Functions§
- create_
router - Creates the API router with health state.