{"id":21095095,"url":"https://github.com/dan-and-dna/singleinst","last_synced_at":"2026-05-08T11:34:43.954Z","repository":{"id":109621161,"uuid":"564837365","full_name":"DAN-AND-DNA/singleinst","owner":"DAN-AND-DNA","description":"Some single instance modules","archived":false,"fork":false,"pushed_at":"2022-11-17T14:47:53.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T07:11:41.870Z","etag":null,"topics":["gin","grpc","microservices","modules","restful-api","single-instance","singleinstance"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DAN-AND-DNA.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":"2022-11-11T16:06:23.000Z","updated_at":"2022-11-11T17:12:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"bc7d9e14-4ab8-4981-ac29-e4c9172e807d","html_url":"https://github.com/DAN-AND-DNA/singleinst","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DAN-AND-DNA/singleinst","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAN-AND-DNA%2Fsingleinst","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAN-AND-DNA%2Fsingleinst/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAN-AND-DNA%2Fsingleinst/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAN-AND-DNA%2Fsingleinst/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DAN-AND-DNA","download_url":"https://codeload.github.com/DAN-AND-DNA/singleinst/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAN-AND-DNA%2Fsingleinst/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32778750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["gin","grpc","microservices","modules","restful-api","single-instance","singleinstance"],"created_at":"2024-11-19T22:22:35.260Z","updated_at":"2026-05-08T11:34:43.926Z","avatar_url":"https://github.com/DAN-AND-DNA.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# singleinst\n[中文文档](./README_cn.md)\nSome single instance modules\n\n##  example\n\n- [KVStore](https://github.com/DAN-AND-DNA/singleinst-examples)  \n- [network](https://github.com/DAN-AND-DNA/singleinst/tree/main/modules/network/internal)\n \n## usage\n\n1. [Implementation of a single instance module](https://github.com/DAN-AND-DNA/singleinstmodule)  \n2. ModuleCore represents the core of the module, i.e. the data part, either from configuration or pure memory data\n3. Module represents the runtime of the module. \n4. when the ModuleCore changes, you need to reconstruct the Module module and re-run the module\n5. ModuleLock means locking the ModuleCore to provide external access, ModuleUnlock means unlocking it, which usually notifies the module manager to reconstruct and restart the module, then ModuleRestart is called to rebuild and restart the module runtime.\n6. the module manager will automatically run the function starting with ModuleRun, which means run the module\n7. After creating the module, you need to register it to the module manager to manage the life cycle, refer to [network](https://github.com/DAN-AND-DNA/singleinst/tree/main/modules/network/internal)\n\n```golang\n// module runtime\ntype Module interface {\n\tModuleConstruct()\n\tModuleDestruct() \n\tModuleLock() ModuleCore\n\tModuleUnlock()\n}\n\ntype ModuleCanRestart interface {\n\tModuleRestart() bool // for module\n}\n\ntype ModuleCanBeforeRun interface {\n\tModuleBeforeRun(string) // for run\n}\n\ntype ModuleCanAfterRun interface {\n\tModuleAfterRun(string) // for run\n}\n\ntype ModuleCanShutdown interface {\n\tModuleShutdown() // for run\n}\n\ntype ModuleCanAfterRestart interface {\n\tAfterRestart()\n}\n\n// module data\ntype ModuleCore interface {\n\tLock()\n\tUnlock()\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdan-and-dna%2Fsingleinst","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdan-and-dna%2Fsingleinst","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdan-and-dna%2Fsingleinst/lists"}