{"id":15056302,"url":"https://github.com/juxhindb/poolparty","last_synced_at":"2026-02-25T07:04:35.724Z","repository":{"id":245738560,"uuid":"818655844","full_name":"JuxhinDB/poolparty","owner":"JuxhinDB","description":"Supervisor library in Rust, inspired by Erlang's poolboy","archived":false,"fork":false,"pushed_at":"2024-09-19T19:46:07.000Z","size":94,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T06:13:00.501Z","etag":null,"topics":["erlang","rust","supervisor"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JuxhinDB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-22T13:17:03.000Z","updated_at":"2024-09-19T19:46:11.000Z","dependencies_parsed_at":"2024-06-23T20:24:53.799Z","dependency_job_id":"e3488038-b668-497e-aab8-6a46ddbe821e","html_url":"https://github.com/JuxhinDB/poolparty","commit_stats":null,"previous_names":["juxhindb/poolparty"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuxhinDB%2Fpoolparty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuxhinDB%2Fpoolparty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuxhinDB%2Fpoolparty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuxhinDB%2Fpoolparty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JuxhinDB","download_url":"https://codeload.github.com/JuxhinDB/poolparty/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243532562,"owners_count":20306156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["erlang","rust","supervisor"],"created_at":"2024-09-24T21:49:48.905Z","updated_at":"2026-02-25T07:04:30.684Z","avatar_url":"https://github.com/JuxhinDB.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust Worker Pool Library\n\nA Rust library for managing a pool of workers that can execute tasks concurrently. This library aims to provide a robust, scalable, and maintainable solution for managing worker lifecycles, task assignments, and error handling in a concurrent environment.\n\n## Overview\n\nEach worker operates as a state machine with defined states and transitions, ensuring predictable behavior and easy recovery from errors. It is inspired by Erlang's [poolboy](https://github.com/devinus/poolboy) library, bringing similar functionality to the Rust ecosystem. Workers are checked in/out by the supervisors depending on the task queue and their state.\n\n## Goals \n\n- **Worker Pool Management**: Dynamically manage a pool of workers.\n- **Task Queue**: Handle task assignments and maintain a queue for pending tasks.\n- **State Machine for Workers**: Define clear states and transitions for workers.\n- **Error Handling**: Robust error handling and recovery mechanisms.\n- **Graceful Shutdown**: Ensure workers can shut down gracefully, completing or canceling tasks as needed.\n- **Bi-directional Communication**: Facilitate communication between supervisor and workers.\n- **Scalable** (ambitious): Abstract communication to support distributed workers\n\n## Checklist of Features/Functionality\n\nAnything that is marked as \"complete\" is mostly just mvp/proof-of-concept.\n\n- [x] Basic Worker Pool Structure\n- [x] Task Queue Implementation\n- [x] Worker State Machine Design\n- [x] Bi-directional Communication between Supervisor and Workers\n- [x] Worker Lifecycle Management \n- [x] Error Handling and Recovery\n- [x] Graceful Shutdown Process\n- [ ] Dynamic Scaling of Worker Pool\n- [ ] Configuration Options for Pool Size and Channel Sizes\n- [x] Documentation and Examples\n\n#### Future goals\n\nThere are a couple of major changes I'd like to make if things do progress.\n\n* Refactor communication to purely rpc. This will enable remote-workers, more\n  inline with erlang's distributed, fault-tolerant, scalable systems. It will\n  also do away with existing hacks to get results propagated back to clients.\n\n* Supervisor trees. Right now we are assuming a single supervisor, with a \n  flat hierarachy of workers. This should change to effectively support a \n  supervision tree.\n\nContributions are welcome!\n\n## Usage\n\n### Example\n\n```rust\n#[derive(Debug)]\nstruct TestWorker;\n\n#[derive(Debug, Clone)]\nstruct TestTask {\n    msg: String,\n}\n\nimpl Task for TestTask {}\n\nimpl Workable for TestWorker {\n    type Task = TestTask;\n    type Output = String;\n    type Error = String;\n\n    async fn process(task: Self::Task) -\u003e Response\u003cSelf\u003e {\n        Response::Complete(Ok(format!(\"got task {task:?}\")))\n    }\n}\n\n#[tokio::main]\nasync fn main() {\n    let mut pool: Supervisor\u003cTestWorker\u003e = Supervisor::new(5);\n    let task = TestWorkerTask {\n        ctx: \"test-worker\".to_string(),\n    };\n\n    pool.enqueue(task).await;\n    pool.run().await;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuxhindb%2Fpoolparty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuxhindb%2Fpoolparty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuxhindb%2Fpoolparty/lists"}