{"id":19298255,"url":"https://github.com/casbin/tikv-watcher","last_synced_at":"2025-02-24T01:13:30.715Z","repository":{"id":48609729,"uuid":"382868149","full_name":"casbin/tikv-watcher","owner":"casbin","description":"TiKV watcher for Casbin","archived":false,"fork":false,"pushed_at":"2021-07-18T08:25:06.000Z","size":44,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T12:34:34.767Z","etag":null,"topics":["abac","acl","auth","authorization","authz","casbin","go","golang","rbac","tidb","tikv","watcher"],"latest_commit_sha":null,"homepage":"https://github.com/casbin/casbin","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/casbin.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}},"created_at":"2021-07-04T14:10:43.000Z","updated_at":"2021-07-18T08:25:08.000Z","dependencies_parsed_at":"2022-09-11T03:00:26.732Z","dependency_job_id":null,"html_url":"https://github.com/casbin/tikv-watcher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin%2Ftikv-watcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin%2Ftikv-watcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin%2Ftikv-watcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin%2Ftikv-watcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casbin","download_url":"https://codeload.github.com/casbin/tikv-watcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240202024,"owners_count":19764256,"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":["abac","acl","auth","authorization","authz","casbin","go","golang","rbac","tidb","tikv","watcher"],"created_at":"2024-11-09T23:07:24.576Z","updated_at":"2025-02-24T01:13:30.664Z","avatar_url":"https://github.com/casbin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TiKV Watcher\n\n[![Go](https://github.com/casbin/tikv-watcher/actions/workflows/go.yml/badge.svg)](https://github.com/casbin/tikv-watcher/actions/workflows/go.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/casbin/tikv-watcher)](https://goreportcard.com/report/github.com/casbin/tikv-watcher)\n[![Go Reference](https://pkg.go.dev/badge/github.com/casbin/tikv-watcher.svg)](https://pkg.go.dev/github.com/casbin/tikv-watcher)\n\nTiKV Watcher is the [TiKV](https://github.com/tikv/tikv) watcher for Casbin. With this library, Casbin can synchronize the policy with the TiKV database in multiple enforcer instances.\n\n*Note: Considering that TiKV doesn't have watch mechanism like etcd or channel like Redis, this ugly implementation uses polling to achieve monitoring a certain key, which may cause some performance trouble*\n\n### Installation:\n\n```shell\ngo get github.com/casbin/tikv-watcher\n```\n\n### Single Example:\n\nstart the TiKV service before run this example:\n\n```golang\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\twatcher \"github.com/casbin/tikv-watcher\"\n\tcasbin \"github.com/casbin/casbin/v2\"\n)\n\nfunc main() {\n\te, _ := casbin.NewEnforcer(\"examples/rbac_model.conf\", \"examples/rbac_policy.csv\")\n\tw, err := watcher.NewWatcher(\n\t\t\"testkey\",\n\t\t100*time.Millisecond,\n\t\t\"127.0.0.1:2379\",\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t\treturn\n\t}\n\te.SetWatcher(w)\n\tw.SetUpdateCallback(\n\t\tfunc(s string) {\n\t\t\tfmt.Println(\"===================get\" + s)\n\t\t},\n\t)\n\te.SavePolicy()\n\ttime.Sleep(10 * time.Second)\n\n}\n\n\n```\n\n### License:\n\nThis project is under Apache 2.0 License. See the LICENSE file for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasbin%2Ftikv-watcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasbin%2Ftikv-watcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasbin%2Ftikv-watcher/lists"}