Documentation ¶
Index ¶
- type Config
- type HRaftDispatcher
- func (h *HRaftDispatcher) AddPolicies(sec string, pType string, rules [][]string) error
- func (h *HRaftDispatcher) ClearPolicy() error
- func (h *HRaftDispatcher) JoinNode(serverID, serverAddress string) error
- func (h *HRaftDispatcher) RemoveFilteredPolicy(sec string, pType string, fieldIndex int, fieldValues ...string) error
- func (h *HRaftDispatcher) RemoveNode(serverID string) error
- func (h *HRaftDispatcher) RemovePolicies(sec string, pType string, rules [][]string) error
- func (h *HRaftDispatcher) Shutdown() error
- func (h *HRaftDispatcher) UpdatePolicies(sec string, pType string, oldRules, newRules [][]string) error
- func (h *HRaftDispatcher) UpdatePolicy(sec string, pType string, oldRule, newRule []string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Enforcer is a enforcer of casbin. Enforcer casbin.IDistributedEnforcer // ServerID is a unique string identifying this server for all time. ServerID string // JoinAddress is used to tells the current node to join an existing cluster. JoinAddress string // DataDir holds raft data. DataDir string // RaftListenAddress is a network address for raft server. // It should be noted that we will use the port of this address plus an offset of 1 as the listen address of the HTTP server. // If set to 10.0.10.10:6790, the Raft server runs on 10.0.10.10:6790, the HTTP server runs on10.0.10.10:6791. RaftListenAddress string // TLSConfig is used to configure a TLS server and client. // You have to provide a peer certificate. // We recommend using cfssl tool to create this certificates. TLSConfig *tls.Config }
Config holds dispatcher config.
type HRaftDispatcher ¶
type HRaftDispatcher struct {
// contains filtered or unexported fields
}
HRaftDispatcher implements the persist.Dispatcher interface.
func NewHRaftDispatcher ¶
func NewHRaftDispatcher(config *Config) (*HRaftDispatcher, error)
NewHRaftDispatcher returns a HRaftDispatcher.
func (*HRaftDispatcher) AddPolicies ¶
func (h *HRaftDispatcher) AddPolicies(sec string, pType string, rules [][]string) error
AddPolicies implements the persist.Dispatcher interface.
func (*HRaftDispatcher) ClearPolicy ¶
func (h *HRaftDispatcher) ClearPolicy() error
ClearPolicy implements the persist.Dispatcher interface.
func (*HRaftDispatcher) JoinNode ¶
func (h *HRaftDispatcher) JoinNode(serverID, serverAddress string) error
JoinNode joins a node to the current cluster.
func (*HRaftDispatcher) RemoveFilteredPolicy ¶
func (h *HRaftDispatcher) RemoveFilteredPolicy(sec string, pType string, fieldIndex int, fieldValues ...string) error
RemoveFilteredPolicy implements the persist.Dispatcher interface.
func (*HRaftDispatcher) RemoveNode ¶
func (h *HRaftDispatcher) RemoveNode(serverID string) error
JoinNode joins a node from the current cluster.
func (*HRaftDispatcher) RemovePolicies ¶
func (h *HRaftDispatcher) RemovePolicies(sec string, pType string, rules [][]string) error
RemovePolicies implements the persist.Dispatcher interface.
func (*HRaftDispatcher) Shutdown ¶
func (h *HRaftDispatcher) Shutdown() error
Shutdown is used to close the http and raft service.
func (*HRaftDispatcher) UpdatePolicies ¶
func (h *HRaftDispatcher) UpdatePolicies(sec string, pType string, oldRules, newRules [][]string) error
UpdatePolicies implements the persist.Dispatcher interface.
func (*HRaftDispatcher) UpdatePolicy ¶
func (h *HRaftDispatcher) UpdatePolicy(sec string, pType string, oldRule, newRule []string) error
UpdatePolicy implements the persist.Dispatcher interface.