garbagetruck

Crates.iogarbagetruck
lib.rsgarbagetruck
version0.1.4
created_at2025-06-01 09:55:00.377589+00
updated_at2025-06-10 06:02:08.356782+00
descriptionA lease-based garbage collection sidecar for distributed systems with persistent storage and recovery
homepagehttps://github.com/ronantakizawa/garbagetruck
repositoryhttps://github.com/ronantakizawa/garbagetruck
max_upload_size
id1697012
size673,955
Ronan Takizawa (ronantakizawa)

documentation

https://docs.rs/garbagetruck

README

GarbageTruck: Garbage Collection for Microservice Architectures

A high-performance, lease-based distributed garbage collection system for microservices, built with Rust and gRPC. This sidecar service automatically manages the lifecycle of temporary files, preventing the generation of orphaned data and reducing infrastructure costs.

Screenshot 2025-05-30 at 12 44 26 PM

The Problem it Solves

In modern apps with multiple services, temporary files, cache entries, and database records get "orphaned" where nobody remembers to clean them up, so they pile up forever. GarbageTruck acts like a smart janitor for your system. It hands out time-limited "leases" to services for the resources they create. If a service crashes or fails to renew the lease, the associated resources are automatically reclaimed.

Without GarbageTruck:
User uploads a file → Processing service crashes → File remains forever
Result: Disk fills up with abandoned files

With GarbageTruck:
User uploads a file → Service receives a 1-hour lease → Service crashes → File is auto-deleted after 1 hour
Result: Clean system, no orphaned resources

Demo Video: https://youtu.be/ZN6iy99wens

🚀 Quick Start

Prerequisites

  • Rust 1.75+
  • Protocol Buffers compiler (protoc)
  • grpcurl (for testing)

Installation

  1. Add GarbageTruck to your project
# For using the client library in your application
cargo add garbagetruck

# For CLI tools only
cargo install garbagetruck --features client

# For server deployment  
cargo install garbagetruck --features "client,server"

Or add to your Cargo.toml:

[dependencies]
garbagetruck = "0.1.0"
  1. Start the server locally
garbagetruck-server
  1. Start the service via Docker-Compose (Includes Prometheus, and Grafana Support)
git clone https://github.com/ronantakizawa/garbagetruck.git
cd garbagetruck
cargo build --release --features "client,server"
docker-compose up --build

Basic Testing

1. Install CLI (Mac / Linux)

garbagetruck --help

2. Run gRPC Health Check

garbagetruck health 

3. Enter basic lease

garbagetruck lease create --object-id "user-session" --object-type websocket-session --duration 3600

4. List leases

garbagetruck lease list --limit 20

gRPC Functionality Testing

1. Start server

garbagetruck-server

2. Run gRPC Tests

cargo test --features grpc

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Commit count: 79

cargo fmt