mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 15:08:24 +00:00
Archive git repositories before deletion: - Create tar.gz archives in .archive/<npub>/<identifier>-<timestamp>.tar.gz - Store metadata JSON with deletion info and expiry timestamp - Archive git data BEFORE moving events to holding database - Uses flate2 for gzip compression and tar crate for archive creation - Graceful error handling (deletion continues even if archival fails) Background cleanup task: - Spawned as tokio task in main.rs - Runs on startup (catch-up for offline periods) - Runs at configurable interval (default: 24 hours) - Deletes expired events from holding database - Removes archive tar.gz files and metadata JSON - Tracks disk space reclamation in CleanupResult Archive metadata structure: - Deletion timestamp and event ID - Maintainer pubkey and repository identifier - Archive file path for cleanup coordination - Expiry timestamp (deletion_ts + retention_secs) Tests: 21 tests covering: - Archive unit tests (8 tests) - Archive creation and compression - Extraction and integrity verification - Metadata serialization - Error handling (missing directories, corrupt data) - Cleanup unit tests (5 tests) - Expired event deletion - Archive file cleanup - Missing file handling - CleanupResult statistics - Integration tests (8 tests) - End-to-end archival workflow - Background cleanup with short retention (5 seconds) - Startup cleanup (pre-existing expired data) - Disk space reclamation verification - Multiple expired events - Preservation of non-expired events
84 lines
1.7 KiB
TOML
84 lines
1.7 KiB
TOML
[package]
|
|
name = "ngit-grasp"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
authors = ["ngit-grasp contributors"]
|
|
license = "MIT"
|
|
description = "A GRASP (Git Relays Authorized via Signed-Nostr Proofs) implementation in Rust"
|
|
repository = "https://gitworkshop.dev/ngit-grasp"
|
|
|
|
[dependencies]
|
|
# Async runtime
|
|
tokio = { version = "1.35", features = ["full"] }
|
|
|
|
# HTTP server (hyper for relay integration)
|
|
hyper = { version = "1.4", features = ["full"] }
|
|
hyper-util = { version = "0.1", features = ["tokio", "server", "http1", "http2"] }
|
|
http-body-util = "0.1"
|
|
|
|
# Nostr relay
|
|
nostr-relay-builder = { git = "https://github.com/rust-nostr/nostr", rev = "4767ad13" }
|
|
|
|
# Nostr
|
|
nostr-sdk = { git = "https://github.com/rust-nostr/nostr", rev = "4767ad13" }
|
|
nostr-lmdb = { git = "https://github.com/rust-nostr/nostr", rev = "4767ad13" }
|
|
|
|
# Utilities
|
|
futures-util = "0.3"
|
|
base64 = "0.22"
|
|
flate2 = "1.0"
|
|
tar = "0.4"
|
|
|
|
# Metrics
|
|
prometheus = "0.13"
|
|
dashmap = "5"
|
|
lazy_static = "1.4"
|
|
|
|
# Data structures
|
|
indexmap = "2"
|
|
|
|
# Random (for startup jitter)
|
|
rand = "0.8"
|
|
|
|
# Serialization
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
serde_json = "1.0"
|
|
|
|
# Logging
|
|
tracing = "0.1"
|
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
|
|
|
# Configuration
|
|
dotenvy = "0.15"
|
|
clap = { version = "4.5", features = ["derive", "env"] }
|
|
|
|
# Error handling
|
|
anyhow = "1.0"
|
|
thiserror = "1.0"
|
|
|
|
# Async traits
|
|
async-trait = "0.1"
|
|
|
|
# Git (for future use)
|
|
# git-http-backend = "0.3"
|
|
|
|
[dev-dependencies]
|
|
# Testing
|
|
tokio-test = "0.4"
|
|
grasp-audit = { path = "grasp-audit" }
|
|
url = "2.5"
|
|
tempfile = "3"
|
|
reqwest = "0.12"
|
|
walkdir = "2"
|
|
|
|
[lib]
|
|
name = "ngit_grasp"
|
|
path = "src/lib.rs"
|
|
|
|
[[bin]]
|
|
name = "ngit-grasp"
|
|
path = "src/main.rs"
|
|
|
|
[workspace]
|
|
members = [".", "grasp-audit"]
|