struct Client
XuAPI
pub struct Client {
pub host string
pub port int
}用途
公开结构体 `Client`。
参数
hoststring- 主机
portint- 端口
API
#github.com/xulang-org/packages/zookeeper扩展包 `zookeeper #github.com/xulang-org/packages/zookeeper`,由模块 github.com/xulang-org/packages 提供。
github.com/xulang-org/packages · 0.1.1 · 安装与使用
struct Clientpub struct Client {
pub host string
pub port int
}公开结构体 `Client`。
host stringport intnew_clientpub fn new_client(endpoint string) Client构造 client。
endpoint stringClient — 该类型的值
(Client) exec_4lwpub fn (c Client) exec_4lw(cmd string) string`Client` 上的方法:exec4lw。失败时 throw。
c Clientcmd stringstring — 结果字符串
(Client) ruokpub fn (c Client) ruok() bool在 `Client` 上调用 `ruok`。
c Clientbool — 是否成立
(Client) statpub fn (c Client) stat() string`Client` 上的方法:读取元信息。失败时 throw。
c Clientstring — 结果字符串
(Client) mntrpub fn (c Client) mntr() string在 `Client` 上调用 `mntr`。失败时 throw。
c Clientstring — 结果字符串
struct Poolpub struct Pool {
pub client Client
pub idle chan int
pub max_idle int
}公开结构体 `Pool`。
client Clientidle chan intmax_idle intnew_poolpub fn new_pool(endpoint string, max_idle int) Pool构造 pool。
endpoint stringmax_idle intPool — 该类型的值
open_poolpub fn open_pool(endpoint string, max_idle int) Pool打开pool。
endpoint stringmax_idle intPool — 该类型的值
(&Pool) get_connpub fn (p &Pool) get_conn() int`&Pool` 上的方法:读取 conn。
p &Poolint — 该类型的值
(&Pool) put_connpub fn (p &Pool) put_conn(fd int)`&Pool` 上的方法:put连接。
p &Poolfd int(&Pool) ruokpub fn (p &Pool) ruok() bool在 `&Pool` 上调用 `ruok`。
p &Poolbool — 是否成立
(&Pool) statpub fn (p &Pool) stat() string`&Pool` 上的方法:读取元信息。失败时 throw。
p &Poolstring — 结果字符串
(&Pool) mntrpub fn (p &Pool) mntr() string在 `&Pool` 上调用 `mntr`。失败时 throw。
p &Poolstring — 结果字符串
(&Pool) closepub fn (p &Pool) close()`&Pool` 上的方法:关闭资源。
p &Pool