Documentation ¶
Index ¶
- Variables
- func UseEtcdOpts(opts ...optparams.Option[clientv3.Config]) optparams.Option[Options]
- func WithAutoSyncInterval(iterval int) optparams.Option[clientv3.Config]
- func WithDialKeepAliveTime(alivetime int) optparams.Option[clientv3.Config]
- func WithDialKeepAliveTimeout(timeout int) optparams.Option[clientv3.Config]
- func WithDialTimeout(timeout int) optparams.Option[clientv3.Config]
- func WithEndpoints(endpoints ...string) optparams.Option[clientv3.Config]
- func WithEtcdConfig(conf *clientv3.Config) optparams.Option[Options]
- func WithMaxCallRecvMsgSize(size int) optparams.Option[clientv3.Config]
- func WithMaxCallSendMsgSize(size int) optparams.Option[clientv3.Config]
- func WithParallelCallback() optparams.Option[Options]
- func WithPassword(pwd string) optparams.Option[clientv3.Config]
- func WithPermitWithoutStream() optparams.Option[clientv3.Config]
- func WithQueryTimeout(timeout time.Duration) optparams.Option[Options]
- func WithRejectOldCluster() optparams.Option[clientv3.Config]
- func WithUsername(username string) optparams.Option[clientv3.Config]
- type Callback
- type EtcdProxy
- func (proxy *EtcdProxy) Init(opts ...optparams.Option[Options]) error
- func (proxy *EtcdProxy) IsOk() bool
- func (proxy *EtcdProxy) NewCtx() (ctx context.Context, cancel context.CancelFunc)
- func (proxy *EtcdProxy) Regist(cb Callback) error
- func (proxy *EtcdProxy) SetConnect(cli *clientv3.Client) error
- type Options
Constants ¶
This section is empty.
Variables ¶
var Default = New()
Default 默认的etcd代理对象
var DefaultOptions = Options{ QueryTimeout: time.Duration(50) * time.Millisecond, }
var ErrProxyAllreadySettedClient = errors.New("代理不能重复设置客户端对象")
ErrProxyAllreadySettedClient 代理已经设置过redis客户端对象
var ErrProxyNotYetSettedClient = errors.New("代理还未设置客户端对象")
ErrProxyNotYetSettedClient 代理还未设置客户端对象
var Logger *log.Log
Functions ¶
func UseEtcdOpts ¶
UseEtcdOpts 设置etcd的连接项
func WithAutoSyncInterval ¶
WithAutoSyncInterval 设置etcd连接的最大自动同步周期 @params iterval int 最大自动同步周期,单位ms
func WithDialKeepAliveTime ¶
WithDialKeepAliveTime 设置etcd连接的拨号存活时长 @params alivetime int 拨号存活时长,单位ms
func WithDialKeepAliveTimeout ¶
WithDialKeepAliveTimeout 设置etcd连接的拨号存活超时时长 @params timeout int 拨号存活超时时长,单位ms
func WithDialTimeout ¶
WithDialTimeout 设置etcd连接的拨号超时时间 @params timeout int 拨号超时时间,单位ms
func WithEndpoints ¶
WithEndpoints 设置etcd连接的地址端点 @params endpoints ...string 地址端点
func WithEtcdConfig ¶
WithEtcdConnConfig 设置etcd的连接项 @params conf *clientv3.Config etcd的连接配置
func WithMaxCallRecvMsgSize ¶
WithMaxCallRecvMsgSize 设置etcd连接的最大接收消息大小 @params size int 最大接收消息大小,单位bytes
func WithMaxCallSendMsgSize ¶
WithMaxCallSendMsgSize 设置etcd连接的最大发送消息大小 @params size int 最大发送消息大小,单位bytes
func WithParallelCallback ¶
WithParallelCallback 设置callback并行执行
func WithPassword ¶
WithPassword 设置etcd连接的密码 @params pwd string 密码
func WithPermitWithoutStream ¶
WithPermitWithoutStream 设置etcd连接允许没有流
func WithQueryTimeout ¶
WithQueryTimeout 设置最大过期时间,单位ms @params timeout time.Duration 请求etcd的最大超时,单位ms
func WithRejectOldCluster ¶
WithRejectOldCluster 设置etcd连接拒绝旧集群