Observateurs
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. Tout support pour un nouveau système de messagerie devrait être mis en œuvre en tant que observateur. 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
Observateur | Type de texte | Auteur | Description |
---|---|---|---|
PostgreSQL WatcherEx | Database | @IguteChung | WatcherEx for PostgreSQL |
Redis WatcherEx | Magasin KV | Casbin | WatcherEx for Redis |
Guetteur Redis | Magasin KV | @billcobbler | Observateur pour Redis |
Observateur Etcd | Magasin KV | Casbin | Observateur pour etcd |
Guetteur TiKV | Magasin KV | Casbin | Observateur pour TiKV |
Guet de Kafka | Système de messagerie | @wgarunap | Observateur pour Apache Kafka |
Observateur NATS | Système de messagerie | Solution | Observateur pour NATS |
Guetteur ZooKeeper | Système de messagerie | Grepsr | Observateur pour Apache ZooKeeper |
NATS, RabbitMQ, GCP Pub/Sub, AWS SNS & SQS, Kafka, InMemory | Système de messagerie | @rusenask | Watcher basé sur Go Cloud Dev Kit qui fonctionne avec les principaux fournisseurs de cloud et les infrastructures auto-hébergées |
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 |
Observateur de RocketMQ | Système de messagerie | @fmyxyz | Observateur pour Apache RocketMQ |
Observateur | Type de texte | Auteur | Description |
---|---|---|---|
Adaptateur Etcd | Magasin KV | @mapleafgo | Observateur pour etcd |
Guetteur Redis | KV store | Casbin | Observateur pour Redis |
Lettuce-Based Redis Watcher | Magasin KV | Casbin | Watcher for Redis based on Lettuce) |
Guet de Kafka | Système de messagerie | Casbin | Observateur pour Apache Kafka |
Observateur | Type de texte | Auteur | Description |
---|---|---|---|
Observateur Etcd | KV store | Casbin | Observateur pour etcd |
Guetteur Redis | Magasin KV | Casbin | Observateur pour Redis |
Pub/sous-observateur | Système de messagerie | Casbin | Observateur pour Google Cloud Pub/Sub |
MongoDB Change Streams Watcher | Base de données | Casbin | Watcher for MongoDB Change Streams |
Observateur de Postgres | Database | @mcollina | Observateur pour PostgreSQL |
Observateur | Type de texte | Auteur | Description |
---|---|---|---|
Observateur Etcd | KV store | Casbin | Observateur pour etcd |
Guetteur Redis | Magasin KV | Casbin | Observateur pour Redis |
Redis Watcher | Magasin KV | ScienceLogique | Watcher for Redis |
Redis Async Watcher | KV store | @kevinkelin | Watcher for Redis |
Observateur PostgreSQL | Database | Casbin | Observateur pour PostgreSQL |
Observateur Lapin MQ | Système de messagerie | Casbin | Observateur pour LapinsMQ |
Observateur | Type de texte | Auteur | Description |
---|---|---|---|
Guetteur Redis | Magasin KV | @Sbou | Observateur pour Redis |
Observateur | Type de texte | Auteur | Description |
---|---|---|---|
Guetteur Redis | KV store | CasbinRuby | Observateur pour Redis |
RabbitMQ Watcher | Messaging system | CasbinRuby | Watcher for RabbitMQ |
Observateur | Type de texte | Auteur | Description |
---|---|---|---|
Guetteur Redis | KV store | @Tinywan | Watcher for Redis |
format@@0 WatcherEx
Afin de prendre en charge la synchronisation incrémentale entre plusieurs instances, nous fournissons l'interface WatcherEx
. Nous espérons qu'il pourra notifier d'autres instances lorsque la politique changera, mais il n'y a actuellement aucune implémentation de WatcherEx
. Nous vous recommandons d'utiliser le répartiteur pour y parvenir.
Comparé à l'interface Watcher
, WatcherEx
peut distinguer quel type d'action de mise à jour est reçu, e. ., AddPolicy
et RemovePolicy
.
Application WatcherEx :
API | Description |
---|---|
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. Un callback classique est Enforcer.LoadPolicy(). |
Update() error | Update calls the update callback of other instances to synchronize their policy. Il est généralement appelé après avoir changé la politique dans DB, comme Enforcer.SavePolicy(), Enforcer.AddPolicy(), Enforcer.RemovePolicy(), etc. |
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. Il est appelé après qu'une politique est ajoutée via Enforcer.AddPolicy(), Enforcer.AddNamedPolicy(), Enforcer.AddGroupingPolicy() et Enforcer.AddNamedGroupingPolicy(). |
UpdateForRemovePolicy(sec, ptype string, params ...string) error | UPdateForRemovePolicy calls the update callback of other instances to synchronize their policy. Il est appelé après qu'une politique est supprimée par Enforcer.RemovePolicy(), Enforcer.RemoveNamedPolicy(), Enforcer.RemoveGroupingPolicy() et Enforcer.RemoveNamedGroupingPolicy(). |
UpdateForRemoveFilteredPolicy(sec, ptype string, fieldIndex int, fieldValues ...string) error | UpdateForRemoveFilteredPolicy calls the update callback of other instances to synchronize their policy. Il est appelé après Enforcer.RemoveFilteredPolicy(), Enforcer.RemoveFilteredNamedPolicy(), Enforcer.RemoveFilteredGroupingPolicy() et Enforcer.RemoveFilteredNamedNamedPolicy(). |
UpdateForSavePolicy(model model.Model) error | UpdateForSavePolicy calls the update callback of other instances to synchronize their policy. Il est appelé après Enforcer.SavePolicy() |
UpdateForAddPolicies(sec string, ptype string, rules ...[]string) error | UpdateForAddPolicies calls the update callback of other instances to synchronize their policy. Il est appelé après Enforcer.AddPolicies(), Enforcer.AddNamedPolicies(), Enforcer.AddGroupingPolicies() et Enforcer.AddNamedGroupingPolicies(). |
UpdateForRemovePolicies(sec string, ptype string, rules ...[]string) error | UpdateForRemovePolicies calls the update callback of other instances to synchronize their policy. Il est appelé après Enforcer.RemovePolicies(), Enforcer.RemoveNamedPolicies(), Enforcer.RemoveGroupingPolicies() et Enforcer.RemoveNamedGroupingPolicies(). |