agent

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2018 License: MIT Imports: 15 Imported by: 0

README

agent: use for async read pos

Documentation

Index

Constants

View Source
const (
	CMD_SET_PRO = iota // 注册客户端操作,加入到指定分组
	CMD_AUTH           // 认证(暂未使用)
	CMD_ERROR          // 错误响应
	CMD_TICK           // 心跳包
	CMD_EVENT          // 事件
	CMD_AGENT
	CMD_STOP
	CMD_RELOAD
	CMD_SHOW_MEMBERS
	CMD_POS
)
View Source
const (
	FlagSetPro = iota
	FlagPing
	FlagControl
	FlagAgent
)
View Source
const (
	Registered = 1 << iota
)

服务注册

View Source
const ServiceName = "wing-binlog-go-agent"

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentServerOption

type AgentServerOption func(s *TcpService)

func OnEvent

func OnEvent(f OnEventFunc) AgentServerOption

agent client 收到事件回调 这个回调应该来源于service_plugin/tcp 最终被转发到SendAll

func OnLeader

func OnLeader(f OnLeaderFunc) AgentServerOption

func OnPos

设置收到pos的回调函数

func OnRaw

agent client 收到一些其他的事件 原封不动转发到service_plugin/tcp SendRaw

type Config added in v1.0.4

type Config struct {
	Enable        bool   `toml:"enable"`
	Type          string `toml:"type"`
	Lock          string `toml:"lock"`
	AgentListen   string `toml:"agent_listen"`
	ConsulAddress string `toml:"consul_address"`
}

type NodeFunc

type NodeFunc func(n *tcpClientNode)

type NodeOption

type NodeOption func(n *tcpClientNode)

func NodeClose

func NodeClose(f NodeFunc) NodeOption

func NodePro

func NodePro(f NodeFunc) NodeOption

type OnEventFunc

type OnEventFunc func(table string, data []byte) bool

type OnLeaderFunc

type OnLeaderFunc func(bool)

type OnPosFunc

type OnPosFunc func(r []byte)

type OnRawFunc

type OnRawFunc func(msg []byte) bool

type TcpService

type TcpService struct {
	Address string // 监听ip
	// contains filtered or unexported fields
}

func NewAgentServer

func NewAgentServer(ctx *app.Context, opts ...AgentServerOption) *TcpService

func (*TcpService) Close

func (tcp *TcpService) Close()

func (*TcpService) ShowMembers

func (tcp *TcpService) ShowMembers() string

func (*TcpService) Start

func (tcp *TcpService) Start()

func (*TcpService) Sync added in v1.0.4

func (tcp *TcpService) Sync(data []byte)

此api提供给binlog通过agent server同步广播发送给所有的client客户端

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL