open
pub fn open(endpoint string) Client用途
打开。
参数
endpointstring- endpoint(string)
返回
Client — 该类型的值
API
#github.com/xulang-org/packages/etcd扩展包 `etcd #github.com/xulang-org/packages/etcd`,由模块 github.com/xulang-org/packages 提供。
github.com/xulang-org/packages · 0.1.1 · 安装与使用
openpub fn open(endpoint string) Client打开。
endpoint stringClient — 该类型的值
open_poolpub fn open_pool(endpoint string, max_idle int) Pool打开pool。
endpoint stringmax_idle intPool — 该类型的值
struct Responsepub struct Response {
pub status_code int
pub body string
}公开结构体 `Response`。
status_code intbody stringstruct Clientpub struct Client {
pub host string
pub port int
}公开结构体 `Client`。
host stringport intnew_clientpub fn new_client(endpoint string) Client构造 client。
endpoint stringClient — 该类型的值
(&mut Client) requestpub fn (c &mut Client) request(path string, body_json string) Response`&mut Client` 上的方法:请求。失败时 throw。
c &mut Clientpath stringbody_json stringResponse — 该类型的值
(&mut Client) putpub fn (c &mut Client) put(key string, value string) int在 `&mut Client` 上调用 `put`。失败时 throw。
c &mut Clientkey stringvalue stringint — 该类型的值
(&mut Client) put_with_leasepub fn (c &mut Client) put_with_lease(key string, value string, lease_id int) int`&mut Client` 上的方法:putwithlease。失败时 throw。
c &mut Clientkey stringvalue stringlease_id intint — 该类型的值
(&mut Client) getpub fn (c &mut Client) get(key string) string在 `&mut Client` 上调用 `get`。失败时 throw。
c &mut Clientkey stringstring — 结果字符串
(&mut Client) existspub fn (c &mut Client) exists(key string) bool在 `&mut Client` 上调用 `exists`。
c &mut Clientkey stringbool — 是否成立
(&mut Client) deletepub fn (c &mut Client) delete(key string) int`&mut Client` 上的方法:删除。失败时 throw。
c &mut Clientkey stringint — 该类型的值
(&mut Client) lease_grantpub fn (c &mut Client) lease_grant(ttl_seconds int) int`&mut Client` 上的方法:leasegrant。失败时 throw。
c &mut Clientttl_seconds intint — 该类型的值
(&mut Client) lease_revokepub fn (c &mut Client) lease_revoke(lease_id int) int`&mut Client` 上的方法:leaserevoke。失败时 throw。
c &mut Clientlease_id intint — 该类型的值
(&mut Client) lease_keepalivepub fn (c &mut Client) lease_keepalive(lease_id int) int`&mut Client` 上的方法:leasekeepalive。失败时 throw。
c &mut Clientlease_id intint — 该类型的值
struct Poolpub struct Pool {
pub host string
pub port int
pub endpoint string
pub state chan pool.State
pub max_idle int
}公开结构体 `Pool`。
host stringport intendpoint stringstate chan pool.Statemax_idle intnew_poolpub fn new_pool(endpoint string, max_idle int) Pool构造 pool。
endpoint stringmax_idle intPool — 该类型的值
(&Pool) getpub fn (p &Pool) get() Client在 `&Pool` 上调用 `get`。
p &PoolClient — 该类型的值
(&Pool) duppub fn (p &Pool) dup() Pool在 `&Pool` 上调用 `dup`。
p &PoolPool — 该类型的值
(&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) discard_connpub fn (p &Pool) discard_conn(fd int)`&Pool` 上的方法:丢弃连接。
p &Poolfd int(&Pool) putpub fn (p &Pool) put(key string, value string) int在 `&Pool` 上调用 `put`。失败时 throw。
p &Poolkey stringvalue stringint — 该类型的值
(&Pool) get_keypub fn (p &Pool) get_key(key string) string`&Pool` 上的方法:读取 key。失败时 throw。
p &Poolkey stringstring — 结果字符串
(&Pool) deletepub fn (p &Pool) delete(key string) int`&Pool` 上的方法:删除。失败时 throw。
p &Poolkey stringint — 该类型的值
(&Pool) existspub fn (p &Pool) exists(key string) bool在 `&Pool` 上调用 `exists`。
p &Poolkey stringbool — 是否成立
(&Pool) closepub fn (p &Pool) close()`&Pool` 上的方法:关闭资源。
p &Pool