moonetcd

    An etcd v3 client for MoonBit.

    etcd
    etcdv3
    client
    moonbit
    grpc
    Download zip
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    7 hours ago
    Downloads
    14

    #moonetcd

    An etcd v3 client for MoonBit — the feature surface of etcd's official Go client (clientv3), reimplemented over real gRPC.

    moonetcd speaks the etcd v3 gRPC API (etcdserverpb, mvccpb, v3lock, v3election) over HTTP/2 via moonrpc. It gives you the whole client: key-value reads and writes, transactions, watches that survive a dropped connection, leases and keep-alives, cluster and auth administration, maintenance, and the client-side concurrency helpers (sessions, mutexes, leader election).

    #Layout

    PackageContents
    moonbitstack/moonetcdProtobuf message types and codecs for the etcd v3 API, plus key helpers and the error model. Pure data — builds on every target.
    moonbitstack/moonetcd/clientThe gRPC transport: Client, KV, Watch, Lease, Cluster, Auth, Maintenance, Lock, Election. Native only.
    moonbitstack/moonetcd/concurrencySession, Mutex, Election built on the client. Native only.
    moonbitstack/moonetcd/sdThe moonsd contract on etcd: Registry. Native only.
    moonbitstack/moonetcd/examples/...Runnable examples (see below).

    The root package carries no transport, so a program on any target can decode etcd messages; the transport and the concurrency helpers open sockets and are native only.

    #Install

    moon add moonbitstack/moonetcd

    #Quick start

    async fn main {
    let config = @moonetcd.ClientConfig::{
    ..@moonetcd.default_client_config,
    endpoints: ["127.0.0.1:2379"],
    }
    let client = @client.Client::connect(config)

    let _ = client.kv().put(b"/greeting", b"hello")
    let resp = client.kv().get(b"/greeting")
    for item in resp.kvs {
    println("value = \{@utf8.decode_lossy(item.value[:])}")
    }
    client.close()
    }

    A Client dials one or more endpoints. Unary and server/client-streaming calls go through a load-balanced channel that fails over across the endpoints; a Watch or a Lease KeepAlive opens its own multiplexed connection so it can reconnect on its own.

    #API surface

    Client hands out one typed handle per etcd service.

    #KV — client.kv()

    MethodRPC
    put(key, value, lease?, prev_kv?)Put
    get(key), get_prefix(prefix)Range
    range(RangeRequest)Range
    delete_range(DeleteRangeRequest)DeleteRange
    txn(TxnRequest)Txn
    compact(revision, physical?)Compact

    RangeRequest carries every lever of the gRPC message — range_end, limit, revision, sort_order, sort_target, serializable, keys_only, count_only, and the four min/max revision bounds.

    #Watch — client.watch()

    watch_create(task_group, WatchCreateRequest) opens a bidi stream on its own multiplexed channel and returns a WatchChan. WatchChan::next() blocks until the next WatchResponse (or None once cancelled). If the stream drops — a failed member, a network blip — it reconnects to the next configured endpoint and re-issues the create with start_revision set just past the last event it saw, so no event is lost. A WatchResponse with a non-zero compact_revision means the requested revision was compacted; check it on the response.

    @async.with_task_group <| g => {
    let chan = client.watch().watch_create(
    g,
    @moonetcd.WatchCreateRequest::{ ..@moonetcd.WatchCreateRequest::empty(), key: b"/watched" },
    )
    match chan.next() {
    Some(resp) => println("revision \{resp.header.revision}, \{resp.events.length()} event(s)")
    None => println("watch ended")
    }
    chan.cancel()
    }

    The task group drives the channel's read pump, so a watch (and a keep-alive) must open inside @async.with_task_group.

    #Lease — client.lease()

    MethodRPC
    grant(ttl, id?)LeaseGrant
    revoke(id)LeaseRevoke
    time_to_live(id, keys?)LeaseTimeToLive
    leases()LeaseLeases
    keep_alive(task_group)LeaseKeepAlive (bidi)

    KeepAlive is a bidi stream: keep_alive(id) sends a keep-alive request, next() reads the acknowledgement, close() ends it. Attach a key to a lease by passing lease = lease_id to KV::put.

    #Cluster — client.cluster()

    member_add(peer_urls, is_learner?), member_remove(id), member_update(id,peer_urls), member_list(linearizable?), member_promote(id).

    #Auth — client.auth()

    enable(), disable(), status(), user_add, user_delete, user_change_password, user_grant_role, user_revoke_role, user_get, user_list, role_add, role_delete, role_grant_permission, role_revoke_permission, role_get, role_list.

    When a ClientConfig carries a username and password, Client::connect authenticates and injects the returned token as the token metadata header on every call.

    #Maintenance — client.maintenance()

    status(), alarm(action, member_id, alarm), defragment(), move_leader(target_id), snapshot(). snapshot() returns the snapshot blobs as a Array[SnapshotResponse]; the transport collects the stream, so a large snapshot is held in memory.

    #Lock and Election — client.lock() / client.election()

    lock(name, lease), unlock(key), and campaign(name, value, lease), proclaim(leader, value), leader(name), resign(leader).

    #Concurrency helpers

    moonbitstack/moonetcd/concurrency wraps the lease-backed patterns from clientv3.

    import {
    "moonbitstack/moonetcd/client",
    "moonbitstack/moonetcd/concurrency",
    }

    let session = @concurrency.Session::new(client, 30L) // grants a lease
    let mutex = @concurrency.Mutex::new(client, session, b"/my-lock")
    mutex.lock()
    // critical section
    mutex.unlock()
    session.close() // revokes the lease

    • Session grants a lease and revokes it on close; both are plain unary calls. For a long-lived session, open session.keep_alive(task_group) and drive the returned KeepAlive so the lease does not expire.
    • Mutex is a distributed lock over v3lock, held on the session's lease, so it is released automatically if the holder dies.
    • Election campaigns, proclaims, and resigns over v3election.

    #Service discovery

    moonetcd/sd implements the moonsd contract on etcd. An endpoint is a key on a lease, so it goes when the lease does, and a watcher follows etcd's revisions. A watch that compaction or a dropped connection ends costs one more read.

    let registry = @sd.Registry::new(client)
    group.spawn_bg(() => @moonsd.hold(registry, "greeter", @moonsd.Endpoint::new("10.0.0.1", 12000)))
    let endpoints = registry.resolve("greeter")

    Registry::new takes prefix, default /moonsd. A lease lasts whole seconds, and the server sets a minimum, so a short ttl is rounded up. Any number of tasks may share one registry and its client.

    #Errors

    Every client method raises EtcdError:

    • Refused(Status) — a non-OK gRPC status, carrying the code and message.
    • Compacted(revision) — the requested revision was compacted (etcd's FAILED_PRECONDITION).
    • FutureRev(revision) — the requested revision is in the future (etcd's OUT_OF_RANGE).

    EtcdError::message() renders a human-readable string. Match on the variant to react to compaction or a future revision without scraping text.

    #Connection

    ClientConfig (@moonetcd.default_client_config is the preset) holds:

    FieldMeaning
    endpointsArray[String] of "host:port"; a missing port defaults to 2379.
    username, passwordetcd credentials; authentication happens at connect.
    tokena pre-existing auth token to reuse.
    dial_timeout_millisconnection timeout.
    keep_alive_millisHTTP/2 keep-alive interval.
    tlsTLS settings (see the note below).

    Multiple endpoints are load-balanced and failed over by the underlying channel. When a member dies under a call, a read goes again on the next member; a write answers UNAVAILABLE, since it may have run, and the next call goes to a member that is up. A Watch reconnects to the next endpoint and carries on from the revision after the last one it saw.

    #Examples

    Each example is a runnable moon run target. They expect etcd at 127.0.0.1:2379 (etcd's default client URL); start one first, or point the endpoint in the example at your member.

    moon run --target native src/examples/00-connect # dial and print member status moon run --target native src/examples/01-kv # put / get / prefix scan / delete moon run --target native src/examples/02-watch # watch a key and read the event moon run --target native src/examples/03-lease # grant a lease, attach a key, revoke moon run --target native src/examples/04-txn # compare-and-swap with a transaction moon run --target native src/examples/05-lock # distributed mutex over a session

    #Building and testing

    moon check --target all --deny-warn moon build --target all moon test --target all moon info --target all

    The protobuf codecs have network-free round-trip tests that run on every target, and scripts/check_field_numbers.py compares every field number with etcd's own .proto files, which a round trip cannot do. The transport has an in-process test that drives the real HTTP/2 engine over a loopback socket against a stand-in gRPC server.

    src/integration runs against a real etcd: leases lapsing, locks and elections changing hands, compaction, roles and tokens, a snapshot, and many tasks sharing one client. scripts/etcd_cluster.sh starts three members, and with MOONETCD_MEMBERS naming it the suite kills one under a watch and under plain calls. Without a server the tests return early; with MOONETCD_LIVE set, as in CI, a missing server fails them.

    #Notes

    • The transport is h2c (HTTP/2 over plaintext) through moonrpc. The TlsConfig fields are present so callers can configure TLS, but they are honoured only once TLS reaches the transport.
    • Maintenance::snapshot() buffers the whole stream; a very large snapshot is held in memory.
    • Watch and Lease KeepAlive use a pull model (next() returns one response at a time). Open them inside @async.with_task_group so the connection's read pump runs.

    #License

    Apache-2.0. See LICENSE.

    EtcdError

    pub(all) suberror EtcdError {
    Refused(Status)
    Compacted(Int64)
    FutureRev(Int64)
    }

    The error type every client method raises. A plain gRPC failure is Refused; etcd's revision conditions (Compacted, FutureRev) carry the revision so a caller can react without scraping a string.
    impl Show for EtcdError

    EtcdError::message

    fn EtcdError::message(self : EtcdError) -> String

    EtcdError::output

    fn EtcdError::output(self : EtcdError, logger : &Logger) -> Unit

    EtcdError::to_string

    fn EtcdError::to_string(self : EtcdError) -> String

    Alarm

    pub(all) struct Alarm {
    member_id : UInt64
    alarm : AlarmType
    } derive(Eq)

    One raised alarm (etcdserverpb.Alarm).

    Alarm::decode

    fn Alarm::decode(data : Bytes) -> Alarm raise
    PbError

    Alarm::empty

    fn Alarm::empty() -> Alarm

    Alarm::encode

    fn Alarm::encode(self : Alarm) -> Bytes

    Alarm::equal

    fn Alarm::equal(Alarm, Alarm) -> Bool

    Alarm::not_equal

    fn Alarm::not_equal(x : Alarm, y : Alarm) -> Bool

    AlarmAction

    pub(all) enum AlarmAction {
    Get
    Activate
    Deactivate
    } derive(Eq)

    What an AlarmRequest does (etcdserverpb.AlarmRequest.AlarmAction).

    AlarmAction::equal

    fn AlarmAction::equal(AlarmAction, AlarmAction) -> Bool

    AlarmAction::from_int

    fn AlarmAction::from_int(n : Int) -> AlarmAction

    AlarmAction::not_equal

    fn AlarmAction::not_equal(x : AlarmAction, y : AlarmAction) -> Bool

    AlarmAction::to_int

    fn AlarmAction::to_int(self : AlarmAction) -> Int

    AlarmRequest

    pub(all) struct AlarmRequest {
    action : AlarmAction
    member_id : UInt64
    alarm : AlarmType
    } derive(Eq)

    Query or raise an alarm (etcdserverpb.AlarmRequest).

    AlarmRequest::decode

    AlarmRequest::empty

    fn AlarmRequest::empty() -> AlarmRequest

    AlarmRequest::encode

    fn AlarmRequest::encode(self : AlarmRequest) -> Bytes

    AlarmRequest::equal

    AlarmRequest::not_equal

    fn AlarmRequest::not_equal(x : AlarmRequest, y : AlarmRequest) -> Bool

    AlarmResponse

    pub(all) struct AlarmResponse {
    header : ResponseHeader
    alarms : Array[Alarm]
    } derive(Eq)

    The alarm state (etcdserverpb.AlarmResponse): a repeated list of alarms, each a memberID and an AlarmType.

    AlarmResponse::decode

    AlarmResponse::empty

    AlarmResponse::encode

    fn AlarmResponse::encode(self : AlarmResponse) -> Bytes

    AlarmResponse::equal

    AlarmResponse::not_equal

    fn AlarmResponse::not_equal(x : AlarmResponse, y : AlarmResponse) -> Bool

    AlarmType

    pub(all) enum AlarmType {
    None
    Nospace
    Corrupt
    } derive(Eq)

    The kind of alarm (etcdserverpb.Alarm.Type).

    AlarmType::equal

    fn AlarmType::equal(AlarmType, AlarmType) -> Bool

    AlarmType::from_int

    fn AlarmType::from_int(n : Int) -> AlarmType

    AlarmType::not_equal

    fn AlarmType::not_equal(x : AlarmType, y : AlarmType) -> Bool

    AlarmType::to_int

    fn AlarmType::to_int(self : AlarmType) -> Int

    AuthDisableResponse

    pub(all) struct AuthDisableResponse {
    header : ResponseHeader
    } derive(Eq)

    Disable authentication (etcdserverpb.AuthDisableResponse).

    AuthDisableResponse::decode

    AuthDisableResponse::empty

    AuthDisableResponse::encode

    fn AuthDisableResponse::encode(self : AuthDisableResponse) -> Bytes

    AuthDisableResponse::equal

    AuthDisableResponse::not_equal

    AuthEnableResponse

    pub(all) struct AuthEnableResponse {
    header : ResponseHeader
    } derive(Eq)

    Enable authentication (etcdserverpb.AuthEnableResponse).

    AuthEnableResponse::decode

    AuthEnableResponse::empty

    AuthEnableResponse::encode

    fn AuthEnableResponse::encode(self : AuthEnableResponse) -> Bytes

    AuthEnableResponse::equal

    AuthEnableResponse::not_equal

    AuthRoleAddRequest

    pub(all) struct AuthRoleAddRequest {
    name : String
    } derive(Eq)

    Add a role (etcdserverpb.AuthRoleAddRequest).

    AuthRoleAddRequest::decode

    AuthRoleAddRequest::empty

    AuthRoleAddRequest::encode

    fn AuthRoleAddRequest::encode(self : AuthRoleAddRequest) -> Bytes

    AuthRoleAddRequest::equal

    AuthRoleAddRequest::not_equal

    AuthRoleAddResponse

    pub(all) struct AuthRoleAddResponse {
    header : ResponseHeader
    } derive(Eq)

    Added-role reply (etcdserverpb.AuthRoleAddResponse).

    AuthRoleAddResponse::decode

    AuthRoleAddResponse::empty

    AuthRoleAddResponse::encode

    fn AuthRoleAddResponse::encode(self : AuthRoleAddResponse) -> Bytes

    AuthRoleAddResponse::equal

    AuthRoleAddResponse::not_equal

    AuthRoleDeleteRequest

    pub(all) struct AuthRoleDeleteRequest {
    role : String
    } derive(Eq)

    Delete a role (etcdserverpb.AuthRoleDeleteRequest).

    AuthRoleDeleteRequest::decode

    AuthRoleDeleteRequest::empty

    AuthRoleDeleteRequest::encode

    fn AuthRoleDeleteRequest::encode(self : AuthRoleDeleteRequest) -> Bytes

    AuthRoleDeleteRequest::equal

    AuthRoleDeleteRequest::not_equal

    AuthRoleDeleteResponse

    pub(all) struct AuthRoleDeleteResponse {
    header : ResponseHeader
    } derive(Eq)

    Deleted-role reply (etcdserverpb.AuthRoleDeleteResponse).

    AuthRoleDeleteResponse::decode

    AuthRoleDeleteResponse::empty

    AuthRoleDeleteResponse::encode

    AuthRoleDeleteResponse::equal

    AuthRoleDeleteResponse::not_equal

    AuthRoleGetRequest

    pub(all) struct AuthRoleGetRequest {
    role : String
    } derive(Eq)

    Fetch a role's permissions (etcdserverpb.AuthRoleGetRequest).

    AuthRoleGetRequest::decode

    AuthRoleGetRequest::empty

    AuthRoleGetRequest::encode

    fn AuthRoleGetRequest::encode(self : AuthRoleGetRequest) -> Bytes

    AuthRoleGetRequest::equal

    AuthRoleGetRequest::not_equal

    AuthRoleGetResponse

    pub(all) struct AuthRoleGetResponse {
    header : ResponseHeader
    perm : Array[Permission]
    } derive(Eq)

    A role's permissions (etcdserverpb.AuthRoleGetResponse).

    AuthRoleGetResponse::decode

    AuthRoleGetResponse::empty

    AuthRoleGetResponse::encode

    fn AuthRoleGetResponse::encode(self : AuthRoleGetResponse) -> Bytes

    AuthRoleGetResponse::equal

    AuthRoleGetResponse::not_equal

    AuthRoleGrantPermissionRequest

    pub(all) struct AuthRoleGrantPermissionRequest {
    name : String
    perm : Permission
    } derive(Eq)

    Grant a permission to a role (etcdserverpb.AuthRoleGrantPermissionRequest).

    AuthRoleGrantPermissionRequest::decode

    AuthRoleGrantPermissionRequest::empty

    AuthRoleGrantPermissionRequest::encode

    AuthRoleGrantPermissionRequest::not_equal

    AuthRoleGrantPermissionResponse

    pub(all) struct AuthRoleGrantPermissionResponse {
    header : ResponseHeader
    } derive(Eq)

    Granted-permission reply (etcdserverpb.AuthRoleGrantPermissionResponse).

    AuthRoleGrantPermissionResponse::decode

    AuthRoleGrantPermissionResponse::empty

    AuthRoleGrantPermissionResponse::encode

    AuthRoleGrantPermissionResponse::not_equal

    AuthRoleListResponse

    pub(all) struct AuthRoleListResponse {
    header : ResponseHeader
    roles : Array[String]
    } derive(Eq)

    All role names (etcdserverpb.AuthRoleListResponse).

    AuthRoleListResponse::decode

    AuthRoleListResponse::empty

    AuthRoleListResponse::encode

    fn AuthRoleListResponse::encode(self : AuthRoleListResponse) -> Bytes

    AuthRoleListResponse::equal

    AuthRoleListResponse::not_equal

    AuthRoleRevokePermissionRequest

    pub(all) struct AuthRoleRevokePermissionRequest {
    role : String
    key : Bytes
    range_end : Bytes
    } derive(Eq)

    Revoke a permission from a role (etcdserverpb.AuthRoleRevokePermissionRequest).

    AuthRoleRevokePermissionRequest::decode

    AuthRoleRevokePermissionRequest::empty

    AuthRoleRevokePermissionRequest::encode

    AuthRoleRevokePermissionRequest::not_equal

    AuthRoleRevokePermissionResponse

    pub(all) struct AuthRoleRevokePermissionResponse {
    header : ResponseHeader
    } derive(Eq)

    Revoked-permission reply (etcdserverpb.AuthRoleRevokePermissionResponse).

    AuthRoleRevokePermissionResponse::decode

    AuthRoleRevokePermissionResponse::empty

    AuthRoleRevokePermissionResponse::encode

    AuthRoleRevokePermissionResponse::not_equal

    AuthStatusResponse

    pub(all) struct AuthStatusResponse {
    header : ResponseHeader
    enabled : Bool
    auth_revision : Int64
    } derive(Eq)

    Whether authentication is on and the current auth revision (etcdserverpb.AuthStatusResponse).

    AuthStatusResponse::decode

    AuthStatusResponse::empty

    AuthStatusResponse::encode

    fn AuthStatusResponse::encode(self : AuthStatusResponse) -> Bytes

    AuthStatusResponse::equal

    AuthStatusResponse::not_equal

    AuthUserAddRequest

    pub(all) struct AuthUserAddRequest {
    name : String
    password : String
    options : UserAddOptions
    } derive(Eq)

    Add a user (etcdserverpb.AuthUserAddRequest).

    AuthUserAddRequest::decode

    AuthUserAddRequest::empty

    AuthUserAddRequest::encode

    fn AuthUserAddRequest::encode(self : AuthUserAddRequest) -> Bytes

    AuthUserAddRequest::equal

    AuthUserAddRequest::not_equal

    AuthUserAddResponse

    pub(all) struct AuthUserAddResponse {
    header : ResponseHeader
    } derive(Eq)

    Added-user reply (etcdserverpb.AuthUserAddResponse).

    AuthUserAddResponse::decode

    AuthUserAddResponse::empty

    AuthUserAddResponse::encode

    fn AuthUserAddResponse::encode(self : AuthUserAddResponse) -> Bytes

    AuthUserAddResponse::equal

    AuthUserAddResponse::not_equal

    AuthUserChangePasswordRequest

    pub(all) struct AuthUserChangePasswordRequest {
    name : String
    password : String
    } derive(Eq)

    Change a user's password (etcdserverpb.AuthUserChangePasswordRequest).

    AuthUserChangePasswordRequest::decode

    AuthUserChangePasswordRequest::empty

    AuthUserChangePasswordRequest::encode

    AuthUserChangePasswordRequest::not_equal

    AuthUserChangePasswordResponse

    pub(all) struct AuthUserChangePasswordResponse {
    header : ResponseHeader
    } derive(Eq)

    Changed-password reply (etcdserverpb.AuthUserChangePasswordResponse).

    AuthUserChangePasswordResponse::decode

    AuthUserChangePasswordResponse::empty

    AuthUserChangePasswordResponse::encode

    AuthUserChangePasswordResponse::not_equal

    AuthUserDeleteRequest

    pub(all) struct AuthUserDeleteRequest {
    name : String
    } derive(Eq)

    Delete a user (etcdserverpb.AuthUserDeleteRequest).

    AuthUserDeleteRequest::decode

    AuthUserDeleteRequest::empty

    AuthUserDeleteRequest::encode

    fn AuthUserDeleteRequest::encode(self : AuthUserDeleteRequest) -> Bytes

    AuthUserDeleteRequest::equal

    AuthUserDeleteRequest::not_equal

    AuthUserDeleteResponse

    pub(all) struct AuthUserDeleteResponse {
    header : ResponseHeader
    } derive(Eq)

    Deleted-user reply (etcdserverpb.AuthUserDeleteResponse).

    AuthUserDeleteResponse::decode

    AuthUserDeleteResponse::empty

    AuthUserDeleteResponse::encode

    AuthUserDeleteResponse::equal

    AuthUserDeleteResponse::not_equal

    AuthUserGetRequest

    pub(all) struct AuthUserGetRequest {
    name : String
    } derive(Eq)

    Fetch a user's roles (etcdserverpb.AuthUserGetRequest).

    AuthUserGetRequest::decode

    AuthUserGetRequest::empty

    AuthUserGetRequest::encode

    fn AuthUserGetRequest::encode(self : AuthUserGetRequest) -> Bytes

    AuthUserGetRequest::equal

    AuthUserGetRequest::not_equal

    AuthUserGetResponse

    pub(all) struct AuthUserGetResponse {
    header : ResponseHeader
    roles : Array[String]
    } derive(Eq)

    A user's roles (etcdserverpb.AuthUserGetResponse).

    AuthUserGetResponse::decode

    AuthUserGetResponse::empty

    AuthUserGetResponse::encode

    fn AuthUserGetResponse::encode(self : AuthUserGetResponse) -> Bytes

    AuthUserGetResponse::equal

    AuthUserGetResponse::not_equal

    AuthUserGrantRoleRequest

    pub(all) struct AuthUserGrantRoleRequest {
    user : String
    role : String
    } derive(Eq)

    Grant a role to a user (etcdserverpb.AuthUserGrantRoleRequest).

    AuthUserGrantRoleRequest::decode

    AuthUserGrantRoleRequest::empty

    AuthUserGrantRoleRequest::encode

    AuthUserGrantRoleRequest::equal

    AuthUserGrantRoleRequest::not_equal

    AuthUserGrantRoleResponse

    pub(all) struct AuthUserGrantRoleResponse {
    header : ResponseHeader
    } derive(Eq)

    Granted-role reply (etcdserverpb.AuthUserGrantRoleResponse).

    AuthUserGrantRoleResponse::decode

    AuthUserGrantRoleResponse::empty

    AuthUserGrantRoleResponse::encode

    AuthUserGrantRoleResponse::equal

    AuthUserGrantRoleResponse::not_equal

    AuthUserListResponse

    pub(all) struct AuthUserListResponse {
    header : ResponseHeader
    users : Array[String]
    } derive(Eq)

    All user names (etcdserverpb.AuthUserListResponse).

    AuthUserListResponse::decode

    AuthUserListResponse::empty

    AuthUserListResponse::encode

    fn AuthUserListResponse::encode(self : AuthUserListResponse) -> Bytes

    AuthUserListResponse::equal

    AuthUserListResponse::not_equal

    AuthUserRevokeRoleRequest

    pub(all) struct AuthUserRevokeRoleRequest {
    name : String
    role : String
    } derive(Eq)

    Revoke a role from a user (etcdserverpb.AuthUserRevokeRoleRequest).

    AuthUserRevokeRoleRequest::decode

    AuthUserRevokeRoleRequest::empty

    AuthUserRevokeRoleRequest::encode

    AuthUserRevokeRoleRequest::equal

    AuthUserRevokeRoleRequest::not_equal

    AuthUserRevokeRoleResponse

    pub(all) struct AuthUserRevokeRoleResponse {
    header : ResponseHeader
    } derive(Eq)

    Revoked-role reply (etcdserverpb.AuthUserRevokeRoleResponse).

    AuthUserRevokeRoleResponse::decode

    AuthUserRevokeRoleResponse::empty

    AuthUserRevokeRoleResponse::encode

    AuthUserRevokeRoleResponse::equal

    AuthUserRevokeRoleResponse::not_equal

    AuthenticateRequest

    pub(all) struct AuthenticateRequest {
    name : String
    password : String
    } derive(Eq)

    Exchange a name and password for a token (etcdserverpb.AuthenticateRequest).

    AuthenticateRequest::decode

    AuthenticateRequest::empty

    AuthenticateRequest::encode

    fn AuthenticateRequest::encode(self : AuthenticateRequest) -> Bytes

    AuthenticateRequest::equal

    AuthenticateRequest::not_equal

    AuthenticateResponse

    pub(all) struct AuthenticateResponse {
    header : ResponseHeader
    token : String
    } derive(Eq)

    The issued token (etcdserverpb.AuthenticateResponse).

    AuthenticateResponse::decode

    AuthenticateResponse::empty

    AuthenticateResponse::encode

    fn AuthenticateResponse::encode(self : AuthenticateResponse) -> Bytes

    AuthenticateResponse::equal

    AuthenticateResponse::not_equal

    CampaignRequest

    pub(all) struct CampaignRequest {
    name : Bytes
    value : Bytes
    lease : Int64
    } derive(Eq)

    Enter the election name with value, guarded by lease (v3election.CampaignRequest).

    CampaignRequest::decode

    CampaignRequest::empty

    CampaignRequest::encode

    fn CampaignRequest::encode(self : CampaignRequest) -> Bytes

    CampaignRequest::equal

    CampaignRequest::not_equal

    fn CampaignRequest::not_equal(x : CampaignRequest, y : CampaignRequest) -> Bool

    CampaignResponse

    pub(all) struct CampaignResponse {
    header : ResponseHeader
    leader : LeaderKey
    } derive(Eq)

    The won leadership (v3election.CampaignResponse).

    CampaignResponse::decode

    CampaignResponse::empty

    CampaignResponse::encode

    fn CampaignResponse::encode(self : CampaignResponse) -> Bytes

    CampaignResponse::equal

    CampaignResponse::not_equal

    fn CampaignResponse::not_equal(x : CampaignResponse, y : CampaignResponse) -> Bool

    ClientConfig

    pub(all) struct ClientConfig {
    endpoints : Array[String]
    username : String
    password : String
    token : String
    dial_timeout_millis : Int
    keep_alive_millis : Int
    tls : TlsConfig
    } derive(Eq)

    How a client reaches etcd: the endpoints to dial, the credentials to authenticate with, timeouts, and TLS. Only endpoints is required; everything else has a safe default.

    ClientConfig::equal

    ClientConfig::not_equal

    fn ClientConfig::not_equal(x : ClientConfig, y : ClientConfig) -> Bool

    CmpTarget

    pub(all) enum CmpTarget {
    Version(Int64)
    CreateRevision(Int64)
    ModRevision(Int64)
    Value(Bytes)
    Lease(Int64)
    } derive(Eq)

    The value a Compare tests, the oneof target_union of etcdserverpb.Compare.

    CmpTarget::equal

    fn CmpTarget::equal(CmpTarget, CmpTarget) -> Bool

    CmpTarget::not_equal

    fn CmpTarget::not_equal(x : CmpTarget, y : CmpTarget) -> Bool

    CompactionRequest

    pub(all) struct CompactionRequest {
    revision : Int64
    physical : Bool
    } derive(Eq)

    A request to discard history before revision (etcdserverpb.CompactionRequest).

    CompactionRequest::decode

    CompactionRequest::empty

    CompactionRequest::encode

    fn CompactionRequest::encode(self : CompactionRequest) -> Bytes

    CompactionRequest::equal

    CompactionRequest::not_equal

    fn CompactionRequest::not_equal(x : CompactionRequest, y : CompactionRequest) -> Bool

    CompactionResponse

    pub(all) struct CompactionResponse {
    header : ResponseHeader
    } derive(Eq)

    The result of a compaction (etcdserverpb.CompactionResponse).

    CompactionResponse::decode

    CompactionResponse::empty

    CompactionResponse::encode

    fn CompactionResponse::encode(self : CompactionResponse) -> Bytes

    CompactionResponse::equal

    CompactionResponse::not_equal

    Compare

    pub(all) struct Compare {
    result : CompareResult
    target : CompareTarget
    key : Bytes
    range_end : Bytes
    target_union : CmpTarget
    } derive(Eq)

    One guarded test in a Txn (etcdserverpb.Compare): compare target of key (or [key, range_end)) against target_union with result.

    Compare::decode

    Compare::empty

    fn Compare::empty() -> Compare

    Compare::encode

    fn Compare::encode(self : Compare) -> Bytes

    Compare::equal

    fn Compare::equal(Compare, Compare) -> Bool

    Compare::not_equal

    fn Compare::not_equal(x : Compare, y : Compare) -> Bool

    CompareResult

    pub(all) enum CompareResult {
    Equal
    Greater
    Less
    NotEqual
    } derive(Eq)

    The comparison kind in a Txn (etcdserverpb.Compare.CompareResult).

    CompareResult::equal

    CompareResult::from_int

    fn CompareResult::from_int(n : Int) -> CompareResult

    CompareResult::not_equal

    fn CompareResult::not_equal(x : CompareResult, y : CompareResult) -> Bool

    CompareResult::to_int

    fn CompareResult::to_int(self : CompareResult) -> Int

    CompareTarget

    pub(all) enum CompareTarget {
    Version
    Create
    Mod
    Value
    Lease
    } derive(Eq)

    What a Txn compares (etcdserverpb.Compare.CompareTarget).

    CompareTarget::equal

    CompareTarget::from_int

    fn CompareTarget::from_int(n : Int) -> CompareTarget

    CompareTarget::not_equal

    fn CompareTarget::not_equal(x : CompareTarget, y : CompareTarget) -> Bool

    CompareTarget::to_int

    fn CompareTarget::to_int(self : CompareTarget) -> Int

    DefragmentResponse

    pub(all) struct DefragmentResponse {
    header : ResponseHeader
    } derive(Eq)

    The reply to a Defragment (etcdserverpb.DefragmentResponse).

    DefragmentResponse::decode

    DefragmentResponse::empty

    DefragmentResponse::encode

    fn DefragmentResponse::encode(self : DefragmentResponse) -> Bytes

    DefragmentResponse::equal

    DefragmentResponse::not_equal

    DeleteRangeRequest

    pub(all) struct DeleteRangeRequest {
    key : Bytes
    range_end : Bytes
    prev_kv : Bool
    } derive(Eq)

    A delete over [key, range_end) (etcdserverpb.DeleteRangeRequest).

    DeleteRangeRequest::decode

    DeleteRangeRequest::empty

    DeleteRangeRequest::encode

    fn DeleteRangeRequest::encode(self : DeleteRangeRequest) -> Bytes

    DeleteRangeRequest::equal

    DeleteRangeRequest::not_equal

    DeleteRangeResponse

    pub(all) struct DeleteRangeResponse {
    header : ResponseHeader
    deleted : Int64
    prev_kvs : Array[KeyValue]
    } derive(Eq)

    The count removed and, when prev_kv was set, the key/values that were (etcdserverpb.DeleteRangeResponse).

    DeleteRangeResponse::decode

    DeleteRangeResponse::empty

    DeleteRangeResponse::encode

    fn DeleteRangeResponse::encode(self : DeleteRangeResponse) -> Bytes

    DeleteRangeResponse::equal

    DeleteRangeResponse::not_equal

    DowngradeAction

    pub(all) enum DowngradeAction {
    Validate
    Download
    Cancel
    } derive(Eq)

    The downgrade step to take (etcdserverpb.DowngradeRequest.DowngradeAction).

    DowngradeAction::equal

    DowngradeAction::from_int

    fn DowngradeAction::from_int(n : Int) -> DowngradeAction

    DowngradeAction::not_equal

    fn DowngradeAction::not_equal(x : DowngradeAction, y : DowngradeAction) -> Bool

    DowngradeAction::to_int

    fn DowngradeAction::to_int(self : DowngradeAction) -> Int

    DowngradeRequest

    pub(all) struct DowngradeRequest {
    action : DowngradeAction
    version : String
    } derive(Eq)

    Start or cancel a cluster version downgrade (etcdserverpb.DowngradeRequest).

    DowngradeRequest::decode

    DowngradeRequest::empty

    DowngradeRequest::encode

    fn DowngradeRequest::encode(self : DowngradeRequest) -> Bytes

    DowngradeRequest::equal

    DowngradeRequest::not_equal

    fn DowngradeRequest::not_equal(x : DowngradeRequest, y : DowngradeRequest) -> Bool

    DowngradeResponse

    pub(all) struct DowngradeResponse {
    header : ResponseHeader
    version : String
    } derive(Eq)

    Downgrade state (etcdserverpb.DowngradeResponse).

    DowngradeResponse::decode

    DowngradeResponse::empty

    DowngradeResponse::encode

    fn DowngradeResponse::encode(self : DowngradeResponse) -> Bytes

    DowngradeResponse::equal

    DowngradeResponse::not_equal

    fn DowngradeResponse::not_equal(x : DowngradeResponse, y : DowngradeResponse) -> Bool

    Event

    pub(all) struct Event {
    event_type : EventType
    kv : KeyValue
    prev_kv : KeyValue
    } derive(Eq)

    A watch Event (mvccpb.Event): one change to one key, carrying the resulting KeyValue and, when the request asked for it, the previous one.

    Event::decode

    fn Event::decode(data : Bytes) -> Event raise
    PbError

    Decode an Event; an absent prev_kv decodes to the empty key/value.

    Event::empty

    fn Event::empty() -> Event

    Event::encode

    fn Event::encode(self : Event) -> Bytes

    Encode an Event (type=1, kv=2, prev_kv=3). PUT (0) is omitted.

    Event::equal

    fn Event::equal(Event, Event) -> Bool

    Event::not_equal

    fn Event::not_equal(x : Event, y : Event) -> Bool

    EventType

    pub(all) enum EventType {
    Put
    Delete
    } derive(Eq)

    The kind of change a watch Event reports (mvccpb.Event.EventType): a key was Put (created or updated) or Deleted. PUT (0) is the proto3 default.

    EventType::equal

    fn EventType::equal(EventType, EventType) -> Bool

    EventType::from_int

    fn EventType::from_int(n : Int) -> EventType

    The event type for a protobuf enum number; unknown numbers read as Put, as etcd (and Go's proto) default an unknown enum to its first value.

    EventType::not_equal

    fn EventType::not_equal(x : EventType, y : EventType) -> Bool

    EventType::to_int

    fn EventType::to_int(self : EventType) -> Int

    FilterType

    pub(all) enum FilterType {
    NoPut
    NoDelete
    } derive(Eq)

    What a watch filters out (etcdserverpb.WatchCreateRequest.FilterType).

    FilterType::equal

    fn FilterType::equal(FilterType, FilterType) -> Bool

    FilterType::from_int

    fn FilterType::from_int(n : Int) -> FilterType

    FilterType::not_equal

    fn FilterType::not_equal(x : FilterType, y : FilterType) -> Bool

    FilterType::to_int

    fn FilterType::to_int(self : FilterType) -> Int

    HashKVResponse

    pub(all) struct HashKVResponse {
    header : ResponseHeader
    hash : UInt
    compact_revision : Int64
    hash_revision : Int64
    } derive(Eq)

    A hash of the backend at a pinned revision (etcdserverpb.HashKVResponse).

    HashKVResponse::decode

    HashKVResponse::empty

    HashKVResponse::encode

    fn HashKVResponse::encode(self : HashKVResponse) -> Bytes

    HashKVResponse::equal

    HashKVResponse::not_equal

    fn HashKVResponse::not_equal(x : HashKVResponse, y : HashKVResponse) -> Bool

    HashResponse

    pub(all) struct HashResponse {
    header : ResponseHeader
    hash : UInt
    } derive(Eq)

    A hash of the backend (etcdserverpb.HashResponse); HashKV pins a revision.

    HashResponse::decode

    HashResponse::empty

    fn HashResponse::empty() -> HashResponse

    HashResponse::encode

    fn HashResponse::encode(self : HashResponse) -> Bytes

    HashResponse::equal

    HashResponse::not_equal

    fn HashResponse::not_equal(x : HashResponse, y : HashResponse) -> Bool

    KeyValue

    pub(all) struct KeyValue {
    key : Bytes
    create_revision : Int64
    mod_revision : Int64
    version : Int64
    value : Bytes
    lease : Int64
    } derive(Eq)

    An etcd key/value (mvccpb.KeyValue): the key and value as raw bytes, the create/mod revisions and version that track its history, and the lease it is attached to.

    KeyValue::decode

    Decode a KeyValue; unknown fields are skipped.

    KeyValue::empty

    fn KeyValue::empty() -> KeyValue

    The empty key/value: all-zero metadata and no key or value.

    KeyValue::encode

    fn KeyValue::encode(self : KeyValue) -> Bytes

    Encode a KeyValue (key=1, create_revision=2, mod_revision=3, version=4, value=5, lease=6). Proto3 omits zero/default fields.

    KeyValue::equal

    fn KeyValue::equal(KeyValue, KeyValue) -> Bool

    KeyValue::is_empty

    fn KeyValue::is_empty(self : KeyValue) -> Bool

    True when the key/value carries no data: the wire omits such a message.

    KeyValue::not_equal

    fn KeyValue::not_equal(x : KeyValue, y : KeyValue) -> Bool

    LeaderKey

    pub(all) struct LeaderKey {
    name : Bytes
    key : Bytes
    rev : Int64
    lease : Int64
    } derive(Eq)

    The opaque handle to a leadership claim (v3election.LeaderKey).

    LeaderKey::decode

    LeaderKey::empty

    fn LeaderKey::empty() -> LeaderKey

    LeaderKey::encode

    fn LeaderKey::encode(self : LeaderKey) -> Bytes

    LeaderKey::equal

    fn LeaderKey::equal(LeaderKey, LeaderKey) -> Bool

    LeaderKey::not_equal

    fn LeaderKey::not_equal(x : LeaderKey, y : LeaderKey) -> Bool

    LeaderRequest

    pub(all) struct LeaderRequest {
    name : Bytes
    } derive(Eq)

    Ask for the current leader of election name (v3election.LeaderRequest).

    LeaderRequest::decode

    LeaderRequest::empty

    LeaderRequest::encode

    fn LeaderRequest::encode(self : LeaderRequest) -> Bytes

    LeaderRequest::equal

    LeaderRequest::not_equal

    fn LeaderRequest::not_equal(x : LeaderRequest, y : LeaderRequest) -> Bool

    LeaderResponse

    pub(all) struct LeaderResponse {
    header : ResponseHeader
    kv : KeyValue
    } derive(Eq)

    The current leader (v3election.LeaderResponse).

    LeaderResponse::decode

    LeaderResponse::empty

    LeaderResponse::encode

    fn LeaderResponse::encode(self : LeaderResponse) -> Bytes

    LeaderResponse::equal

    LeaderResponse::not_equal

    fn LeaderResponse::not_equal(x : LeaderResponse, y : LeaderResponse) -> Bool

    LeaseGrantRequest

    pub(all) struct LeaseGrantRequest {
    ttl : Int64
    id : Int64
    } derive(Eq)

    Ask etcd for a lease living ttl seconds, with a caller-chosen id (etcdserverpb.LeaseGrantRequest). id 0 lets the server assign one.

    LeaseGrantRequest::decode

    LeaseGrantRequest::empty

    LeaseGrantRequest::encode

    fn LeaseGrantRequest::encode(self : LeaseGrantRequest) -> Bytes

    LeaseGrantRequest::equal

    LeaseGrantRequest::not_equal

    fn LeaseGrantRequest::not_equal(x : LeaseGrantRequest, y : LeaseGrantRequest) -> Bool

    LeaseGrantResponse

    pub(all) struct LeaseGrantResponse {
    header : ResponseHeader
    id : Int64
    ttl : Int64
    error : String
    } derive(Eq)

    The granted lease (etcdserverpb.LeaseGrantResponse). error is non-empty when the grant failed.

    LeaseGrantResponse::decode

    LeaseGrantResponse::empty

    LeaseGrantResponse::encode

    fn LeaseGrantResponse::encode(self : LeaseGrantResponse) -> Bytes

    LeaseGrantResponse::equal

    LeaseGrantResponse::not_equal

    LeaseKeepAliveRequest

    pub(all) struct LeaseKeepAliveRequest {
    id : Int64
    } derive(Eq)

    Renew lease id (etcdserverpb.LeaseKeepAliveRequest).

    LeaseKeepAliveRequest::decode

    LeaseKeepAliveRequest::empty

    LeaseKeepAliveRequest::encode

    fn LeaseKeepAliveRequest::encode(self : LeaseKeepAliveRequest) -> Bytes

    LeaseKeepAliveRequest::equal

    LeaseKeepAliveRequest::not_equal

    LeaseKeepAliveResponse

    pub(all) struct LeaseKeepAliveResponse {
    header : ResponseHeader
    id : Int64
    ttl : Int64
    } derive(Eq)

    The renewed lease and its remaining ttl (etcdserverpb.LeaseKeepAliveResponse). A ttl of 0 means the lease has expired.

    LeaseKeepAliveResponse::decode

    LeaseKeepAliveResponse::empty

    LeaseKeepAliveResponse::encode

    LeaseKeepAliveResponse::equal

    LeaseKeepAliveResponse::not_equal

    LeaseLeasesResponse

    pub(all) struct LeaseLeasesResponse {
    header : ResponseHeader
    leases : Array[LeaseStatus]
    } derive(Eq)

    The list of leases (etcdserverpb.LeaseLeasesResponse).

    LeaseLeasesResponse::decode

    LeaseLeasesResponse::empty

    LeaseLeasesResponse::encode

    fn LeaseLeasesResponse::encode(self : LeaseLeasesResponse) -> Bytes

    LeaseLeasesResponse::equal

    LeaseLeasesResponse::not_equal

    LeaseRevokeRequest

    pub(all) struct LeaseRevokeRequest {
    id : Int64
    } derive(Eq)

    Revoke lease id (etcdserverpb.LeaseRevokeRequest).

    LeaseRevokeRequest::decode

    LeaseRevokeRequest::empty

    LeaseRevokeRequest::encode

    fn LeaseRevokeRequest::encode(self : LeaseRevokeRequest) -> Bytes

    LeaseRevokeRequest::equal

    LeaseRevokeRequest::not_equal

    LeaseRevokeResponse

    pub(all) struct LeaseRevokeResponse {
    header : ResponseHeader
    } derive(Eq)

    The result of a revoke (etcdserverpb.LeaseRevokeResponse).

    LeaseRevokeResponse::decode

    LeaseRevokeResponse::empty

    LeaseRevokeResponse::encode

    fn LeaseRevokeResponse::encode(self : LeaseRevokeResponse) -> Bytes

    LeaseRevokeResponse::equal

    LeaseRevokeResponse::not_equal

    LeaseStatus

    pub(all) struct LeaseStatus {
    id : Int64
    } derive(Eq)

    One lease's id (etcdserverpb.LeaseStatus).

    LeaseStatus::decode

    LeaseStatus::empty

    fn LeaseStatus::empty() -> LeaseStatus

    LeaseStatus::encode

    fn LeaseStatus::encode(self : LeaseStatus) -> Bytes

    LeaseStatus::equal

    fn LeaseStatus::equal(LeaseStatus, LeaseStatus) -> Bool

    LeaseStatus::not_equal

    fn LeaseStatus::not_equal(x : LeaseStatus, y : LeaseStatus) -> Bool

    LeaseTimeToLiveRequest

    pub(all) struct LeaseTimeToLiveRequest {
    id : Int64
    keys : Bool
    } derive(Eq)

    Inspect lease id, optionally listing the keys attached to it (etcdserverpb.LeaseTimeToLiveRequest).

    LeaseTimeToLiveRequest::decode

    LeaseTimeToLiveRequest::empty

    LeaseTimeToLiveRequest::encode

    LeaseTimeToLiveRequest::equal

    LeaseTimeToLiveRequest::not_equal

    LeaseTimeToLiveResponse

    pub(all) struct LeaseTimeToLiveResponse {
    header : ResponseHeader
    id : Int64
    ttl : Int64
    granted_ttl : Int64
    keys : Array[Bytes]
    } derive(Eq)

    A lease's remaining time (etcdserverpb.LeaseTimeToLiveResponse).

    LeaseTimeToLiveResponse::decode

    LeaseTimeToLiveResponse::empty

    LeaseTimeToLiveResponse::encode

    LeaseTimeToLiveResponse::equal

    LeaseTimeToLiveResponse::not_equal

    LockRequest

    pub(all) struct LockRequest {
    name : Bytes
    lease : Int64
    } derive(Eq)

    Acquire the lock named name; lease keeps it alive (v3lock.LockRequest).

    LockRequest::decode

    LockRequest::empty

    fn LockRequest::empty() -> LockRequest

    LockRequest::encode

    fn LockRequest::encode(self : LockRequest) -> Bytes

    LockRequest::equal

    fn LockRequest::equal(LockRequest, LockRequest) -> Bool

    LockRequest::not_equal

    fn LockRequest::not_equal(x : LockRequest, y : LockRequest) -> Bool

    LockResponse

    pub(all) struct LockResponse {
    header : ResponseHeader
    key : Bytes
    } derive(Eq)

    The lock is held while key exists (v3lock.LockResponse).

    LockResponse::decode

    LockResponse::empty

    fn LockResponse::empty() -> LockResponse

    LockResponse::encode

    fn LockResponse::encode(self : LockResponse) -> Bytes

    LockResponse::equal

    LockResponse::not_equal

    fn LockResponse::not_equal(x : LockResponse, y : LockResponse) -> Bool

    Member

    pub(all) struct Member {
    id : UInt64
    name : String
    peer_urls : Array[String]
    client_urls : Array[String]
    } derive(Eq)

    One member of the cluster (etcdserverpb.Member).

    Member::decode

    fn Member::decode(data : Bytes) -> Member raise
    PbError

    Member::empty

    fn Member::empty() -> Member

    Member::encode

    fn Member::encode(self : Member) -> Bytes

    Member::equal

    fn Member::equal(Member, Member) -> Bool

    Member::not_equal

    fn Member::not_equal(x : Member, y : Member) -> Bool

    MemberAddRequest

    pub(all) struct MemberAddRequest {
    peer_urls : Array[String]
    is_learner : Bool
    } derive(Eq)

    Add a member with the given peer URLs (etcdserverpb.MemberAddRequest).

    MemberAddRequest::decode

    MemberAddRequest::empty

    MemberAddRequest::encode

    fn MemberAddRequest::encode(self : MemberAddRequest) -> Bytes

    MemberAddRequest::equal

    MemberAddRequest::not_equal

    fn MemberAddRequest::not_equal(x : MemberAddRequest, y : MemberAddRequest) -> Bool

    MemberAddResponse

    pub(all) struct MemberAddResponse {
    header : ResponseHeader
    member_ : Member
    members : Array[Member]
    } derive(Eq)

    The added member and the resulting membership (etcdserverpb.MemberAddResponse).

    MemberAddResponse::decode

    MemberAddResponse::empty

    MemberAddResponse::encode

    fn MemberAddResponse::encode(self : MemberAddResponse) -> Bytes

    MemberAddResponse::equal

    MemberAddResponse::not_equal

    fn MemberAddResponse::not_equal(x : MemberAddResponse, y : MemberAddResponse) -> Bool

    MemberListRequest

    pub(all) struct MemberListRequest {
    linearizable : Bool
    } derive(Eq)

    List the cluster members (etcdserverpb.MemberListRequest).

    MemberListRequest::decode

    MemberListRequest::empty

    MemberListRequest::encode

    fn MemberListRequest::encode(self : MemberListRequest) -> Bytes

    MemberListRequest::equal

    MemberListRequest::not_equal

    fn MemberListRequest::not_equal(x : MemberListRequest, y : MemberListRequest) -> Bool

    MemberListResponse

    pub(all) struct MemberListResponse {
    header : ResponseHeader
    members : Array[Member]
    } derive(Eq)

    The membership (etcdserverpb.MemberListResponse).

    MemberListResponse::decode

    MemberListResponse::empty

    MemberListResponse::encode

    fn MemberListResponse::encode(self : MemberListResponse) -> Bytes

    MemberListResponse::equal

    MemberListResponse::not_equal

    MemberPromoteRequest

    pub(all) struct MemberPromoteRequest {
    id : UInt64
    } derive(Eq)

    Promote a learner member id to a voting member (etcdserverpb.MemberPromoteRequest).

    MemberPromoteRequest::decode

    MemberPromoteRequest::empty

    MemberPromoteRequest::encode

    fn MemberPromoteRequest::encode(self : MemberPromoteRequest) -> Bytes

    MemberPromoteRequest::equal

    MemberPromoteRequest::not_equal

    MemberPromoteResponse

    pub(all) struct MemberPromoteResponse {
    header : ResponseHeader
    members : Array[Member]
    } derive(Eq)

    The membership after a promotion (etcdserverpb.MemberPromoteResponse).

    MemberPromoteResponse::decode

    MemberPromoteResponse::empty

    MemberPromoteResponse::encode

    fn MemberPromoteResponse::encode(self : MemberPromoteResponse) -> Bytes

    MemberPromoteResponse::equal

    MemberPromoteResponse::not_equal

    MemberRemoveRequest

    pub(all) struct MemberRemoveRequest {
    id : UInt64
    } derive(Eq)

    Remove the member id (etcdserverpb.MemberRemoveRequest).

    MemberRemoveRequest::decode

    MemberRemoveRequest::empty

    MemberRemoveRequest::encode

    fn MemberRemoveRequest::encode(self : MemberRemoveRequest) -> Bytes

    MemberRemoveRequest::equal

    MemberRemoveRequest::not_equal

    MemberRemoveResponse

    pub(all) struct MemberRemoveResponse {
    header : ResponseHeader
    members : Array[Member]
    } derive(Eq)

    The membership after a removal (etcdserverpb.MemberRemoveResponse).

    MemberRemoveResponse::decode

    MemberRemoveResponse::empty

    MemberRemoveResponse::encode

    fn MemberRemoveResponse::encode(self : MemberRemoveResponse) -> Bytes

    MemberRemoveResponse::equal

    MemberRemoveResponse::not_equal

    MemberUpdateRequest

    pub(all) struct MemberUpdateRequest {
    id : UInt64
    peer_urls : Array[String]
    } derive(Eq)

    Change the peer URLs of member id (etcdserverpb.MemberUpdateRequest).

    MemberUpdateRequest::decode

    MemberUpdateRequest::empty

    MemberUpdateRequest::encode

    fn MemberUpdateRequest::encode(self : MemberUpdateRequest) -> Bytes

    MemberUpdateRequest::equal

    MemberUpdateRequest::not_equal

    MemberUpdateResponse

    pub(all) struct MemberUpdateResponse {
    header : ResponseHeader
    members : Array[Member]
    } derive(Eq)

    The membership after an update (etcdserverpb.MemberUpdateResponse).

    MemberUpdateResponse::decode

    MemberUpdateResponse::empty

    MemberUpdateResponse::encode

    fn MemberUpdateResponse::encode(self : MemberUpdateResponse) -> Bytes

    MemberUpdateResponse::equal

    MemberUpdateResponse::not_equal

    MoveLeaderRequest

    pub(all) struct MoveLeaderRequest {
    target_id : UInt64
    } derive(Eq)

    Move leadership to target_id (etcdserverpb.MoveLeaderRequest).

    MoveLeaderRequest::decode

    MoveLeaderRequest::empty

    MoveLeaderRequest::encode

    fn MoveLeaderRequest::encode(self : MoveLeaderRequest) -> Bytes

    MoveLeaderRequest::equal

    MoveLeaderRequest::not_equal

    fn MoveLeaderRequest::not_equal(x : MoveLeaderRequest, y : MoveLeaderRequest) -> Bool

    MoveLeaderResponse

    pub(all) struct MoveLeaderResponse {
    header : ResponseHeader
    } derive(Eq)

    Move-leadership reply (etcdserverpb.MoveLeaderResponse).

    MoveLeaderResponse::decode

    MoveLeaderResponse::empty

    MoveLeaderResponse::encode

    fn MoveLeaderResponse::encode(self : MoveLeaderResponse) -> Bytes

    MoveLeaderResponse::equal

    MoveLeaderResponse::not_equal

    Permission

    pub(all) struct Permission {
    key : Bytes
    range_end : Bytes
    perm_type : PermissionType
    } derive(Eq)

    A grant over [key, range_end) (etcdserverpb.Permission).

    Permission::decode

    Permission::empty

    fn Permission::empty() -> Permission

    Permission::encode

    fn Permission::encode(self : Permission) -> Bytes

    Permission::equal

    fn Permission::equal(Permission, Permission) -> Bool

    Permission::not_equal

    fn Permission::not_equal(x : Permission, y : Permission) -> Bool

    PermissionType

    pub(all) enum PermissionType {
    Read
    Write
    ReadWrite
    } derive(Eq)

    The kind of access a Permission grants (etcdserverpb.Permission.Type).

    PermissionType::equal

    PermissionType::from_int

    fn PermissionType::from_int(n : Int) -> PermissionType

    PermissionType::not_equal

    fn PermissionType::not_equal(x : PermissionType, y : PermissionType) -> Bool

    PermissionType::to_int

    fn PermissionType::to_int(self : PermissionType) -> Int

    ProclaimRequest

    pub(all) struct ProclaimRequest {
    leader : LeaderKey
    value : Bytes
    } derive(Eq)

    Update the value of a held leadership (v3election.ProclaimRequest).

    ProclaimRequest::decode

    ProclaimRequest::empty

    ProclaimRequest::encode

    fn ProclaimRequest::encode(self : ProclaimRequest) -> Bytes

    ProclaimRequest::equal

    ProclaimRequest::not_equal

    fn ProclaimRequest::not_equal(x : ProclaimRequest, y : ProclaimRequest) -> Bool

    ProclaimResponse

    pub(all) struct ProclaimResponse {
    header : ResponseHeader
    } derive(Eq)

    The reply to a proclaim (v3election.ProclaimResponse): just the header.

    ProclaimResponse::decode

    ProclaimResponse::empty

    ProclaimResponse::encode

    fn ProclaimResponse::encode(self : ProclaimResponse) -> Bytes

    ProclaimResponse::equal

    ProclaimResponse::not_equal

    fn ProclaimResponse::not_equal(x : ProclaimResponse, y : ProclaimResponse) -> Bool

    PutRequest

    pub(all) struct PutRequest {
    key : Bytes
    value : Bytes
    lease : Int64
    prev_kv : Bool
    ignore_value : Bool
    ignore_lease : Bool
    } derive(Eq)

    A write of value at key, optionally under lease (etcdserverpb.PutRequest).

    PutRequest::decode

    PutRequest::empty

    fn PutRequest::empty() -> PutRequest

    PutRequest::encode

    fn PutRequest::encode(self : PutRequest) -> Bytes

    PutRequest::equal

    fn PutRequest::equal(PutRequest, PutRequest) -> Bool

    PutRequest::not_equal

    fn PutRequest::not_equal(x : PutRequest, y : PutRequest) -> Bool

    PutResponse

    pub(all) struct PutResponse {
    header : ResponseHeader
    prev_kv : KeyValue
    } derive(Eq)

    The previous key/value a Put replaced, when prev_kv was set (etcdserverpb.PutResponse).

    PutResponse::decode

    PutResponse::empty

    fn PutResponse::empty() -> PutResponse

    PutResponse::encode

    fn PutResponse::encode(self : PutResponse) -> Bytes

    PutResponse::equal

    fn PutResponse::equal(PutResponse, PutResponse) -> Bool

    PutResponse::not_equal

    fn PutResponse::not_equal(x : PutResponse, y : PutResponse) -> Bool

    RangeRequest

    pub(all) struct RangeRequest {
    key : Bytes
    range_end : Bytes
    limit : Int64
    revision : Int64
    sort_order : SortOrder
    sort_target : SortTarget
    serializable : Bool
    keys_only : Bool
    count_only : Bool
    min_mod_revision : Int64
    max_mod_revision : Int64
    min_create_revision : Int64
    max_create_revision : Int64
    } derive(Eq)

    A read over [key, range_end) (empty range_end is a single key), optionally bounded, ordered, and pinned to a revision (etcdserverpb.RangeRequest).

    RangeRequest::decode

    RangeRequest::empty

    fn RangeRequest::empty() -> RangeRequest

    RangeRequest::encode

    fn RangeRequest::encode(self : RangeRequest) -> Bytes

    RangeRequest::equal

    RangeRequest::not_equal

    fn RangeRequest::not_equal(x : RangeRequest, y : RangeRequest) -> Bool

    RangeResponse

    pub(all) struct RangeResponse {
    header : ResponseHeader
    kvs : Array[KeyValue]
    more : Bool
    count : Int64
    } derive(Eq)

    The result of a Range (etcdserverpb.RangeResponse): the matched key/values, whether more remain beyond limit, and the total count in the range.

    RangeResponse::decode

    RangeResponse::empty

    RangeResponse::encode

    fn RangeResponse::encode(self : RangeResponse) -> Bytes

    RangeResponse::equal

    RangeResponse::not_equal

    fn RangeResponse::not_equal(x : RangeResponse, y : RangeResponse) -> Bool

    RequestOp

    pub(all) enum RequestOp {
    RequestRange(RangeRequest)
    RequestPut(PutRequest)
    RequestDeleteRange(DeleteRangeRequest)
    RequestTxn(TxnRequest)
    } derive(Eq)

    A step of a Txn, the oneof request_union of etcdserverpb.TxnRequest.

    RequestOp::decode

    RequestOp::encode

    fn RequestOp::encode(self : RequestOp) -> Bytes

    RequestOp::equal

    fn RequestOp::equal(RequestOp, RequestOp) -> Bool

    RequestOp::not_equal

    fn RequestOp::not_equal(x : RequestOp, y : RequestOp) -> Bool

    ResignRequest

    pub(all) struct ResignRequest {
    leader : LeaderKey
    } derive(Eq)

    Give up a held leadership (v3election.ResignRequest).

    ResignRequest::decode

    ResignRequest::empty

    ResignRequest::encode

    fn ResignRequest::encode(self : ResignRequest) -> Bytes

    ResignRequest::equal

    ResignRequest::not_equal

    fn ResignRequest::not_equal(x : ResignRequest, y : ResignRequest) -> Bool

    ResignResponse

    pub(all) struct ResignResponse {
    header : ResponseHeader
    } derive(Eq)

    Resign reply (v3election.ResignResponse).

    ResignResponse::decode

    ResignResponse::empty

    ResignResponse::encode

    fn ResignResponse::encode(self : ResignResponse) -> Bytes

    ResignResponse::equal

    ResignResponse::not_equal

    fn ResignResponse::not_equal(x : ResignResponse, y : ResignResponse) -> Bool

    ResponseHeader

    pub(all) struct ResponseHeader {
    cluster_id : UInt64
    member_id : UInt64
    revision : Int64
    raft_term : UInt64
    } derive(Eq)

    Per-call metadata etcd returns with every response (etcdserverpb.ResponseHeader).

    ResponseHeader::decode

    ResponseHeader::empty

    ResponseHeader::encode

    fn ResponseHeader::encode(self : ResponseHeader) -> Bytes

    ResponseHeader::equal

    ResponseHeader::not_equal

    fn ResponseHeader::not_equal(x : ResponseHeader, y : ResponseHeader) -> Bool

    ResponseOp

    pub(all) enum ResponseOp {
    ResponseRange(RangeResponse)
    ResponsePut(PutResponse)
    ResponseDeleteRange(DeleteRangeResponse)
    ResponseTxn(TxnResponse)
    } derive(Eq)

    The outcome of a Txn step, the oneof response_union of etcdserverpb.TxnResponse.

    ResponseOp::decode

    ResponseOp::encode

    fn ResponseOp::encode(self : ResponseOp) -> Bytes

    ResponseOp::equal

    fn ResponseOp::equal(ResponseOp, ResponseOp) -> Bool

    ResponseOp::not_equal

    fn ResponseOp::not_equal(x : ResponseOp, y : ResponseOp) -> Bool

    SnapshotRequest

    pub(all) struct SnapshotRequest {
    } derive(Eq)

    Snapshot of cluster state (etcdserverpb.SnapshotRequest).

    SnapshotRequest::decode

    fn SnapshotRequest::decode(data : Bytes) -> SnapshotRequest

    SnapshotRequest::encode

    fn SnapshotRequest::encode(self : SnapshotRequest) -> Bytes

    SnapshotRequest::equal

    SnapshotRequest::not_equal

    fn SnapshotRequest::not_equal(x : SnapshotRequest, y : SnapshotRequest) -> Bool

    SnapshotResponse

    pub(all) struct SnapshotResponse {
    header : ResponseHeader
    blob : Bytes
    remaining_bytes : Int64
    } derive(Eq)

    One chunk of a snapshot stream (etcdserverpb.SnapshotResponse).

    SnapshotResponse::decode

    SnapshotResponse::empty

    SnapshotResponse::encode

    fn SnapshotResponse::encode(self : SnapshotResponse) -> Bytes

    SnapshotResponse::equal

    SnapshotResponse::not_equal

    fn SnapshotResponse::not_equal(x : SnapshotResponse, y : SnapshotResponse) -> Bool

    SortOrder

    pub(all) enum SortOrder {
    None
    Ascend
    Descend
    } derive(Eq)

    Order of a ranged read (etcdserverpb.RangeRequest.SortOrder).

    SortOrder::equal

    fn SortOrder::equal(SortOrder, SortOrder) -> Bool

    SortOrder::from_int

    fn SortOrder::from_int(n : Int) -> SortOrder

    SortOrder::not_equal

    fn SortOrder::not_equal(x : SortOrder, y : SortOrder) -> Bool

    SortOrder::to_int

    fn SortOrder::to_int(self : SortOrder) -> Int

    SortTarget

    pub(all) enum SortTarget {
    Key
    Version
    Create
    Mod
    Value
    } derive(Eq)

    What a ranged read orders by (etcdserverpb.RangeRequest.SortTarget).

    SortTarget::equal

    fn SortTarget::equal(SortTarget, SortTarget) -> Bool

    SortTarget::from_int

    fn SortTarget::from_int(n : Int) -> SortTarget

    SortTarget::not_equal

    fn SortTarget::not_equal(x : SortTarget, y : SortTarget) -> Bool

    SortTarget::to_int

    fn SortTarget::to_int(self : SortTarget) -> Int

    Status

    pub(all) struct Status {
    code : Int
    message : String
    } derive(Eq)

    A gRPC status: the numeric code (one of the 17 gRPC codes) and the server's message. Surfaces when a call ends other than OK.

    Status::equal

    fn Status::equal(Status, Status) -> Bool

    Status::not_equal

    fn Status::not_equal(x : Status, y : Status) -> Bool

    Status::to_string

    fn Status::to_string(self : Status) -> String

    The message that comes with a Compacted or FutureRev error: the revision the server rejected.

    StatusResponse

    pub(all) struct StatusResponse {
    header : ResponseHeader
    version : String
    db_size : Int64
    leader : UInt64
    raft_index : UInt64
    raft_term : UInt64
    raft_applied_index : UInt64
    errors : Array[Alarm]
    db_size_in_use : Int64
    } derive(Eq)

    Cluster status (etcdserverpb.StatusResponse).

    StatusResponse::decode

    StatusResponse::empty

    StatusResponse::encode

    fn StatusResponse::encode(self : StatusResponse) -> Bytes

    StatusResponse::equal

    StatusResponse::not_equal

    fn StatusResponse::not_equal(x : StatusResponse, y : StatusResponse) -> Bool

    TlsConfig

    pub(all) struct TlsConfig {
    enabled : Bool
    ca_cert : Bytes
    cert : Bytes
    key : Bytes
    server_name : String
    } derive(Eq)

    TLS settings for a connection. enabled is honoured by the client only once the transport carries TLS; the record is present so callers can configure it now.

    TlsConfig::equal

    fn TlsConfig::equal(TlsConfig, TlsConfig) -> Bool

    TlsConfig::not_equal

    fn TlsConfig::not_equal(x : TlsConfig, y : TlsConfig) -> Bool

    TxnRequest

    pub(all) struct TxnRequest {
    compare : Array[Compare]
    success : Array[RequestOp]
    failure : Array[RequestOp]
    } derive(Eq)

    A conditional batch (etcdserverpb.TxnRequest): when every compare holds, the success ops run; otherwise the failure ops run.

    TxnRequest::decode

    TxnRequest::empty

    fn TxnRequest::empty() -> TxnRequest

    TxnRequest::encode

    fn TxnRequest::encode(self : TxnRequest) -> Bytes

    TxnRequest::equal

    fn TxnRequest::equal(TxnRequest, TxnRequest) -> Bool

    TxnRequest::not_equal

    fn TxnRequest::not_equal(x : TxnRequest, y : TxnRequest) -> Bool

    TxnResponse

    pub(all) struct TxnResponse {
    header : ResponseHeader
    succeeded : Bool
    responses : Array[ResponseOp]
    } derive(Eq)

    The result of a Txn (etcdserverpb.TxnResponse).

    TxnResponse::decode

    TxnResponse::empty

    fn TxnResponse::empty() -> TxnResponse

    TxnResponse::encode

    fn TxnResponse::encode(self : TxnResponse) -> Bytes

    TxnResponse::equal

    fn TxnResponse::equal(TxnResponse, TxnResponse) -> Bool

    TxnResponse::not_equal

    fn TxnResponse::not_equal(x : TxnResponse, y : TxnResponse) -> Bool

    UnlockRequest

    pub(all) struct UnlockRequest {
    key : Bytes
    } derive(Eq)

    Release the lock identified by key (v3lock.UnlockRequest).

    UnlockRequest::decode

    UnlockRequest::empty

    UnlockRequest::encode

    fn UnlockRequest::encode(self : UnlockRequest) -> Bytes

    UnlockRequest::equal

    UnlockRequest::not_equal

    fn UnlockRequest::not_equal(x : UnlockRequest, y : UnlockRequest) -> Bool

    UnlockResponse

    pub(all) struct UnlockResponse {
    header : ResponseHeader
    } derive(Eq)

    The header of a released lock (v3lock.UnlockResponse).

    UnlockResponse::decode

    UnlockResponse::empty

    UnlockResponse::encode

    fn UnlockResponse::encode(self : UnlockResponse) -> Bytes

    UnlockResponse::equal

    UnlockResponse::not_equal

    fn UnlockResponse::not_equal(x : UnlockResponse, y : UnlockResponse) -> Bool

    UserAddOptions

    pub(all) struct UserAddOptions {
    no_password : Bool
    } derive(Eq)

    Options for adding a user (etcdserverpb.UserAddOptions).

    UserAddOptions::decode

    UserAddOptions::empty

    UserAddOptions::encode

    fn UserAddOptions::encode(self : UserAddOptions) -> Bytes

    UserAddOptions::equal

    UserAddOptions::not_equal

    fn UserAddOptions::not_equal(x : UserAddOptions, y : UserAddOptions) -> Bool

    WatchCancelRequest

    pub(all) struct WatchCancelRequest {
    watch_id : Int64
    } derive(Eq)

    Close the watch watch_id (etcdserverpb.WatchCancelRequest).

    WatchCancelRequest::decode

    WatchCancelRequest::empty

    WatchCancelRequest::encode

    fn WatchCancelRequest::encode(self : WatchCancelRequest) -> Bytes

    WatchCancelRequest::equal

    WatchCancelRequest::not_equal

    WatchCreateRequest

    pub(all) struct WatchCreateRequest {
    key : Bytes
    range_end : Bytes
    start_revision : Int64
    progress_notify : Bool
    filters : Array[FilterType]
    prev_kv : Bool
    watch_id : Int64
    fragment : Bool
    } derive(Eq)

    Open a watch over [key, range_end) from start_revision (etcdserverpb.WatchCreateRequest).

    WatchCreateRequest::decode

    WatchCreateRequest::empty

    WatchCreateRequest::encode

    fn WatchCreateRequest::encode(self : WatchCreateRequest) -> Bytes

    WatchCreateRequest::equal

    WatchCreateRequest::not_equal

    WatchProgressRequest

    pub(all) struct WatchProgressRequest {
    } derive(Eq)

    Ask the server for a progress notification on an existing watch (etcdserverpb.WatchProgressRequest).

    WatchProgressRequest::decode

    fn WatchProgressRequest::decode(data : Bytes) -> WatchProgressRequest

    WatchProgressRequest::encode

    fn WatchProgressRequest::encode(self : WatchProgressRequest) -> Bytes

    WatchProgressRequest::equal

    WatchProgressRequest::not_equal

    WatchRequest

    pub(all) enum WatchRequest {
    CreateRequest(WatchCreateRequest)
    CancelRequest(WatchCancelRequest)
    ProgressRequest(WatchProgressRequest)
    } derive(Eq)

    One frame of the bidi Watch stream (etcdserverpb.WatchRequest.request_union).

    WatchRequest::decode

    WatchRequest::encode

    fn WatchRequest::encode(self : WatchRequest) -> Bytes

    WatchRequest::equal

    WatchRequest::not_equal

    fn WatchRequest::not_equal(x : WatchRequest, y : WatchRequest) -> Bool

    WatchResponse

    pub(all) struct WatchResponse {
    header : ResponseHeader
    watch_id : Int64
    created : Bool
    canceled : Bool
    events : Array[Event]
    compact_revision : Int64
    cancel_reason : String
    fragment : Bool
    } derive(Eq)

    A frame the server sends on the Watch stream (etcdserverpb.WatchResponse): the watch lifecycle flags and the batch of change events since the last frame.

    WatchResponse::decode

    WatchResponse::empty

    WatchResponse::encode

    fn WatchResponse::encode(self : WatchResponse) -> Bytes

    WatchResponse::equal

    WatchResponse::is_progress_notify

    fn WatchResponse::is_progress_notify(self : WatchResponse) -> Bool

    Whether this answer is a progress notification: a revision with nothing else in it, which is how the wire says so.

    WatchResponse::not_equal

    fn WatchResponse::not_equal(x : WatchResponse, y : WatchResponse) -> Bool

    default_client_config

    let default_client_config : ClientConfig

    The preset every connect falls back to: a five-second dial timeout, no auth, no TLS.

    default_tls

    let default_tls : TlsConfig

    exact

    fn exact(key : Bytes) -> (Bytes, Bytes)

    The range that covers exactly key and nothing else: [key, key + 1).

    has_prefix

    fn has_prefix(key : Bytes, prefix : Bytes) -> Bool

    True when key begins with prefix as a byte sequence.

    prefix

    fn prefix(key : Bytes) -> Bytes

    The end key of prefix_range: one past every key with key as its prefix.

    prefix_range

    fn prefix_range(key : Bytes) -> (Bytes, Bytes)

    The half-open [key, end) range that covers every key sharing key as a byte prefix. The end is key with its final byte incremented, dropping that byte when it would overflow 0xff — the rule etcd's own prefix follows.

    Powered by MoonBit

    Site sourceReport issueModulesSkillsBuild queueStatistics

    © 2026 mooncakes.io