본문으로 건너뛰기

디스패처

디스패처는 증분 정책 업데이트를 여러 인포서 인스턴스(예: 클러스터)에 전파합니다. 모든 인포서가 결국 동일한 정책을 볼 수 있도록 일관성 프로토콜(예: Raft)을 사용합니다. Casbin의 일반 API(AddPolicy, RemovePolicy 등)는 변경되지 않으며, 디스패처가 다른 노드에 업데이트를 전송합니다.

두 부분으로 구성됩니다: (1) 디스패처가 구현하는 Casbin 내부 훅, 그리고 (2) 디스패처별 설정(예: 클러스터 멤버십, 구성).

노트

디스패처는 초기화 후 변경 사항만 동기화합니다. 기존 불일치를 수정하지는 않습니다. 디스패처를 활성화하기 전에 모든 인포서를 동일한 정책(예: 동일한 DB 또는 스냅샷에서)으로 시작하세요.

사용 가능한 디스패처:

Adapter Type Author Description
Hashicorp Raft Dispatcher Raft Casbin A dispatcher based on Hashicorp Raft
KDKYG/casbin-dispatcher Raft @KDKYG A dispatcher based on Hashicorp Raft

DistributedEnforcer​

DistributedEnforcer는 디스패처와 함께 작동하도록 SyncedEnforcer를 래핑합니다.

e, _ := casbin.NewDistributedEnforcer("examples/basic_model.conf", "examples/basic_policy.csv")

Comments are powered by giscus and GitHub Discussions. They load from giscus.app and GitHub only after you click the button below.