XU XUv0.8.8
中文

API

#github.com/xulang-org/packages/zookeeper

import: zookeeper #github.com/xulang-org/packages/zookeeper

counts: 3 fns, 10 methods, 2 types, 0 consts, 0 ifaces

Apache ZooKeeper Distributed Coordination Driver for Xu Communicates via 4LW (Four-Letter Words) and native TCP commands.

github.com/xulang-org/packages · 0.1.1 · Install and use

struct Client

XuAPI
pub struct Client {
    pub host string
    pub port int
}

Purpose

Public struct `Client`.

Parameters

host string
host
port int
port

new_client

XuAPI
pub fn new_client(endpoint string) Client

Purpose

Construct client.

Parameters

endpoint string
endpoint (string)

Returns

Client — a value of this type

(Client) exec_4lw

XuAPI
pub fn (c Client) exec_4lw(cmd string) string

Purpose

Method on `Client`: exec 4lw. Throws on failure.

Parameters

c Client
receiver Client (value receiver)
cmd string
cmd (string)

Returns

string — result string

(Client) ruok

XuAPI
pub fn (c Client) ruok() bool

Purpose

Call `ruok` on `Client`.

Parameters

c Client
receiver Client (value receiver)

Returns

bool — true or false

(Client) stat

XuAPI
pub fn (c Client) stat() string

Purpose

Method on `Client`: read metadata. Throws on failure.

Parameters

c Client
receiver Client (value receiver)

Returns

string — result string

(Client) mntr

XuAPI
pub fn (c Client) mntr() string

Purpose

Call `mntr` on `Client`. Throws on failure.

Parameters

c Client
receiver Client (value receiver)

Returns

string — result string

struct Pool

XuAPI
pub struct Pool {
    pub client Client
    pub idle chan int
    pub max_idle int
}

Purpose

Public struct `Pool`.

Parameters

client Client
field (Client)
idle chan int
field (channel; type chan int)
max_idle int
field (int)

new_pool

XuAPI
pub fn new_pool(endpoint string, max_idle int) Pool

Purpose

Construct pool.

Parameters

endpoint string
endpoint (string)
max_idle int
max_idle (int)

Returns

Pool — a value of this type

open_pool

XuAPI
pub fn open_pool(endpoint string, max_idle int) Pool

Purpose

Open pool.

Parameters

endpoint string
endpoint (string)
max_idle int
max_idle (int)

Returns

Pool — a value of this type

(&Pool) get_conn

XuAPI
pub fn (p &Pool) get_conn() int

Purpose

Method on `&Pool`: read conn.

Parameters

p &Pool
receiver &Pool (borrow)

Returns

int — a value of this type

(&Pool) put_conn

XuAPI
pub fn (p &Pool) put_conn(fd int)

Purpose

Method on `&Pool`: put connection.

Parameters

p &Pool
receiver &Pool (borrow)
fd int
file descriptor (int)

(&Pool) ruok

XuAPI
pub fn (p &Pool) ruok() bool

Purpose

Call `ruok` on `&Pool`.

Parameters

p &Pool
receiver &Pool (borrow)

Returns

bool — true or false

(&Pool) stat

XuAPI
pub fn (p &Pool) stat() string

Purpose

Method on `&Pool`: read metadata. Throws on failure.

Parameters

p &Pool
receiver &Pool (borrow)

Returns

string — result string

(&Pool) mntr

XuAPI
pub fn (p &Pool) mntr() string

Purpose

Call `mntr` on `&Pool`. Throws on failure.

Parameters

p &Pool
receiver &Pool (borrow)

Returns

string — result string

(&Pool) close

XuAPI
pub fn (p &Pool) close()

Purpose

Method on `&Pool`: close the resource.

Parameters

p &Pool
receiver &Pool (borrow)