{"id":16002823,"url":"https://github.com/soreing/grasp","last_synced_at":"2025-10-06T03:15:47.252Z","repository":{"id":63605921,"uuid":"569134837","full_name":"Soreing/grasp","owner":"Soreing","description":" Golang auto scaling resource pool","archived":false,"fork":false,"pushed_at":"2023-02-11T12:40:11.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T09:43:49.512Z","etag":null,"topics":["go","golang","pool","pooling","scaling"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Soreing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-11-22T06:43:36.000Z","updated_at":"2023-02-12T18:00:01.000Z","dependencies_parsed_at":"2024-06-20T00:23:47.193Z","dependency_job_id":null,"html_url":"https://github.com/Soreing/grasp","commit_stats":{"total_commits":5,"total_committers":3,"mean_commits":"1.6666666666666667","dds":0.6,"last_synced_commit":"6ecc3853541b028535d7af00aeb98d51dea6b74c"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soreing%2Fgrasp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soreing%2Fgrasp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soreing%2Fgrasp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soreing%2Fgrasp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Soreing","download_url":"https://codeload.github.com/Soreing/grasp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247274123,"owners_count":20912054,"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":["go","golang","pool","pooling","scaling"],"created_at":"2024-10-08T10:04:19.745Z","updated_at":"2025-10-06T03:15:42.210Z","avatar_url":"https://github.com/Soreing.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Resource Auto Scaling Pool\nGrasp is a resource pool which manages the creation and deletion of resources as needed after sudden increase and decrease in request for resources.\n\n## Usage\nThe resource pool can only work with objects that implement the Poolable interface. The interface defines how to release the object when it's been idle for too long.\n```golang\ntype Item struct { \n    // Some fields\n}\nfunc (i *Item) PoolRelease() {\n\tfmt.Println(\"released\")\n}\n```\n\nTo create a resource pool, you need to provide a TTL value for the maximum lifetime of idle resources, an upper limit for the number of resources in the pool, as well as a constructor that creates new Poolable resources.\n```golang\npl := NewPool(5, time.Second, func() Poolable {\n\treturn \u0026Item{/* fields or a constuctor*/}\n})\n```\n\nTo get a resource from the pool you need to request for one. The `Acquire` function returns a resource, a done function, and an error. If no errors occured,the the `done` function must be called to release the resource when it is no longer needed.\n\nIf there are idle resources, the function returns one. If there are no idle resources, one will be created up to the limit. If there are no resources available, the call blocks until a resource is freed up or the context is canceled.\n```golang\nres, done, err := pl.Acquire(context.TODO())\n```\n\nTo stop using the pool, call the `Close` function, which cleans up all the resources and waits for all in use resources to be released before returning.\n```golang\npl.Close()\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoreing%2Fgrasp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoreing%2Fgrasp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoreing%2Fgrasp/lists"}