Documentation ¶
Index ¶
- Constants
- func NewTCPTransport(bindListener net.Listener, advertise net.Addr, maxPool int, ...) (*raft.NetworkTransport, error)
- func NewTCPTransportWithConfig(bindListener net.Listener, advertise net.Addr, ...) (*raft.NetworkTransport, error)
- func NewTCPTransportWithLogger(bindListener net.Listener, advertise net.Addr, maxPool int, ...) (*raft.NetworkTransport, error)
- type Command
- type MessageType
- type Messages
- type Node
- func (n *Node) AddRule(rule *rules.Rule) error
- func (n *Node) AddScript(script *js.Script) error
- func (n *Node) GetRule(ruleID string) *rules.Rule
- func (n *Node) GetRuleExectutions(ruleID string) []*executions.Record
- func (n *Node) GetRules() []*rules.Rule
- func (n *Node) GetScript(id string) *js.Script
- func (n *Node) GetScripts() []string
- func (n *Node) Join(nodeID, addr string) error
- func (n *Node) LeaderAddr() string
- func (n *Node) Leave(nodeID string) error
- func (n *Node) RemoveRule(ruleID string) error
- func (n *Node) RemoveScript(id string) error
- func (n *Node) Shutdown() error
- func (n *Node) Snapshot() error
- func (n *Node) Start() error
- func (n *Node) Stash(event *events.Event) error
- func (n *Node) UpdateRule(rule *rules.Rule) error
- func (n *Node) UpdateScript(script *js.Script) error
- type TCPStreamLayer
Constants ¶
const ( // RuleType denotes the rules.Rule type RuleType MessageType = 0 // ScriptType denotes the script type ScriptType = 1 // RecordType denotes the executions.Record type RecordType = 2 )
Variables ¶
This section is empty.
Functions ¶
func NewTCPTransport ¶
func NewTCPTransport( bindListener net.Listener, advertise net.Addr, maxPool int, timeout time.Duration, logOutput io.Writer, ) (*raft.NetworkTransport, error)
NewTCPTransport returns a NetworkTransport that is built on top of a TCP streaming transport layer.
func NewTCPTransportWithConfig ¶
func NewTCPTransportWithConfig( bindListener net.Listener, advertise net.Addr, config *raft.NetworkTransportConfig, ) (*raft.NetworkTransport, error)
NewTCPTransportWithConfig returns a NetworkTransport that is built on top of a TCP streaming transport layer, using the given config struct.
func NewTCPTransportWithLogger ¶
func NewTCPTransportWithLogger( bindListener net.Listener, advertise net.Addr, maxPool int, timeout time.Duration, logger *log.Logger, ) (*raft.NetworkTransport, error)
NewTCPTransportWithLogger returns a NetworkTransport that is built on top of a TCP streaming transport layer, with log output going to the supplied Logger
Types ¶
type Command ¶
type Command struct { Op string `json:"op"` // stash or evict Rule *rules.Rule `json:"rule,omitempty"` RuleID string `json:"ruleID,omitempty"` Event *events.Event `json:"event,omitempty"` ScriptID string `json:"script_id,omitempty"` Script *js.Script `json:"script,omitempty"` Record *executions.Record `json:"record,omitempty"` RecordID string `json:"record_id,omitempty"` }
Command is the container for a raft command
func (*Command) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type Messages ¶
type Messages struct { Rules map[string]*rules.Rule `json:"rules"` Records map[string]*executions.Record `json:"records"` Scripts map[string]*js.Script `json:"script"` }
Messages store entries to the underlying storage
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a raft node
func (*Node) GetRuleExectutions ¶
func (n *Node) GetRuleExectutions(ruleID string) []*executions.Record
GetRuleExectutions returns the executions for a rule
func (*Node) LeaderAddr ¶
LeaderAddr returns the http addr of the leader of the cluster. If empty, the current node is the leader
func (*Node) RemoveRule ¶
RemoveRule removes a rule from the store
func (*Node) RemoveScript ¶
RemoveScript remove a script from the db
func (*Node) UpdateRule ¶
UpdateRule updates a rule to the store
type TCPStreamLayer ¶
type TCPStreamLayer struct {
// contains filtered or unexported fields
}
TCPStreamLayer implements StreamLayer interface for plain TCP.
func (*TCPStreamLayer) Accept ¶
func (t *TCPStreamLayer) Accept() (c net.Conn, err error)
Accept implements the net.Listener interface.
func (*TCPStreamLayer) Addr ¶
func (t *TCPStreamLayer) Addr() net.Addr
Addr implements the net.Listener interface.
func (*TCPStreamLayer) Close ¶
func (t *TCPStreamLayer) Close() (err error)
Close implements the net.Listener interface.
func (*TCPStreamLayer) Dial ¶
func (t *TCPStreamLayer) Dial(address raft.ServerAddress, timeout time.Duration) (net.Conn, error)
Dial implements the StreamLayer interface.