Watchers
We support the use of distributed messaging systems like etcd to maintain consistency between multiple Casbin enforcer instances. This allows our users to concurrently use multiple Casbin enforcers to handle a large number of permission checking requests.
Similar to policy storage adapters, we do not include watcher code in the main library. 新しいメッセージングシステムのサポートは、ウォッチャーとして実装する必要があります。 A complete list of Casbin watchers is provided below. We welcome any third-party contributions for a new watcher, please inform us and we will add it to this list:)
- Go
- Java
- Node.js
- Python
- .NET
- Ruby
- PHP
Watcher | タイプ | 作成者 | 説明 |
---|---|---|---|
PostgreSQL WatcherEx | Database | @IguteChung | WatcherEx for PostgreSQL |
Redis WatcherEx | KV ストア | Casbin | WatcherEx for Redis |
Redis Watcher | KV ストア | @billcobbler | Redis のウォッチャー |
Etcd Watcher | KV ストア | Casbin | etcd の監視者 |
TiKVウォッチャー | KV ストア | Casbin | TiKV の監視人 |
Kafka Watcher | SMSシステム | @wgarunap | Apache Kafka の腕時計 |
NATS Watcher | SMSシステム | Soluto | NATS の監視人 |
ZooKeeperウォッチャー | SMSシステム | Grepsr | Apache ZooKeeper の の腕時計 |
NATS, RabbitMQ, GCP Pub/Sub, AWS SNS & SQS, Kafka, InMemory | SMSシステム | @rusenask | 主要なクラウドプロバイダーと自己ホストインフラストラクチャで動作する Go Cloud Dev Kit に基づくウォッチャー |
NATS, RabbitMQ, GCP Pub/Sub, AWS SNS & SQS, Kafka, InMemory | Messaging System | @bartventer | WatcherEx based on Go Cloud Dev Kit that works with leading cloud providers and self-hosted infrastructure |
RocketMQウォッチャー | SMSシステム | @fmyxyz | Apache RocketMQ の腕時計 |
Watcher | タイプ | 作成者 | 説明 |
---|---|---|---|
Etcd アダプター | KV ストア | @mapleafgo | etcd の監視者 |
Redis Watcher | KV store | Casbin | Redis のウォッチャー |
Lettuce-Based Redis Watcher | KV ストア | Casbin | Watcher for Redis based on Lettuce) |
Kafka Watcher | SMSシステム | Casbin | Apache Kafka の腕時計 |
Watcher | タイプ | 作成者 | 説明 |
---|---|---|---|
Etcd Watcher | KV store | Casbin | etcd の監視者 |
Redis Watcher | KV ストア | Casbin | Redis のウォッチャー |
Pub/Sub Watcher | SMSシステム | Casbin | Google Cloud Pub/Sub のウッチャー |
MongoDB Change Streams Watcher | データベース | Casbin | Watcher for MongoDB Change Streams |
Postgres Watcher | Database | @mcollina | PostgreSQL のウォッチャー |
Watcher | タイプ | 作成者 | 説明 |
---|---|---|---|
Etcd Watcher | KV store | Casbin | etcd の監視者 |
Redis Watcher | KV ストア | Casbin | Redis のウォッチャー |
Redis Watcher | KV ストア | ScienceLogic | Watcher for Redis |
Redis Async Watcher | KV store | @kevinkelin | Watcher for Redis |
PostgreSQLウォッチャー | Database | Casbin | PostgreSQL のウォッチャー |
RabbitMQ ウォッチャー | SMSシステム | Casbin | RabbitMQ の監視人 |
Watcher | タイプ | 作成者 | 説明 |
---|---|---|---|
Redis Watcher | KV ストア | @Sbou | Redis のウォッチャー |
Watcher | タイプ | 作成者 | 説明 |
---|---|---|---|
Redis Watcher | KV store | CasbinRuby | Redis のウォッチャー |
RabbitMQ Watcher | Messaging system | CasbinRuby | Watcher for RabbitMQ |
Watcher | タイプ | 作成者 | 説明 |
---|---|---|---|
Redis Watcher | KV store | @Tinywan | Watcher for Redis |
WatcherEx
複数のインスタンス間の増分同期をサポートするために、 WatcherEx
インターフェイスを提供します。 ポリシーが変更されたときに他のインスタンスに通知できることを願っていますが、 WatcherEx
の実装は現在ありません。 これを達成するためにディスパッチャを使用することをお勧めします。
Compared with Watcher
interface, WatcherEx
can distinguish what type of update action is received, e.g., AddPolicy
and RemovePolicy
.
WatcherEx Apis:
API | 説明 |
---|---|
SetUpdateCallback(func(string)) error | SetUpdateCallback sets the callback function that the watcher will call, when the policy in DB has been changed by other instances. 古典的なコールバックは Enforcer.LoadPolicy() です。 |
Update() error | Update calls the update callback of other instances to synchronize their policy. これは通常、DB 内のポリシーを変更した後に呼び出されます。例えば Enforcer.SavePolicy() や Enforcer.AddPolicy() や Enforcer.RemovePolicy() など。 |
Close() | Close stops and releases the watcher, the callback function will not be called any more. |
UpdateForAddPolicy(sec, ptype string, params ...string) error | UpdateForAddPolicy calls the update callback of other instances to synchronize their policy. これは、ポリシーがEnforcer.AddPolicy(), Enforcer.AddNamedPolicy(), Enforcer.AddGroupingPolicy(), Enforcer.AddNamedGroupingPolicy(), Enforcer.AddNamedGroupingPolicy() および Enforcer.AddNamedGroupingPolicy(). |
UpdateForRemovePolicy(sec, ptype string, params ...string) error | UPdateForRemovePolicy calls the update callback of other instances to synchronize their policy. ポリシーがEnforcer.RemovePolicy(), Enforcer.RemoveNamedPolicy(), Enforcer.RemoveGroupingPolicy() および Enforcer.RemoveNamedGroupingPolicy() によって削除された後に呼び出されます。 |
UpdateForRemoveFilteredPolicy(sec, ptype string, fieldIndex int, fieldValues ...string) error | UpdateForRemoveFilteredPolicy calls the update callback of other instances to synchronize their policy. これは、Enforcer.RemoveFilteredPolicy(), Enforcer.RemoveFilteredNamedPolicy(), Enforcer.RemoveFilteredGroupingPolicy() および Enforcer.RemoveFilteredNamedGroupingPolicy() の後に呼び出されます。 |
UpdateForSavePolicy(model model.Model) error | UpdateForSavePolicy calls the update callback of other instances to synchronize their policy. Enforcer.SavePolicy() の後に呼び出されます。 |
UpdateForAddPolicies(sec string, ptype string, rules ...[]string) error | UpdateForAddPolicies calls the update callback of other instances to synchronize their policy. これは、Enforcer.AddPolicies(), Enforcer.AddNamedPolicies(), Enforcer.AddGroupingPolicies() および Enforcer.AddNamedGroupingPolicies() の後に呼び出されます。 |
UpdateForRemovePolicies(sec string, ptype string, rules ...[]string) error | UpdateForRemovePolicies calls the update callback of other instances to synchronize their policy. これは、Enforcer.RemovePolicies(), Enforcer.RemoveNamedPolicies(), Enforcer.RemoveGroupingPolicies() および Enforcer.RemoveNamedGroupingPolicies() の後に呼び出されます。 |