moonsd service discovery

Reference

The API, module by module

Every public declaration of the four modules — 1847 of them across 15 packages — listed from the interfaces the compiler prints, with the prose from the doc comments. A method appears under the type it belongs to, and the interfaces are the ones the package exports, not a summary of them.

moonsd

55 public items

the contract: three traits, two helpers, a registry in this process and the suite every backend runs

moonsd

39 items · moonbitstack/moonsd
Types 8
pub(open) trait Discovery {
  async fn resolve(Self, String) -> Array[Endpoint]
  async fn watch(Self, String) -> &Watcher
}

Where a service's callers find its instances.

resolve answers once, with no endpoints for a service nobody registered. watch follows one service: its watcher's first next gives the service as it stands, and each later one waits for a change. Implement these two and View works for the backend.

pub(all) struct Endpoint {
  id : String
  host : String
  port : Int32
  weight : Int32
  metadata : Map[String, String]
}

One instance of a service. id tells it from the other instances of that service, and is the address unless given. weight and metadata are carried for whoever picks among endpoints; nothing here reads them.

pub(all) struct Lease {
  service : String
  endpoint : Endpoint
  ttl : Int32
  token : String
}

A registration: what Registrar::register hands back and takes again to renew or remove it. token is the backend's own handle (etcd's lease id, a Consul check), opaque to everyone else.

pub(all) suberror Refused {
  Malformed(String)
  Expired(Lease)
}

Why a value was refused. Malformed is text that is not an endpoint or a snapshot; Expired is a lease its backend no longer holds, which hold answers by registering again.

pub(open) trait Registrar {
  async fn register(Self, String, Endpoint, Int32) -> Lease
  async fn renew(Self, Lease) -> Unit
  async fn deregister(Self, Lease) -> Unit
}

Where a service's instances announce themselves.

register makes endpoint known under service for ttl milliseconds; renew extends that, and raises Expired once the backend has let it go; deregister removes it at once, and is harmless on a lease already gone. Implement these three and hold works for the backend.

pub(all) struct Update {
  endpoints : Array[Endpoint]
  revision : Int64
}

A service as it stands: all its live endpoints, and a revision that grows with every change a backend can number. A backend that numbers nothing counts its own updates.

pub struct View {
  // private fields
}

The latest word on a service, readable without waiting: one task runs follow, and the request path reads endpoints. Choosing an endpoint must not cost a round trip.

pub(open) trait Watcher {
  async fn next(Self) -> Update
  fn close(Self) -> Unit
}

One service followed. next gives whole snapshots rather than events, so losing a connection costs an implementation a reconnect and a caller nothing: reconnecting, and recovering from a compacted history, are the implementation's business, and what comes out is always what is true now. next raises when the watcher cannot go on; close ends it.

Values 3
pub let retry : Int32

How long View::follow waits before watching again after a watcher fails, in milliseconds.

pub let ttl : Int32

How long a registration lasts without being renewed, in milliseconds. Ten seconds is the interval a registry conventionally uses: long enough that one lost renewal is not fatal, short enough that an instance which died is noticed quickly.

pub let weight : Int32

The weight an endpoint carries unless it says otherwise.

Functions & methods 13
pub fn Endpoint::address(Self) -> String

host:port, with an IPv6 host in brackets, as a socket address is written.

pub fn Endpoint::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
pub fn Endpoint::new(String, Int32, id? : String, weight? : Int32, metadata? : Map[String, String]) -> Self
pub fn Endpoint::parse(StringView) -> Self raise Refused

An endpoint from host:port or [v6]:port.

pub fn Endpoint::to_json(Self) -> @json.Json
pub async fn hold(&Registrar, String, Endpoint, ttl? : Int32, report? : (Error) -> Unit) -> Unit

Keep endpoint registered under service until the task is cancelled, then remove it.

It renews every renew_after(ttl) milliseconds, a third of the lease. The first register failing is raised: nothing has been announced, and the caller should hear. After that a failure is a backend that went away, which is no reason to stop serving: it goes to report and the next round registers again, so the endpoint comes back with the backend.

pub fn renew_after(Int32) -> Int32

How long hold waits between two renewals of a lease of ttl milliseconds: a third, the interval a lease needs to survive two lost renewals. Never zero, so a tiny ttl does not turn the loop into a spin.

pub fn Update::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
pub fn Update::to_json(Self) -> @json.Json
pub fn View::endpoints(Self) -> Array[Endpoint]

The endpoints as last heard; empty until the first update.

pub async fn View::follow(Self, &Discovery, String, retry? : Int32, report? : (Error) -> Unit) -> Unit

Keep this view on service until the task is cancelled. When a watcher fails the view keeps what it last heard, since a stale list beats none, tells report, and watches again after retry milliseconds.

pub fn View::new() -> Self
pub fn View::revision(Self) -> Int64

The revision of the last update, 0 until the first.

Implementations 1
pub impl Show for Refused
Derived members14
pub fn Endpoint::equal(Self, Self) -> Bool
pub fn Endpoint::not_equal(Self, Self) -> Bool
pub fn Endpoint::to_repr(Self) -> @debug.Repr
pub fn Lease::equal(Self, Self) -> Bool
pub fn Lease::not_equal(Self, Self) -> Bool
pub fn Lease::to_repr(Self) -> @debug.Repr
pub fn Refused::equal(Self, Self) -> Bool
pub fn Refused::not_equal(Self, Self) -> Bool
pub fn Refused::output(Self, &Logger) -> Unit
pub fn Refused::to_repr(Self) -> @debug.Repr
pub fn Refused::to_string(Self) -> String
pub fn Update::equal(Self, Self) -> Bool
pub fn Update::not_equal(Self, Self) -> Bool
pub fn Update::to_repr(Self) -> @debug.Repr

memory

14 items · moonbitstack/moonsd/memory
Types 1
pub struct Registry {
  // private fields
}

A registry in this process: for tests, for a single-process deployment, and as the worked example of the contract.

With a now clock a lease ends ttl milliseconds after its last renewal, noticed by the next call that looks and by sweep; without one nothing expires, because this package reads no clock of its own.

Functions & methods 11
pub async fn Registry::deregister(Self, @moonsd.Lease) -> Unit
pub fn Registry::new(now? : () -> Int64) -> Self
pub async fn Registry::register(Self, String, @moonsd.Endpoint, Int32) -> @moonsd.Lease
pub async fn Registry::renew(Self, @moonsd.Lease) -> Unit
pub async fn Registry::resolve(Self, String) -> Array[@moonsd.Endpoint]
pub fn Registry::restore(StringView, now? : () -> Int64) -> Self raise @moonsd.Refused

A registry holding what snapshot wrote. Restored entries have no lease to renew and do not expire: whoever registered them registers again.

pub fn Registry::revision(Self) -> Int64

The revision, which grows with every change.

pub fn Registry::services(Self) -> Array[String]

The services that have an endpoint.

pub fn Registry::snapshot(Self) -> String

Everything registered, as text restore reads.

The revision goes out as the digits it holds rather than as a double, so a register that has numbered more changes than a double carries still comes back with the number it had.

pub fn Registry::sweep(Self) -> Unit

Drop every lease past its time.

pub async fn Registry::watch(Self, String) -> &@moonsd.Watcher
Implementations 2
pub impl @moonsd.Discovery for Registry
pub impl @moonsd.Registrar for Registry

conformance

2 items · moonbitstack/moonsd/conformance
Values 1
pub let settle : Int32

How long a backend has to show a change, in milliseconds: a backend may be eventually consistent, and these checks ask only that it gets there.

Functions & methods 1
pub async fn check(&@moonsd.Registrar, &@moonsd.Discovery, service? : String, settle? : Int32, expiry? : Bool) -> Unit

Run every behaviour the contract promises against one backend, under service, which must be unused; everything it registers it removes. A backend's own test suite calls this against a real server, so all backends are held to the same behaviour.

expiry covers a lease that is not renewed, which needs a backend that lets leases end. Raises at the first behaviour that does not hold, naming it.

moonredis

562 public items

a Redis client, and the contract carried by expiring keys

moonredis

518 items · moonbitstack/moonredis
Types 54
pub(all) struct AggregateOptions {
  verbatim : Bool
  load : Array[String]
  group_by : Array[String]
  reducers : Array[Reducer]
  apply : Array[(String, String)]
  sort_by : Array[SortKey]
  offset : Int64
  limit : Int64
  filter : String?
  params : Array[(String, Bytes)]
  dialect : Int32?
  timeout : Int64?
  cursor_count : Int64?
  max_idle : Int64?
}

The options FT.AGGREGATE takes besides the index and the query.

pub(all) struct AggregateResult {
  total : Int64
  rows : Array[Array[(String, FieldValue)]]
  cursor : Int64?
}

What FT.AGGREGATE and FT.CURSOR READ answer: the rows, and the cursor id to read more with.

pub struct Client {
  conn : &RedisConn
}

A redis client over a RedisConn: the typed command families are methods on it, and command is the general entry when a caller wants to send raw argument bytes.

pub(all) struct ClientOptions {
  host : String
  port : Int32
  username : String?
  password : String?
  db : Int32
  protocol : Protocol
  tls : @tls.Client?
  connect_timeout : Int64
  read_timeout : Int64
  write_timeout : Int64
  pool : PoolOptions
  retry : RetryOptions
  tracking : TrackingOptions
}

Everything needed to reach and speak to a redis: the endpoint and credentials, the protocol, the timeouts, and the pool, retry and tracking policies.

pub struct ClusterClient {
  nodes : Map[String, &RedisConn]
  mut topology : ClusterTopology
  limit : Int32
  dial : (async (String) -> &RedisConn raise RedisError)?
}

A cluster-aware client: it routes a command to the node owning its key and follows MOVED and ASK redirects. Built from a connection per node address and the topology.

A redirect can name a node it was not built with, after a reshard or a failover. dial opens a connection to such a node; without it that redirect is a Connection error.

pub struct ClusterSlot {
  start : Int32
  end : Int32
  node : String
}

A contiguous range of slots owned by one node, named by host:port.

pub struct ClusterTopology {
  slots : Array[ClusterSlot]
}

The slot-to-node map the client routes with.

pub(all) struct CompactionRule {
  destination : String
  bucket : Int64
  aggregator : String
}

A compaction rule: the series this one rolls into, how wide each bucket is, and how the bucket is reduced.

pub struct FakeConn {
  queue : Array[@resp.RespValue]
  mut at : Int32
  run : (Array[Bytes]) -> @resp.RespValue
  sent : Array[Array[Bytes]]
}

A redis connection backed by a scripted reply queue and, once the queue is spent, a handler keyed on the command sent. The tests drive the whole command surface through it without a socket, and the cluster and sentinel routing tests feed it handlers that mimic a node.

pub(all) enum FieldValue {
  Text(String)
  Integer(Int64)
  Number(Double)
  Null
}

One value in a search or aggregate reply: the fields of a document as text, and the computed values of an aggregation as the type the server sent.

pub(all) enum Fpha {
  Bf16
  Fp16
  Fp32
  Fp64
}

The float array storage JSON.SET may be told to use: FPHA BF16, FP16, FP32 or FP64.

pub(all) enum Fusion {
  Rrf
  Linear
}

How a hybrid query fuses the two branches.

pub(all) struct GeoFilter {
  field : String
  longitude : Double
  latitude : Double
  radius : Double
  unit : String
}

A distance a document's geo field must fall within.

pub(all) struct HybridOptions {
  knn : Int64
  ef_runtime : Int64?
  radius : (Double, Double)?
  fusion : Fusion?
  fusion_params : (Double, Double)?
  load : Array[String]
  sort_by : SortKey?
  offset : Int64
  limit : Int64
  filter : String?
  params : Array[(String, Bytes)]
  timeout : Int64?
}

The options FT.HYBRID takes besides the index, the text query and the vector.

pub(all) struct IndexField {
  identifier : String
  attribute : String
  type_ : String
  sortable : Bool
  unf : Bool
  noindex : Bool
  weight : Double
}

One indexed field as FT.INFO describes it.

pub(all) struct IndexInfo {
  name : String
  key_type : String
  prefixes : Array[String]
  filter : String?
  default_score : Double
  num_docs : Int64
  max_doc_id : Int64
  num_terms : Int64
  num_records : Int64
  indexing : Bool
  percent_indexed : Double
  indexing_failures : Int64
  attributes : Array[IndexField]
}

What FT.INFO reports about an index: its size, its schema and its settings.

pub(all) enum IndexKind {
  Hash
  Json
}

What an index is built over.

pub(all) struct Info {
  items : Map[String, InfoValue]
}

The name/value pairs an INFO reply holds, looked up by name. Redis answers these with a flat array under RESP2 and a map under RESP3; both come back as this.

pub(all) enum InfoValue {
  Text(String)
  Number(Double)
  Flag(Bool)
  Missing
}

One value in a module's INFO reply: the four shapes those replies use. A key the server did not report reads as Missing rather than raising, because the set of keys grows between versions.

pub struct Message {
  kind : String
  channel : String
  payload : Bytes
  pattern : String?
  count : Int64
}

One frame of the pub/sub stream. kind is the redis frame name (message, subscribe, ...); payload is the message body for a message/smessage frame, and count is the remaining subscription count for a subscribe/unsubscribe frame.

pub(all) struct MultiGetOptions {
  with_labels : Bool
  select_labels : Array[String]
  latest : Bool
}

The options a multi-series point query takes.

pub(all) struct MultiRangeOptions {
  range : RangeOptions
  with_labels : Bool
  select_labels : Array[String]
  group_by : String?
  reduce : String?
  exclude_empty : Bool
}

The options a multi-series query adds: which labels to carry, and how to group.

pub(all) struct NumericFilter {
  field : String
  min : String
  max : String
}

A numeric range a document's field must fall in.

pub struct PendingSummary {
  count : Int64
  min_id : String?
  max_id : String?
  consumers : Array[(String, Int64)]
}

The summary XPENDING returns for a group: how many pending, the first and last pending ids, and per-consumer pending counts.

pub struct Pipeline {
  conn : &RedisConn
  queue : Array[Array[Bytes]]
  mut transaction : Bool
}

A queued batch of commands against one connection. Add commands with add; run them with execute. Set multi first to send them inside MULTI/EXEC.

pub(all) struct PivotRow {
  timestamp : Int64
  values : Array[Double?]
}

One row of a reply pivoted by timestamp: the timestamp and one value per key, None where that key has no sample there.

pub(all) struct PoolOptions {
  max_idle : Int32
  max_active : Int32
  min_idle : Int32
  idle_timeout : Int64
  health_check : Bool
}

The pool a client draws connections from: its size bounds, how long an idle connection lives, and whether a borrowed connection is checked before use.

pub(all) enum Protocol {
  Resp2
  Resp3
}

Which RESP version to negotiate with HELLO. RESP2 is the long-standing wire; RESP3 adds the typed null, boolean, double, map, set and push values and is required for client-side caching.

pub(all) struct RangeOptions {
  latest : Bool
  filter_by_ts : Array[Int64]
  filter_by_value : (Double, Double)?
  count : Int64
  aggregation : String?
  bucket : Int64
  align : String?
  bucket_timestamp : String?
  empty : Bool
}

The options a range query takes: paging, filtering, and how to bucket the samples.

pub(all) enum Redirect {
  Moved(slot~ : Int32, node~ : String)
  Ask(slot~ : Int32, node~ : String)
}

Where a cluster node sent a command.

pub(open) trait RedisConn {
  async fn execute(Self, Array[Bytes]) -> @resp.RespValue raise RedisError
  async fn execute_all(Self, Array[Array[Bytes]]) -> Array[@resp.RespValue] raise RedisError = _
}

A live redis connection: it sends an encoded command (an array of argument byte strings) and returns the decoded reply. Implementations own the transport — a real socket speaking RESP, or an in-memory fake. It is open and async so a socket can be one: real redis I/O suspends, and a sealed synchronous trait left every implementation a test double.

pub(all) suberror RedisError {
  Reply(String)
  Connection(String)
  Protocol(String)
  Closed
  Aborted
}

Why a redis call failed: a redis error reply, a transport failure, a closed connection, a reply the client could not interpret as the command promised, or a transaction a watched key changed under.

pub(all) struct Reducer {
  function : String
  args : Array[String]
  as_ : String?
}

One REDUCE of an aggregation: a function, its arguments, and the name its result takes.

pub struct RetryConn {
  mut inner : &RedisConn
  retry : RetryOptions
  dial : (async () -> &RedisConn raise RedisError)?
  wait : (async (Int64) -> Unit noraise)?
}

A connection that retries transport failures up to retry.attempts times, leaving a redis error reply to surface at once. A dropped connection stays dropped, so a retry that is to reach the server needs dial to open another; wait sleeps for the backoff. @socket.connect_retrying wires both.

pub(all) struct RetryOptions {
  attempts : Int32
  base_delay : Int64
  max_delay : Int64
  level : Int32
  jitter : Bool
}

How a call retries after a transport failure: how many attempts in total, the backoff between them and how hard it backs off.

pub(all) struct Sample {
  timestamp : Int64
  value : Double
}

One sample: when it was recorded, and what it measured.

pub(all) struct Schema {
  on : IndexKind
  prefixes : Array[String]
  filter : String?
  language : String?
  language_field : String?
  score : Double?
  score_field : String?
  temporary : Int64?
  stopwords : Array[String]?
  fields : Array[SchemaField]
}

What FT.CREATE builds: the documents it reads and the fields it indexes.

pub(all) struct SchemaField {
  name : String
  kind : SchemaKind
  as_ : String?
  sortable : Bool
  unf : Bool
  noindex : Bool
  weight : Double?
  separator : String?
  case_sensitive : Bool
  phonetic : String?
  no_stem : Bool
  with_suffix_trie : Bool
  index_empty : Bool
  index_missing : Bool
  vector : VectorSpec?
}

One field of a schema: the document field it reads, the name queries use, and the options its type takes.

pub(all) enum SchemaKind {
  Text
  Tag
  Numeric
  Geo
  Vector
}

The type of one schema field.

pub struct Script {
  source : String
  // private fields
}

A Lua script run by its digest: loaded on first use, and loaded again if the server has forgotten it.

pub(all) struct SearchHit {
  id : String
  fields : Array[(String, @resp.RespValue)]
  score : Double?
  payload : Bytes?
  sort_key : String?
}

One document a query returned: its key, the fields asked for, and the score, payload or sort key when the query asked for them.

pub(all) struct SearchOptions {
  nocontent : Bool
  verbatim : Bool
  with_scores : Bool
  with_payloads : Bool
  with_sort_keys : Bool
  return_fields : Array[String]
  highlight : Array[String]
  summarize : Summarize?
  sort_by : SortKey?
  offset : Int64
  limit : Int64
  dialect : Int32?
  params : Array[(String, Bytes)]
  timeout : Int64?
  in_keys : Array[String]
  in_fields : Array[String]
  filter : NumericFilter?
  geo_filter : GeoFilter?
  scorer : String?
  slop : Int64?
  language : String?
  explain_score : Bool
}

The options FT.SEARCH takes besides the index and the query.

pub(all) struct SearchResult {
  total : Int64
  hits : Array[SearchHit]
  warnings : Array[String]
}

What FT.SEARCH and FT.HYBRID answer: how many documents matched, the ones this page returned, and any warning the query raised.

pub struct SentinelClient {
  sentinels : Array[&RedisConn]
}

A client that resolves a master address through a list of sentinel connections, trying each in turn until one answers.

pub(all) struct Series {
  key : String
  labels : Array[(String, String)]
  samples : Array[Sample]
}

One series of a multi-series reply: its key, its labels, and the samples the query selected.

pub(all) struct SortKey {
  field : String
  ascending : Bool
}

A field to sort by and the direction.

pub(all) struct SpellCheckTerm {
  term : String
  suggestions : Array[(Double, String)]
}

One term the index does not know, and what it suggests instead.

pub struct StreamEntry {
  id : String
  fields : Array[(String, String)]
}

One stream entry: its id and its field/value pairs.

pub(all) struct Summarize {
  fields : Array[String]
  fragments : Int64?
  length : Int64?
  separator : String?
}

Which fragments of each field SUMMARIZE returns, and with what separator.

pub(all) enum TimeBound {
  Min
  Max
  At(Int64)
}

A point in a range query: the earliest sample the series has, the latest, or a timestamp.

pub(all) struct TrackingOptions {
  enabled : Bool
  bcast : Bool
  optin : Bool
  optout : Bool
  noloop : Bool
  redirect : Int64?
}

Client-side caching (CLIENT TRACKING): whether keys this client reads are tracked so redis pushes invalidations, and in which mode.

pub(all) struct TsInfo {
  total_samples : Int64
  memory_usage : Int64
  first_timestamp : Int64
  last_timestamp : Int64
  retention_millis : Int64
  chunk_count : Int64
  chunk_size : Int64
  chunk_type : String
  duplicate_policy : String
  labels : Array[(String, String)]
  source_key : String?
  rules : Array[CompactionRule]
  ignore_max_time_diff : Int64
  ignore_max_val_diff : Double
}

What TS.INFO reports about a series.

pub(all) enum VectorAlgorithm {
  Flat
  Hnsw
}

How a vector field is indexed: Flat scans every vector, Hnsw builds a navigable small-world graph over them.

pub(all) struct VectorSpec {
  algorithm : VectorAlgorithm
  dim : Int32
  element : String
  distance : String
  initial_cap : Int64?
  block_size : Int64?
  m : Int64?
  ef_construction : Int64?
  ef_runtime : Int64?
  epsilon : Double?
}

The parameters a VECTOR field takes.

Values 11
pub let aggregate_default : AggregateOptions

FT.AGGREGATE's options at their documented defaults.

pub let client_default : ClientOptions
pub let hybrid_default : HybridOptions

FT.HYBRID's options at their documented defaults.

pub let multi_get_default : MultiGetOptions

Multi-series get options at their documented defaults.

pub let multi_range_default : MultiRangeOptions

Multi-series range options at their documented defaults.

pub let pool_default : PoolOptions
pub let range_default : RangeOptions

Range options at their documented defaults.

pub let redirect_limit : Int32

How many redirects one command may follow before giving up.

pub let retry_default : RetryOptions
pub let search_default : SearchOptions

FT.SEARCH's options at their documented defaults.

pub let tracking_default : TrackingOptions
Functions & methods 418
pub fn aggregate_field(Array[(String, FieldValue)], String) -> FieldValue?

The value of name in an aggregate row.

pub fn arg_bytes(Bytes) -> Bytes

A binary-safe argument, passed through unchanged.

pub fn arg_double(Double) -> Bytes

A Double argument as its decimal text.

pub fn arg_int(Int32) -> Bytes

An Int argument as its decimal text.

pub fn arg_int64(Int64) -> Bytes

An Int64 argument as its decimal text.

pub fn arg_string(String) -> Bytes

A string argument, UTF-8 encoded.

pub fn backoff_delay(Int32, RetryOptions) -> Int64

The delay before retry number attempt (0-based), growing as base * level^attempt and capped at max_delay. The transport adds jitter when the policy asks for it.

pub async fn Client::append(Self, String, String) -> Int64 raise RedisError

APPEND key value: append value to key, returning the new length in bytes.

pub async fn Client::auth(Self, String) -> Unit raise RedisError

AUTH password: authenticate with the default user.

pub async fn Client::auth_user(Self, String, String) -> Unit raise RedisError

AUTH user password: authenticate with a named ACL account.

pub async fn Client::bf_add(Self, String, String) -> Bool raise RedisError

BF.ADD key item: add an item, returning whether the filter changed — false when it probably held the item already.

pub async fn Client::bf_card(Self, String) -> Int64 raise RedisError

BF.CARD key: how many items were added, duplicates included.

pub async fn Client::bf_exists(Self, String, String) -> Bool raise RedisError

BF.EXISTS key item: whether the filter probably holds the item.

pub async fn Client::bf_info(Self, String) -> Info raise RedisError

BF.INFO key: capacity, memory and item counts.

pub async fn Client::bf_insert(Self, String, Array[String], capacity? : Int64, error_rate? : Double, expansion? : Int64, nocreate? : Bool, nonscaling? : Bool) -> Array[Bool] raise RedisError

BF.INSERT key [CAPACITY n] [ERROR rate] [EXPANSION n] [NOCREATE] [NONSCALING] ITEMS item...: add items, creating the filter from these parameters when it does not exist.

pub async fn Client::bf_loadchunk(Self, String, Int64, Bytes) -> Unit raise RedisError

BF.LOADCHUNK key iterator data: restore one chunk of a serialized filter.

pub async fn Client::bf_madd(Self, String, Array[String]) -> Array[Bool] raise RedisError

BF.MADD key item [item ...]: add items, one flag each.

pub async fn Client::bf_mexists(Self, String, Array[String]) -> Array[Bool] raise RedisError

BF.MEXISTS key item [item ...]: one answer per item.

pub async fn Client::bf_reserve(Self, String, Double, Int64, expansion? : Int64, nonscaling? : Bool) -> Unit raise RedisError

BF.RESERVE key error_rate capacity [EXPANSION expansion] [NONSCALING]: create a Bloom filter sized for capacity items at error_rate false positives. A filter that grows keeps its rate by adding sub-filters of expansion times the capacity; nonscaling fixes it at the initial size and starts refusing items when full.

pub async fn Client::bf_scandump(Self, String, Int64) -> (Int64, Bytes?) raise RedisError

BF.SCANDUMP key iterator: the next chunk of a serialized filter, and the iterator to ask for the one after it. Iteration ends when the iterator comes back as 0.

pub async fn Client::bgrewriteaof(Self) -> String raise RedisError

BGREWRITEAOF: start a background rewrite of the append-only file.

pub async fn Client::bgsave(Self) -> String raise RedisError

BGSAVE: start a background save, returning the status line.

pub async fn Client::bitcount(Self, String, start? : Int32, end? : Int32) -> Int64 raise RedisError

BITCOUNT key [start end]: the number of set bits, optionally within a byte range.

pub async fn Client::bitop(Self, String, String, Array[String]) -> Int64 raise RedisError

BITOP op dest key...: store the bitwise AND/OR/XOR of the keys, or the NOT of a single key, in dest, returning the result length in bytes.

pub async fn Client::bitpos(Self, String, Int32, start? : Int32, end? : Int32) -> Int64 raise RedisError

BITPOS key bit [start end]: the first bit equal to bit (0 or 1), optionally within a byte range. -1 if none is found.

pub async fn Client::blmove(Self, String, String, String, String, Int32) -> Bytes? raise RedisError

BLMOVE source destination wherefrom whereto timeout: blocking LMOVE.

pub async fn Client::blpop(Self, Array[String], Int32) -> (String, Bytes)? raise RedisError

BLPOP key... timeout: blocking pop of the first available head element across the given keys, waiting up to timeout seconds (0 = forever). Returns the key and value, or None on timeout.

pub async fn Client::brpop(Self, Array[String], Int32) -> (String, Bytes)? raise RedisError

BRPOP key... timeout: blocking pop of the first available tail element across the given keys. Returns the key and value, or None on timeout.

pub async fn Client::brpoplpush(Self, String, String, Int32) -> Bytes? raise RedisError

BRPOPLPUSH source destination timeout: blocking RPOPLPUSH.

pub async fn Client::bzpopmax(Self, Array[String], Int32) -> (String, String, Double)? raise RedisError

BZPOPMAX key... timeout: blocking pop of the highest-scoring member across keys.

pub async fn Client::bzpopmin(Self, Array[String], Int32) -> (String, String, Double)? raise RedisError

BZPOPMIN key... timeout: blocking pop of the lowest-scoring member across keys. Returns (key, member, score), or None on timeout.

pub async fn Client::cf_add(Self, String, String) -> Bool raise RedisError

CF.ADD key item: add an item, returning whether it was added.

pub async fn Client::cf_addnx(Self, String, String) -> Bool raise RedisError

CF.ADDNX key item: add an item only if the filter does not hold it yet.

pub async fn Client::cf_count(Self, String, String) -> Int64 raise RedisError

CF.COUNT key item: how many times the item was added.

pub async fn Client::cf_del(Self, String, String) -> Bool raise RedisError

CF.DEL key item: remove one occurrence of an item. True if it was there.

pub async fn Client::cf_exists(Self, String, String) -> Bool raise RedisError

CF.EXISTS key item: whether the filter probably holds the item.

pub async fn Client::cf_info(Self, String) -> Info raise RedisError

CF.INFO key: size, buckets and item counts.

pub async fn Client::cf_insert(Self, String, Array[String], capacity? : Int64, nocreate? : Bool) -> Array[Bool] raise RedisError

CF.INSERT key [CAPACITY n] [NOCREATE] ITEMS item...: add items, creating the filter when it does not exist.

pub async fn Client::cf_insertnx(Self, String, Array[String], capacity? : Int64, nocreate? : Bool) -> Array[Bool] raise RedisError

CF.INSERTNX key [CAPACITY n] [NOCREATE] ITEMS item...: add the items the filter does not hold yet.

pub async fn Client::cf_loadchunk(Self, String, Int64, Bytes) -> Unit raise RedisError

CF.LOADCHUNK key iterator data: restore one chunk of a serialized filter.

pub async fn Client::cf_mexists(Self, String, Array[String]) -> Array[Bool] raise RedisError

CF.MEXISTS key item [item ...]: one answer per item.

pub async fn Client::cf_reserve(Self, String, Int64, bucket_size? : Int64, max_iterations? : Int64, expansion? : Int64) -> Unit raise RedisError

CF.RESERVE key capacity [BUCKETSIZE n] [MAXITERATIONS n] [EXPANSION n]: create a cuckoo filter for capacity items.

pub async fn Client::cf_scandump(Self, String, Int64) -> (Int64, Bytes?) raise RedisError

CF.SCANDUMP key iterator: the next chunk of a serialized filter, and the iterator for the one after it.

pub async fn Client::client_getname(Self) -> String? raise RedisError

CLIENT GETNAME: this connection's name, or None if unset.

pub async fn Client::client_id(Self) -> Int64 raise RedisError

CLIENT ID: this connection's numeric id.

pub async fn Client::client_kill(Self, Array[String]) -> Int64 raise RedisError

CLIENT KILL [ID id] [ADDR host:port] [TYPE ...] [SKIPME yes/no]: close matching client connections.

pub async fn Client::client_setname(Self, String) -> Unit raise RedisError

CLIENT SETNAME name: label this connection in CLIENT LIST.

pub async fn Client::cluster_slots(Self) -> @resp.RespValue raise RedisError

CLUSTER SLOTS: the cluster's slot map, as the raw reply (each caller decodes it).

pub async fn Client::cms_incrby(Self, String, Array[(String, Int64)]) -> Array[Int64] raise RedisError

CMS.INCRBY key item increment [item increment ...]: add to the counts, returning the new count of each item.

pub async fn Client::cms_info(Self, String) -> Info raise RedisError

CMS.INFO key: width, depth and total count.

pub async fn Client::cms_initbydim(Self, String, Int64, Int64) -> Unit raise RedisError

CMS.INITBYDIM key width depth: create a count-min sketch of width counters per row and depth rows. The error is about 1/width of the total count, the failure probability about 1/2^depth.

pub async fn Client::cms_initbyprob(Self, String, Double, Double) -> Unit raise RedisError

CMS.INITBYPROB key error probability: create a count-min sketch from the error it may make relative to the total count, and the probability of exceeding it.

pub async fn Client::cms_merge(Self, String, Array[String], weights? : Array[Int64]) -> Unit raise RedisError

CMS.MERGE destination numKeys source... [WEIGHTS w...]: add several sketches into destination, each scaled by its weight.

pub async fn Client::cms_query(Self, String, Array[String]) -> Array[Int64] raise RedisError

CMS.QUERY key item [item ...]: the estimated count of each item.

pub async fn Client::command(Self, Array[Bytes]) -> @resp.RespValue raise RedisError

Send args as a command and return the reply, turning a redis error reply (-ERR or a bulk error) into RedisError::Reply. A transport failure raises from execute as a Connection or Closed error, unchanged.

pub async fn Client::command_count(Self) -> Int64 raise RedisError

COMMAND COUNT: the number of commands the server implements.

pub async fn Client::config_get(Self, String) -> Array[(String, String)] raise RedisError

CONFIG GET parameter: the current value(s) of a config parameter (which may match several via a glob), as alternating name/value pairs.

pub async fn Client::config_resetstat(Self) -> Unit raise RedisError

CONFIG RESETSTAT: reset the server's statistics counters.

pub async fn Client::config_rewrite(Self) -> Unit raise RedisError

CONFIG REWRITE: persist the running config to the config file.

pub async fn Client::config_set(Self, String, String) -> Unit raise RedisError

CONFIG SET parameter value: change a config parameter at runtime.

pub async fn Client::copy(Self, String, String, db? : Int32, replace? : Bool) -> Bool raise RedisError

COPY source destination [DB n] [REPLACE]: copy source to destination. true if copied.

pub async fn Client::dbsize(Self) -> Int64 raise RedisError

DBSIZE: the number of keys in the selected database.

pub async fn Client::decr(Self, String) -> Int64 raise RedisError

DECR key: decrement key's integer value by 1, returning the result.

pub async fn Client::decrby(Self, String, Int64) -> Int64 raise RedisError

DECRBY key n: subtract n from key's integer value, returning the result.

pub async fn Client::del(Self, Array[String]) -> Int64 raise RedisError

DEL key...: delete the given keys, returning how many existed.

pub async fn Client::discard(Self) -> Unit raise RedisError

DISCARD: abort a transaction started with MULTI.

pub async fn Client::dump(Self, String) -> Bytes? raise RedisError

DUMP key: serialise key's value to a binary dump, or None if the key is absent.

pub async fn Client::echo(Self, String) -> Bytes raise RedisError

ECHO message: return message unchanged (a larger round-trip probe than PING).

pub async fn Client::eval(Self, String, Array[String], Array[String]) -> @resp.RespValue raise RedisError

EVAL script numkeys key... arg...: run script, declaring how many of the leading arguments are keys. Returns the script's (arbitrary) reply.

pub async fn Client::evalsha(Self, String, Array[String], Array[String]) -> @resp.RespValue raise RedisError

EVALSHA sha numkeys key... arg...: run a script by its SCRIPT LOAD digest.

pub async fn Client::exists(Self, Array[String]) -> Int64 raise RedisError

EXISTS key...: the number of the given keys that exist.

pub async fn Client::expire(Self, String, Int64) -> Bool raise RedisError

EXPIRE key secs: set a secs-second expiry on key. false if the key is absent.

pub async fn Client::expireat(Self, String, Int64) -> Bool raise RedisError

EXPIREAT key ts: expire key at the given Unix second. false if the key is absent.

pub async fn Client::flushall(Self, sync? : Bool) -> Unit raise RedisError

FLUSHALL [ASYNC|SYNC]: delete every key in every database.

pub async fn Client::flushdb(Self, sync? : Bool) -> Unit raise RedisError

FLUSHDB [ASYNC|SYNC]: delete every key in the selected database.

pub async fn Client::ft_aggregate(Self, String, String, options? : AggregateOptions) -> AggregateResult raise RedisError

FT.AGGREGATE index query [options]: run the pipeline of loads, groupings, applies, sorts and filters options describes over the matching documents.

pub async fn Client::ft_aliasadd(Self, String, String) -> Unit raise RedisError

FT.ALIASADD alias index: make alias another name for index.

pub async fn Client::ft_aliasdel(Self, String) -> Unit raise RedisError

FT.ALIASDEL alias: drop an alias.

pub async fn Client::ft_aliasupdate(Self, String, String) -> Unit raise RedisError

FT.ALIASUPDATE alias index: point an existing alias at another index.

pub async fn Client::ft_alter(Self, String, Array[SchemaField], skip_initial_scan? : Bool) -> Unit raise RedisError

FT.ALTER index [SKIPINITIALSCAN] SCHEMA ADD field...: add fields to a live index. skip_initial_scan leaves the documents already indexed unbackfilled.

pub async fn Client::ft_config_get(Self, String) -> Array[(String, String)] raise RedisError

FT.CONFIG GET pattern: the settings whose names match.

pub async fn Client::ft_config_set(Self, String, String) -> Unit raise RedisError

FT.CONFIG SET name value: change a search setting.

pub async fn Client::ft_create(Self, String, Schema) -> Unit raise RedisError

FT.CREATE index [ON HASH|JSON] [PREFIX n ...] [FILTER expr] [LANGUAGE l] [LANGUAGE_FIELD f] [SCORE s] [SCORE_FIELD f] [TEMPORARY secs] [STOPWORDS n ...] SCHEMA field...: build an index over the documents schema describes.

pub async fn Client::ft_cursor_del(Self, String, Int64) -> Unit raise RedisError

FT.CURSOR DEL index cursor: drop a cursor and the rows it still holds.

pub async fn Client::ft_cursor_read(Self, String, Int64, count? : Int64) -> AggregateResult raise RedisError

FT.CURSOR READ index cursor [COUNT n]: the next page of an aggregation.

pub async fn Client::ft_dictadd(Self, String, Array[String]) -> Int64 raise RedisError

FT.DICTADD dictionary term [term ...]: add terms to a spelling dictionary, returning how many were new.

pub async fn Client::ft_dictdel(Self, String, Array[String]) -> Int64 raise RedisError

FT.DICTDEL dictionary term [term ...]: remove terms, returning how many existed.

pub async fn Client::ft_dictdump(Self, String) -> Array[String] raise RedisError

FT.DICTDUMP dictionary: every term in a dictionary.

pub async fn Client::ft_dropindex(Self, String, delete_documents? : Bool) -> Unit raise RedisError

FT.DROPINDEX index [DD]: drop an index, and with delete_documents the documents it indexed.

pub async fn Client::ft_explain(Self, String, String, dialect? : Int32) -> String raise RedisError

FT.EXPLAIN index query [DIALECT d]: the query as the engine interprets it.

pub async fn Client::ft_explaincli(Self, String, String, dialect? : Int32) -> Array[String] raise RedisError

FT.EXPLAINCLI index query [DIALECT d]: the same, one line per node.

pub async fn Client::ft_hybrid(Self, String, String, String, Bytes, options? : HybridOptions) -> SearchResult raise RedisError

FT.HYBRID index SEARCH query VSIM @field $vector [KNN ...] [COMBINE ...] [LOAD ...] [SORTBY ...] [LIMIT ...] [FILTER ...] PARAMS ...: rank documents by a text search and a vector search at once. vector is the query vector as the field's element type writes it, and vector_field the name of the schema field it is compared against.

pub async fn Client::ft_info(Self, String) -> IndexInfo raise RedisError

FT.INFO index: the index's size, schema and settings.

pub async fn Client::ft_list(Self) -> Array[String] raise RedisError

FT._LIST: the names of the indexes.

pub async fn Client::ft_profile(Self, String, Bool, String, limited? : Bool) -> @resp.RespValue raise RedisError

FT.PROFILE index SEARCH|AGGREGATE [LIMITED] QUERY query: the ordinary reply and the timing breakdown beside it, as the protocol carries them. The second element is a nested profile whose shape the search engine documents, so it stays as it arrives.

pub async fn Client::ft_search(Self, String, String, options? : SearchOptions) -> SearchResult raise RedisError

FT.SEARCH index query [options]: the documents that match query, with the scoring, paging, sorting and projection options asks for.

pub async fn Client::ft_spellcheck(Self, String, String, distance? : Int32, dialect? : Int32) -> Array[SpellCheckTerm] raise RedisError

FT.SPELLCHECK index query [DISTANCE d] [DIALECT d]: the query terms the index knows nothing about, and what it suggests instead.

pub async fn Client::ft_sugadd(Self, String, String, Double, increment? : Bool, payload? : String) -> Int64 raise RedisError

FT.SUGADD key suggestion score [INCR] [PAYLOAD payload]: add a completion, returning how many suggestions the key holds.

pub async fn Client::ft_sugdel(Self, String, String) -> Bool raise RedisError

FT.SUGDEL key suggestion: remove a completion. True if it was there.

pub async fn Client::ft_sugget(Self, String, String, fuzzy? : Bool, max? : Int64) -> Array[String] raise RedisError

FT.SUGGET key prefix [FUZZY] [MAX n]: the completions starting with prefix.

pub async fn Client::ft_sugget_scored(Self, String, String, fuzzy? : Bool, max? : Int64) -> Array[(String, Double)] raise RedisError

FT.SUGGET key prefix WITHSCORES: the completions and their scores.

pub async fn Client::ft_suglen(Self, String) -> Int64 raise RedisError

FT.SUGLEN key: how many completions a key holds.

pub async fn Client::ft_syndump(Self, String) -> Array[(String, Array[String])] raise RedisError

FT.SYNDUMP index: each term that has synonyms, and the groups it belongs to.

pub async fn Client::ft_synupdate(Self, String, String, Array[String], skip_initial_scan? : Bool) -> Unit raise RedisError

FT.SYNUPDATE index group [SKIPINITIALSCAN] term [term ...]: put the terms in one synonym group.

pub async fn Client::ft_tagvals(Self, String, String) -> Array[String] raise RedisError

FT.TAGVALS index field: the distinct values of a tag field.

pub async fn Client::function_call(Self, String, Array[String], Array[String]) -> @resp.RespValue raise RedisError

FCALL function numkeys key... arg...: call a registered function.

pub async fn Client::function_delete(Self, String) -> Unit raise RedisError

FUNCTION DELETE name: delete a function library by name.

pub async fn Client::function_flush(Self) -> Unit raise RedisError

FUNCTION FLUSH: discard every registered function library.

pub async fn Client::function_load(Self, String, replace? : Bool) -> String raise RedisError

FUNCTION LOAD [REPLACE] code: register a functions library, returning its name.

pub async fn Client::geoadd(Self, String, Array[(String, Double, Double)]) -> Int64 raise RedisError

GEOADD key longitude latitude member...: index the members, returning how many were new.

pub async fn Client::geodist(Self, String, String, String, unit? : String) -> Double? raise RedisError

GEODIST key a b [unit]: the distance between members a and b, or None if a member is absent. unit is one of m, km, mi, ft (metres by default).

pub async fn Client::geohash(Self, String, Array[String]) -> Array[String?] raise RedisError

GEOHASH key member...: the geohash string of each member, None where absent.

pub async fn Client::geopos(Self, String, Array[String]) -> Array[(Double, Double)?] raise RedisError

GEOPOS key member...: the [longitude, latitude] of each member, None where absent.

pub async fn Client::geosearch(Self, String, from_member? : String, longitude? : Double, latitude? : Double, radius? : Double, width? : Double, height? : Double, String, count? : Int32, asc? : Bool, desc? : Bool) -> Array[String] raise RedisError

GEOSEARCH key [FROMMEMBER m] [FROMLONLAT lon lat] [BYRADIUS r unit] [BYBOX w h unit] [COUNT n] [ASC|DESC]: the members matching a circular or rectangular area, optionally ordered and capped. Returns the member names.

pub async fn Client::get(Self, String) -> Bytes? raise RedisError

GET key: the value at key, or None if absent or expired.

pub async fn Client::getbit(Self, String, Int64) -> Int64 raise RedisError

GETBIT key offset: the bit at offset (0 or 1).

pub async fn Client::getdel(Self, String) -> Bytes? raise RedisError

GETDEL key: return key's value and delete the key, or None if absent.

pub async fn Client::getex(Self, String, ex? : Int64, px? : Int64, exat? : Int64, pxat? : Int64, persist? : Bool) -> Bytes? raise RedisError

GETEX key [EX secs] [PX ms] [EXAT secs] [PXAT ms] [PERSIST]: return key's value and apply or clear its expiry, or None if absent.

pub async fn Client::getrange(Self, String, Int32, Int32) -> Bytes raise RedisError

GETRANGE key start end: the substring of key from start to end (inclusive, negative from the end).

pub async fn Client::hdel(Self, String, Array[String]) -> Int64 raise RedisError

HDEL key field...: delete the given fields, returning how many existed.

pub async fn Client::hexists(Self, String, String) -> Bool raise RedisError

HEXISTS key field: whether field exists in the hash.

pub async fn Client::hget(Self, String, String) -> Bytes? raise RedisError

HGET key field: the value at field, or None if the key or field is absent.

pub async fn Client::hgetall(Self, String) -> Array[(String, String)] raise RedisError

HGETALL key: every field/value pair as an array of alternating field, value.

pub async fn Client::hincrby(Self, String, String, Int64) -> Int64 raise RedisError

HINCRBY key field n: add n to field's integer value, returning the result.

pub async fn Client::hincrbyfloat(Self, String, String, Double) -> Double raise RedisError

HINCRBYFLOAT key field f: add f to field's value, returning the new value.

pub async fn Client::hkeys(Self, String) -> Array[String] raise RedisError

HKEYS key: the field names of the hash.

pub async fn Client::hlen(Self, String) -> Int64 raise RedisError

HLEN key: the number of fields in the hash.

pub async fn Client::hmget(Self, String, Array[String]) -> Array[Bytes?] raise RedisError

HMGET key field...: the value at each field, None where absent, in order.

pub async fn Client::hmset(Self, String, Array[(String, String)]) -> Unit raise RedisError

HMSET key field value...: set several fields atomically. Deprecated in favour of HSET, kept because servers still answer it and callers still send it.

pub async fn Client::hrandfield(Self, String, count? : Int32) -> Array[String] raise RedisError

HRANDFIELD key [count] [WITHVALUES]: one or more random fields, optionally with their values.

pub async fn Client::hrandfield_values(Self, String, Int32) -> Array[(String, String)] raise RedisError

HRANDFIELD key count WITHVALUES: random fields with their values. A negative count may repeat a field.

pub async fn Client::hscan(Self, String, String, pattern? : String, count? : Int32) -> (String, Array[(String, String)]) raise RedisError

HSCAN key cursor [MATCH pattern] [COUNT n]: an incremental hash field scan. Returns the next cursor and the field/value pairs found this call.

pub async fn Client::hset(Self, String, Array[(String, String)]) -> Int64 raise RedisError

HSET key field value...: set one or more fields, returning the count of fields that were new.

pub async fn Client::hsetnx(Self, String, String, String) -> Bool raise RedisError

HSETNX key field value: set field only if absent. true if set.

pub async fn Client::hstrlen(Self, String, String) -> Int64 raise RedisError

HSTRLEN key field: the byte length of field's value (0 if absent).

pub async fn Client::hvals(Self, String) -> Array[String] raise RedisError

HVALS key: the values of the hash.

pub async fn Client::incr(Self, String) -> Int64 raise RedisError

INCR key: increment key's integer value by 1, returning the result.

pub async fn Client::incrby(Self, String, Int64) -> Int64 raise RedisError

INCRBY key n: add n to key's integer value, returning the result.

pub async fn Client::info(Self, section? : String) -> String raise RedisError

INFO [section]: the server's key/value metrics, as the raw text block redis returns.

pub async fn Client::json_arrappend(Self, String, String, Array[@json.Json]) -> Array[Int64?] raise RedisError

JSON.ARRAPPEND key path value [value ...]: append the values to each array at path, returning the new lengths.

pub async fn Client::json_arrindex(Self, String, String, @json.Json, start? : Int64, stop? : Int64) -> Array[Int64?] raise RedisError

JSON.ARRINDEX key path value [START start] [STOP stop]: the first position of value in each array at path, -1 when absent.

pub async fn Client::json_arrinsert(Self, String, String, Int64, Array[@json.Json]) -> Array[Int64?] raise RedisError

JSON.ARRINSERT key path index value [value ...]: insert the values at index in each array at path, returning the new lengths.

pub async fn Client::json_arrlen(Self, String, path? : String) -> Array[Int64?] raise RedisError

JSON.ARRLEN key [path]: the length of each array at path.

pub async fn Client::json_arrpop(Self, String, String, index? : Int64) -> Array[@json.Json?] raise RedisError

JSON.ARRPOP key [path] [index]: pop an element from each array at path, index -1 being the last, returning the popped values.

pub async fn Client::json_arrtrim(Self, String, String, Int64, Int64) -> Array[Int64?] raise RedisError

JSON.ARRTRIM key path start stop: trim each array at path to the inclusive range, returning the new lengths.

pub async fn Client::json_clear(Self, String, path? : String) -> Int64 raise RedisError

JSON.CLEAR key [path]: empty the arrays and objects at path, returning how many values were cleared.

pub async fn Client::json_debug_memory(Self, String, path? : String) -> Int64 raise RedisError

JSON.DEBUG MEMORY key [path]: the bytes the value at path occupies.

pub async fn Client::json_del(Self, String, path? : String) -> Int64 raise RedisError

JSON.DEL key [path]: delete the document or the part at path, returning how many values were removed.

pub async fn Client::json_forget(Self, String, path? : String) -> Int64 raise RedisError

JSON.FORGET key [path]: the older name for JSON.DEL.

pub async fn Client::json_get(Self, String, path? : String) -> @json.Json? raise RedisError

JSON.GET key [path]: the document, or the part of it at path, or None when the key is missing. A JSONPath that matches nothing yields an empty array, which is not None.

pub async fn Client::json_get_text(Self, String, path? : String, indent? : String, newline? : String, space? : String) -> String? raise RedisError

JSON.GET key [INDENT i] [NEWLINE n] [SPACE s] [path]: the reply exactly as the server wrote it, formatting included.

pub async fn Client::json_merge(Self, String, String, @json.Json) -> Unit raise RedisError

JSON.MERGE key path value: merge value into the object at path, by RFC 7396: a null member removes the member, an object merges recursively, anything else replaces.

pub async fn Client::json_mget(Self, Array[String], String) -> Array[@json.Json?] raise RedisError

JSON.MGET key [key ...] path: the value at path in each key, None where a key has nothing there.

pub async fn Client::json_mset(Self, Array[(String, String, @json.Json)]) -> Unit raise RedisError

JSON.MSET key path value [key path value ...]: set several documents at once, all or none.

pub async fn Client::json_numincrby(Self, String, String, Double) -> Array[Double?] raise RedisError

JSON.NUMINCRBY key path value: add value to each number at path, returning the new values.

pub async fn Client::json_nummultby(Self, String, String, Double) -> Array[Double?] raise RedisError

JSON.NUMMULTBY key path value: multiply each number at path by value, returning the new values.

pub async fn Client::json_objkeys(Self, String, path? : String) -> Array[Array[String]?] raise RedisError

JSON.OBJKEYS key [path]: the member names of each object at path.

pub async fn Client::json_objlen(Self, String, path? : String) -> Array[Int64?] raise RedisError

JSON.OBJLEN key [path]: the number of members of each object at path.

pub async fn Client::json_resp(Self, String, path? : String) -> @resp.RespValue raise RedisError

JSON.RESP key [path]: the value as RESP itself, with [ and { markers for arrays and objects. It is the one JSON command whose reply is not a JSON document.

pub async fn Client::json_set(Self, String, String, @json.Json, nx? : Bool, xx? : Bool, fpha? : Fpha) -> Bool raise RedisError

JSON.SET key path value [NX|XX] [FPHA type]: store value at path in key. Returns false when nx or xx leaves the key unchanged.

pub async fn Client::json_strappend(Self, String, String, String) -> Array[Int64?] raise RedisError

JSON.STRAPPEND key [path] value: append value, a JSON string, to each string at path, returning the new lengths.

pub async fn Client::json_strlen(Self, String, path? : String) -> Array[Int64?] raise RedisError

JSON.STRLEN key [path]: the length of each string at path.

pub async fn Client::json_toggle(Self, String, String) -> Array[Bool?] raise RedisError

JSON.TOGGLE key path: flip each boolean at path, returning the new values.

pub async fn Client::json_type(Self, String, path? : String) -> Array[String?] raise RedisError

JSON.TYPE key [path]: the JSON type of each value at path — object, array, string, integer, number, boolean or null — None where nothing matched.

pub async fn Client::keys(Self, String) -> Array[String] raise RedisError

KEYS pattern: every key matching pattern. Use scan in production.

pub async fn Client::lastsave(Self) -> Int64 raise RedisError

LASTSAVE: the Unix timestamp of the last successful save to disk.

pub async fn Client::lindex(Self, String, Int32) -> Bytes? raise RedisError

LINDEX key index: the element at index, or None if out of range.

pub async fn Client::linsert(Self, String, String, String, String) -> Int64 raise RedisError

LINSERT key where pivot value: insert value before (BEFORE) or after (AFTER) pivot. Returns the new length, or -1 when pivot is absent.

pub async fn Client::llen(Self, String) -> Int64 raise RedisError

LLEN key: the length of the list.

pub async fn Client::lmove(Self, String, String, String, String) -> Bytes? raise RedisError

LMOVE source destination LEFT|RIGHT LEFT|RIGHT: pop from one end of source and push to one end of destination, returning the element, or None when empty.

pub async fn Client::lpop(Self, String) -> Bytes? raise RedisError

LPOP key: remove and return the head element, or None when the list is empty.

pub async fn Client::lpopn(Self, String, Int32) -> Array[Bytes] raise RedisError

LPOP key count: remove and return up to count head elements.

pub async fn Client::lpush(Self, String, Array[String]) -> Int64 raise RedisError

LPUSH key value...: prepend each value, returning the new length.

pub async fn Client::lpushx(Self, String, Array[String]) -> Int64 raise RedisError

LPUSHX key value...: prepend only if key already exists, returning the length.

pub async fn Client::lrange(Self, String, Int32, Int32) -> Array[Bytes] raise RedisError

LRANGE key start stop: the elements from start to stop (inclusive, negative from the tail).

pub async fn Client::lrem(Self, String, Int32, String) -> Int64 raise RedisError

LREM key count value: remove the first count elements equal to value. When count is negative, remove from the tail; when 0, remove all. Returns the removed.

pub async fn Client::lset(Self, String, Int32, String) -> Unit raise RedisError

LSET key index value: set the element at index. Raises Reply on a bad index.

pub async fn Client::ltrim(Self, String, Int32, Int32) -> Unit raise RedisError

LTRIM key start stop: keep only the elements from start to stop.

pub async fn Client::mget(Self, Array[String]) -> Array[Bytes?] raise RedisError

MGET key...: the value at each key, None where a key is absent, in the same order.

pub async fn Client::move_(Self, String, Int32) -> Bool raise RedisError

MOVE key db: move key to another logical database. true if moved.

pub async fn Client::mset(Self, Array[(String, String)]) -> Unit raise RedisError

MSET key value...: store every pair atomically.

pub fn Client::new(&RedisConn) -> Self

A client over conn.

pub async fn Client::object_encoding(Self, String) -> String raise RedisError

OBJECT ENCODING key / OBJECT REFCOUNT key / OBJECT IDLETIME key: inspect a key's internal encoding, reference count, or idle time.

pub async fn Client::object_idletime(Self, String) -> Int64 raise RedisError
pub async fn Client::object_refcount(Self, String) -> Int64 raise RedisError
pub async fn Client::persist(Self, String) -> Bool raise RedisError

PERSIST key: remove key's expiry. true if a TTL was removed.

pub async fn Client::pexpire(Self, String, Int64) -> Bool raise RedisError

PEXPIRE key ms: set a ms-millisecond expiry on key. false if the key is absent.

pub async fn Client::pexpireat(Self, String, Int64) -> Bool raise RedisError

PEXPIREAT key ts: expire key at the given Unix millisecond. false if absent.

pub async fn Client::pfadd(Self, String, Array[String]) -> Int64 raise RedisError

PFADD key value...: register the values, returning 1 if the sketch changed.

pub async fn Client::pfcount(Self, Array[String]) -> Int64 raise RedisError

PFCOUNT key...: the approximate cardinality of one key, or the union of several.

pub async fn Client::pfmerge(Self, String, Array[String]) -> Unit raise RedisError

PFMERGE dest src...: merge the source sketches into dest.

pub async fn Client::ping(Self) -> String raise RedisError

PING: a round-trip health check, returning the server's PONG text.

pub async fn Client::ping_message(Self, String) -> String raise RedisError

PING message: echo message back, confirming the connection.

pub async fn Client::psetex(Self, String, Int64, String) -> Unit raise RedisError

PSETEX key ms value: store value at key with a ms-millisecond expiry.

pub async fn Client::psubscribe(Self, Array[String]) -> Unit raise RedisError

PSUBSCRIBE pattern...: subscribe to channels by glob pattern.

pub async fn Client::pttl(Self, String) -> Int64 raise RedisError

PTTL key: key's remaining time to live in milliseconds.

pub async fn Client::publish(Self, String, String) -> Int64 raise RedisError

PUBLISH channel message: post message to channel, returning how many subscribers received it. (Publishing is an ordinary command, not a subscription.)

pub async fn Client::punsubscribe(Self, patterns? : Array[String]) -> Unit raise RedisError

PUNSUBSCRIBE [pattern...]: unsubscribe from the given patterns, or all when omitted.

pub async fn Client::randomkey(Self) -> String? raise RedisError

RANDOMKEY: a random key from the database, or None when the database is empty.

pub async fn Client::rename(Self, String, String) -> Unit raise RedisError

RENAME key newkey: rename key to newkey, replacing newkey if present.

pub async fn Client::renamenx(Self, String, String) -> Bool raise RedisError

RENAMENX key newkey: rename key to newkey only if newkey is absent. true if renamed.

pub async fn Client::replicaof(Self, String, Int32) -> Unit raise RedisError

REPLICAOF host port: make this server a replica of host:port. Use REPLICAOF NO ONE (via replicaof_noone) to promote it back to a master.

pub async fn Client::replicaof_noone(Self) -> Unit raise RedisError

REPLICAOF NO ONE: stop replicating and become a master.

pub async fn Client::restore(Self, String, Int64, Bytes, replace? : Bool, absttl? : Bool) -> Unit raise RedisError

RESTORE key ttl serialized [REPLACE] [ABSTTL]: restore a DUMP value at key with a ttl-millisecond expiry (0 = no expiry).

pub async fn Client::rpop(Self, String) -> Bytes? raise RedisError

RPOP key: remove and return the tail element, or None when the list is empty.

pub async fn Client::rpoplpush(Self, String, String) -> Bytes? raise RedisError

RPOPLPUSH source destination: pop the tail of source and push it to the head of destination, returning the element, or None when source is empty.

pub async fn Client::rpopn(Self, String, Int32) -> Array[Bytes] raise RedisError

RPOP key count: remove and return up to count tail elements.

pub async fn Client::rpush(Self, String, Array[String]) -> Int64 raise RedisError

RPUSH key value...: append each value, returning the new length.

pub async fn Client::rpushx(Self, String, Array[String]) -> Int64 raise RedisError

RPUSHX key value...: append only if key already exists, returning the length.

pub async fn Client::sadd(Self, String, Array[String]) -> Int64 raise RedisError

SADD key member...: add the members, returning how many were new.

pub async fn Client::save(Self) -> Unit raise RedisError

SAVE: synchronously save the dataset to disk (blocks the server).

pub async fn Client::scan(Self, String, pattern? : String, count? : Int32, kind? : String) -> (String, Array[String]) raise RedisError

SCAN cursor [MATCH pattern] [COUNT n] [TYPE kind]: an incremental key scan. Returns the next cursor (the empty string when the scan is done) and the keys found this call.

pub async fn Client::scard(Self, String) -> Int64 raise RedisError

SCARD key: the number of members in the set.

pub async fn Client::script_exists(Self, Array[String]) -> Array[Bool] raise RedisError

SCRIPT EXISTS sha...: whether each digest is loaded, in order.

pub async fn Client::script_flush(Self) -> Unit raise RedisError

SCRIPT FLUSH: discard every loaded script.

pub async fn Client::script_load(Self, String) -> String raise RedisError

SCRIPT LOAD script: register script and return its SHA-1 digest for later EVALSHA.

pub async fn Client::sdiff(Self, Array[String]) -> Array[String] raise RedisError

SDIFF key...: the members in the first set absent from the rest.

pub async fn Client::sdiffstore(Self, String, Array[String]) -> Int64 raise RedisError

SDIFFSTORE destination key...: store the difference of the sets in destination.

pub async fn Client::select(Self, Int32) -> Unit raise RedisError

SELECT index: switch the connection to logical database index.

pub async fn Client::sentinel(Self, Array[String]) -> @resp.RespValue raise RedisError

SENTINEL ...: send a raw sentinel sub-command (the sub-command name is the first args element), returning the reply.

pub async fn Client::sentinel_get_master_addr_by_name(Self, String) -> (String, Int32)? raise RedisError

SENTINEL GET-MASTER-ADDR-BY-NAME name: the current master's (host, port) for the monitored master name, or None if the sentinel does not know it.

pub async fn Client::set(Self, String, String, ex? : Int64, px? : Int64, nx? : Bool, xx? : Bool, keepttl? : Bool) -> Bool raise RedisError

SET key value [EX secs] [PX ms] [NX|XX] [KEEPTTL]: store value at key. Returns false when nx/xx leaves the key unchanged, true otherwise.

pub async fn Client::set_get(Self, String, String) -> Bytes? raise RedisError

SET key value GET: store value and return the value key held before, or None if it had none.

pub async fn Client::setbit(Self, String, Int64, Int32) -> Int64 raise RedisError

SETBIT key offset value: set the bit at offset (0 or 1), returning its previous value (0 or 1).

pub async fn Client::setex(Self, String, Int64, String) -> Unit raise RedisError

SETEX key secs value: store value at key with a secs-second expiry.

pub async fn Client::setnx(Self, String, String) -> Bool raise RedisError

SETNX key value: store value only if key is absent. true if stored.

pub async fn Client::setrange(Self, String, Int32, String) -> Int64 raise RedisError

SETRANGE key offset value: overwrite key at offset, returning the new length.

pub async fn Client::shutdown(Self, save? : Bool) -> Unit raise RedisError

SHUTDOWN [NOSAVE|SAVE]: stop the server. The call normally raises Closed when the connection drops, rather than returning.

pub async fn Client::sinter(Self, Array[String]) -> Array[String] raise RedisError

SINTER key...: the members present in every given set.

pub async fn Client::sinterstore(Self, String, Array[String]) -> Int64 raise RedisError

SINTERSTORE destination key...: store the intersection of the sets in destination.

pub async fn Client::sismember(Self, String, String) -> Bool raise RedisError

SISMEMBER key member: whether member is in the set.

pub async fn Client::slowlog_get(Self, count? : Int32) -> Array[@resp.RespValue] raise RedisError

SLOWLOG GET [count]: the most recent slow commands the server logged.

pub async fn Client::slowlog_len(Self) -> Int64 raise RedisError

SLOWLOG LEN: the number of entries in the slow log.

pub async fn Client::slowlog_reset(Self) -> Unit raise RedisError

SLOWLOG RESET: clear the slow log.

pub async fn Client::smembers(Self, String) -> Array[String] raise RedisError

SMEMBERS key: every member of the set.

pub async fn Client::smove(Self, String, String, String) -> Bool raise RedisError

SMOVE source destination member: move member from source to destination. true if moved.

pub async fn Client::spop(Self, String) -> String? raise RedisError

SPOP key: remove and return a random member, or None when the set is empty.

pub async fn Client::spopn(Self, String, Int32) -> Array[String] raise RedisError

SPOP key count: remove and return up to count random members.

pub async fn Client::spublish(Self, String, String) -> Int64 raise RedisError

SPUBLISH shardchannel message: post message to a shard channel, returning how many subscribers received it.

pub async fn Client::srandmember(Self, String) -> String? raise RedisError

SRANDMEMBER key: a random member, or None when the set is empty.

pub async fn Client::srandmembern(Self, String, Int32) -> Array[String] raise RedisError

SRANDMEMBER key count: count random members, with repeats when count exceeds the set size.

pub async fn Client::srem(Self, String, Array[String]) -> Int64 raise RedisError

SREM key member...: remove the members, returning how many existed.

pub async fn Client::sscan(Self, String, String, pattern? : String, count? : Int32) -> (String, Array[String]) raise RedisError

SSCAN key cursor [MATCH pattern] [COUNT n]: an incremental set member scan. Returns the next cursor and the members found this call.

pub async fn Client::ssubscribe(Self, Array[String]) -> Unit raise RedisError

SSUBSCRIBE shardchannel...: subscribe to shard channels (cluster pub/sub), which route to a single shard rather than every node.

pub async fn Client::strlen(Self, String) -> Int64 raise RedisError

STRLEN key: the length of key's value in bytes.

pub async fn Client::subscribe(Self, Array[String]) -> Unit raise RedisError

SUBSCRIBE channel...: subscribe the connection to the given channels. After this the connection receives message frames until unsubscribed.

pub async fn Client::sunion(Self, Array[String]) -> Array[String] raise RedisError

SUNION key...: the members present in any given set.

pub async fn Client::sunionstore(Self, String, Array[String]) -> Int64 raise RedisError

SUNIONSTORE destination key...: store the union of the sets in destination.

pub async fn Client::sunsubscribe(Self, channels? : Array[String]) -> Unit raise RedisError

SUNSUBSCRIBE [shardchannel...]: unsubscribe from the given shard channels, or all when omitted.

pub async fn Client::swapdb(Self, Int32, Int32) -> Unit raise RedisError

SWAPDB a b: atomically swap the data of databases a and b.

pub async fn Client::tdigest_add(Self, String, Array[Double]) -> Unit raise RedisError

TDIGEST.ADD key value [value ...]: add observations.

pub async fn Client::tdigest_byrank(Self, String, Array[Int64]) -> Array[Double] raise RedisError

TDIGEST.BYRANK key rank [rank ...]: the value at each rank.

pub async fn Client::tdigest_byrevrank(Self, String, Array[Int64]) -> Array[Double] raise RedisError

TDIGEST.BYREVRANK key rank [rank ...]: the value at each reverse rank.

pub async fn Client::tdigest_cdf(Self, String, Array[Double]) -> Array[Double] raise RedisError

TDIGEST.CDF key value [value ...]: the fraction of observations at or below each value.

pub async fn Client::tdigest_create(Self, String, compression? : Int64) -> Unit raise RedisError

TDIGEST.CREATE key [COMPRESSION compression]: create a t-digest. A higher compression keeps more centroids and estimates the tails more precisely.

pub async fn Client::tdigest_info(Self, String) -> Info raise RedisError

TDIGEST.INFO key: compression, capacity, and how many observations were merged.

pub async fn Client::tdigest_max(Self, String) -> Double raise RedisError

TDIGEST.MAX key: the largest observation, or NaN when the sketch is empty.

pub async fn Client::tdigest_merge(Self, String, Array[String], compression? : Int64, overwrite? : Bool) -> Unit raise RedisError

TDIGEST.MERGE destination numKeys source... [COMPRESSION c] [OVERRIDE]: merge sketches into one; overwrite replaces the destination's contents instead of adding.

pub async fn Client::tdigest_min(Self, String) -> Double raise RedisError

TDIGEST.MIN key: the smallest observation, or NaN when the sketch is empty.

pub async fn Client::tdigest_quantile(Self, String, Array[Double]) -> Array[Double] raise RedisError

TDIGEST.QUANTILE key quantile [quantile ...]: the value at each quantile, 0 to 1.

pub async fn Client::tdigest_rank(Self, String, Array[Double]) -> Array[Int64] raise RedisError

TDIGEST.RANK key value [value ...]: how many observations are below each value.

pub async fn Client::tdigest_reset(Self, String) -> Unit raise RedisError

TDIGEST.RESET key: empty a t-digest without dropping the key.

pub async fn Client::tdigest_revrank(Self, String, Array[Double]) -> Array[Int64] raise RedisError

TDIGEST.REVRANK key value [value ...]: how many observations are above each value.

pub async fn Client::tdigest_trimmed_mean(Self, String, Double, Double) -> Double raise RedisError

TDIGEST.TRIMMED_MEAN key low_cut high_cut: the mean after dropping the observations below low_cut and above high_cut, both quantiles from 0 to 1.

pub async fn Client::time_(Self) -> (Int64, Int64) raise RedisError

TIME: the server's current time as (seconds, microseconds).

pub async fn Client::topk_add(Self, String, Array[String]) -> Array[String?] raise RedisError

TOPK.ADD key item [item ...]: count each item, returning the item it evicted from the list at that position, or None when the list did not change.

pub async fn Client::topk_count(Self, String, Array[String]) -> Array[Int64] raise RedisError

TOPK.COUNT key item [item ...]: the estimated count of each item.

pub async fn Client::topk_incrby(Self, String, Array[(String, Int64)]) -> Array[String?] raise RedisError

TOPK.INCRBY key item increment [item increment ...]: add to the counts, returning the evicted item per entry.

pub async fn Client::topk_info(Self, String) -> Info raise RedisError

TOPK.INFO key: the sketch's size and decay.

pub async fn Client::topk_list(Self, String) -> Array[String] raise RedisError

TOPK.LIST key: the items in the top-k list, heaviest first.

pub async fn Client::topk_list_with_count(Self, String) -> Array[(String, Int64)] raise RedisError

TOPK.LIST key WITHCOUNT: the items in the top-k list with their counts.

pub async fn Client::topk_query(Self, String, Array[String]) -> Array[Bool] raise RedisError

TOPK.QUERY key item [item ...]: whether each item is in the top-k list.

pub async fn Client::topk_reserve(Self, String, Int64, width? : Int64, depth? : Int64, decay? : Double) -> Unit raise RedisError

TOPK.RESERVE key topk [width depth decay]: create a sketch that keeps the topk heaviest items.

pub async fn Client::touch(Self, Array[String]) -> Int64 raise RedisError

TOUCH key...: the number of the given keys that exist (like EXISTS but does not alter the LRU/LFU, and accepts multiple keys).

pub async fn Client::ts_add(Self, String, Int64, Double, retention? : Int64, uncompressed? : Bool, chunk_size? : Int64, on_duplicate? : String, labels? : Array[(String, String)]) -> Int64 raise RedisError

TS.ADD key timestamp value [RETENTION ms] [ENCODING ...] [CHUNK_SIZE bytes] [ON_DUPLICATE policy] [LABELS ...]: append one sample, returning its timestamp.

pub async fn Client::ts_alter(Self, String, retention? : Int64, chunk_size? : Int64, duplicate_policy? : String, ignore_max_time_diff? : Int64, ignore_max_val_diff? : Double, labels? : Array[(String, String)]) -> Unit raise RedisError

TS.ALTER key [RETENTION ms] [CHUNK_SIZE bytes] [DUPLICATE_POLICY policy] [IGNORE ...] [LABELS ...]: change a series' settings; LABELS replaces the label set.

pub async fn Client::ts_create(Self, String, retention? : Int64, uncompressed? : Bool, chunk_size? : Int64, duplicate_policy? : String, ignore_max_time_diff? : Int64, ignore_max_val_diff? : Double, labels? : Array[(String, String)]) -> Unit raise RedisError

TS.CREATE key [RETENTION ms] [ENCODING COMPRESSED|UNCOMPRESSED] [CHUNK_SIZE bytes] [DUPLICATE_POLICY policy] [IGNORE max_time_diff max_val_diff] [LABELS ...]: create a series, optionally dropping samples older than retention.

pub async fn Client::ts_createrule(Self, String, String, String, Int64, align_timestamp? : Int64) -> Unit raise RedisError

TS.CREATERULE source destination AGGREGATION aggregator bucketDuration [alignTimestamp]: compact source into destination in buckets of bucket ms.

pub async fn Client::ts_decrby(Self, String, Double, timestamp? : Int64, retention? : Int64, uncompressed? : Bool, chunk_size? : Int64, duplicate_policy? : String, labels? : Array[(String, String)]) -> Int64 raise RedisError

TS.DECRBY key value [TIMESTAMP ts] ...: subtract value from the sample at timestamp, returning the timestamp.

pub async fn Client::ts_del(Self, String, String, String) -> Int64 raise RedisError

TS.DEL key fromTimestamp toTimestamp: delete the samples in the range, returning how many were removed.

pub async fn Client::ts_deleterule(Self, String, String) -> Unit raise RedisError

TS.DELETERULE source destination: stop compacting source into destination.

pub async fn Client::ts_get(Self, String, latest? : Bool) -> Sample? raise RedisError

TS.GET key [LATEST]: the newest sample, or None when the series is empty.

pub async fn Client::ts_incrby(Self, String, Double, timestamp? : Int64, retention? : Int64, uncompressed? : Bool, chunk_size? : Int64, duplicate_policy? : String, labels? : Array[(String, String)]) -> Int64 raise RedisError

TS.INCRBY key value [TIMESTAMP ts] [RETENTION ms] [ENCODING ...] [CHUNK_SIZE bytes] [DUPLICATE_POLICY policy] [LABELS ...]: add value to the sample at timestamp, creating the sample when there is none, and return the timestamp.

pub async fn Client::ts_info(Self, String) -> TsInfo raise RedisError

TS.INFO key: the series' size, settings, labels and compaction rules.

pub async fn Client::ts_madd(Self, Array[(String, Int64, Double)]) -> Array[Int64?] raise RedisError

TS.MADD key timestamp value [key timestamp value ...]: append several samples at once, returning each timestamp, None where that sample was refused.

pub async fn Client::ts_mget(Self, Array[String], options? : MultiGetOptions) -> Array[Series] raise RedisError

TS.MGET [options] FILTER filter...: the latest sample of every series whose labels match.

pub async fn Client::ts_mrange(Self, TimeBound, TimeBound, Array[String], options? : MultiRangeOptions) -> Array[Series] raise RedisError

TS.MRANGE fromTimestamp toTimestamp [options] FILTER filter...: the samples of every series whose labels match, oldest first.

pub async fn Client::ts_mrevrange(Self, TimeBound, TimeBound, Array[String], options? : MultiRangeOptions) -> Array[Series] raise RedisError

TS.MREVRANGE fromTimestamp toTimestamp [options] FILTER filter...: the same, newest first. The bounds keep the order TS.MRANGE uses.

pub async fn Client::ts_nrange(Self, Array[String], TimeBound, TimeBound, options? : RangeOptions) -> Array[PivotRow] raise RedisError

TS.NRANGE numkeys key... fromTimestamp toTimestamp [options]: the samples of several series pivoted by timestamp, one value column per key in the order the keys are given.

pub async fn Client::ts_nrevrange(Self, Array[String], TimeBound, TimeBound, options? : RangeOptions) -> Array[PivotRow] raise RedisError

TS.NREVRANGE numkeys key... fromTimestamp toTimestamp [options]: the same, newest first. The bounds keep the order TS.NRANGE uses.

pub async fn Client::ts_queryindex(Self, Array[String]) -> Array[String] raise RedisError

TS.QUERYINDEX filter...: the keys whose labels match every filter.

pub async fn Client::ts_querylabel_values(Self, String, filters? : Array[String]) -> Array[String] raise RedisError

TS.QUERYLABELS VALUES label [FILTER filter...]: every value of one label in use.

pub async fn Client::ts_querylabels(Self, filters? : Array[String]) -> Array[String] raise RedisError

TS.QUERYLABELS [FILTER filter...]: every label name in use.

pub async fn Client::ts_range(Self, String, TimeBound, TimeBound, options? : RangeOptions) -> Array[Sample] raise RedisError

TS.RANGE key fromTimestamp toTimestamp [options]: the samples in the range, oldest first.

pub async fn Client::ts_read(Self, String, Int64, block? : (Int64, Int64), max_count? : Int64) -> Array[Sample] raise RedisError

TS.READ key timestamp [BLOCK ms count] [MAX_COUNT n]: up to max_count samples from timestamp on, waiting for at least block's count when it is given.

pub async fn Client::ts_revrange(Self, String, TimeBound, TimeBound, options? : RangeOptions) -> Array[Sample] raise RedisError

TS.REVRANGE key fromTimestamp toTimestamp [options]: the samples in the range, newest first. The bounds keep the order TS.RANGE uses; only the reply is reversed.

pub async fn Client::ttl(Self, String) -> Int64 raise RedisError

TTL key: key's remaining time to live in seconds: -2 if absent, -1 if no expiry, otherwise the seconds left.

pub async fn Client::type_(Self, String) -> String raise RedisError

TYPE key: the type stored at key (string, list, set, ...), or none.

pub async fn Client::unlink(Self, Array[String]) -> Int64 raise RedisError

UNLINK key...: delete the given keys asynchronously, returning how many existed.

pub async fn Client::unsubscribe(Self, channels? : Array[String]) -> Unit raise RedisError

UNSUBSCRIBE [channel...]: unsubscribe from the given channels, or all when omitted.

pub async fn Client::unwatch(Self) -> Unit raise RedisError

UNWATCH: clear all watched keys.

pub async fn Client::watch(Self, Array[String]) -> Unit raise RedisError

WATCH key...: mark keys so a later transaction aborts if they change before EXEC.

pub async fn Client::xack(Self, String, String, Array[String]) -> Int64 raise RedisError

XACK key group id...: acknowledge the given entries for a consumer group, returning how many were newly acknowledged.

pub async fn Client::xadd(Self, String, String, Array[(String, String)], maxlen? : Int64, approx? : Bool) -> String raise RedisError

XADD key [MAXLEN [~] n] id field value...: append an entry, returning its id. Use id of * for an auto-generated id.

pub async fn Client::xdel(Self, String, Array[String]) -> Int64 raise RedisError

XDEL key id...: delete the given entries, returning how many were removed.

pub async fn Client::xgroup_create(Self, String, String, String, mkstream? : Bool) -> Unit raise RedisError

XGROUP CREATE key group id [MKSTREAM]: create a consumer group. id is the last delivered id ($ for new entries only, 0 for all); mkstream creates the stream if absent.

pub async fn Client::xgroup_createconsumer(Self, String, String, String) -> Bool raise RedisError

XGROUP CREATECONSUMER key group consumer: create a consumer in a group. true if newly created.

pub async fn Client::xgroup_delconsumer(Self, String, String, String) -> Int64 raise RedisError

XGROUP DELCONSUMER key group consumer: delete a consumer, returning its pending entries that are now orphaned.

pub async fn Client::xgroup_destroy(Self, String, String) -> Bool raise RedisError

XGROUP DESTROY key group: delete a consumer group. true if it existed.

pub async fn Client::xlen(Self, String) -> Int64 raise RedisError

XLEN key: the number of entries in the stream.

pub async fn Client::xpending(Self, String, String) -> PendingSummary raise RedisError

XPENDING key group: the pending-entry summary for a group. For the detailed entry list use xpending_extended.

pub async fn Client::xrange(Self, String, String, String, count? : Int32) -> Array[StreamEntry] raise RedisError

XRANGE key start end [COUNT n]: the entries from start to end (use -/+ for the ends), oldest first.

pub async fn Client::xread(Self, Array[(String, String)], count? : Int32, block? : Int64) -> Array[(String, Array[StreamEntry])]? raise RedisError

XREAD [COUNT n] [BLOCK ms] STREAMS key id...: read new entries from one or more streams. block of 0 reads without blocking; a positive block waits up to that many milliseconds for the first entry. Returns, per stream, its name and the entries read, or None when a blocking read times out.

pub async fn Client::xreadgroup(Self, String, String, Array[(String, String)], count? : Int32, block? : Int64, noack? : Bool) -> Array[(String, Array[StreamEntry])]? raise RedisError

XREADGROUP GROUP group consumer [COUNT n] [BLOCK ms] [NOACK] STREAMS key id...: read entries for a consumer, marking them pending. id of > reads new entries; a specific id reads pending ones. Returns per stream its name and entries, or None on a blocking timeout.

pub async fn Client::xrevrange(Self, String, String, String, count? : Int32) -> Array[StreamEntry] raise RedisError

XREVRANGE key end start [COUNT n]: the entries from end to start, newest first.

pub async fn Client::xtrim(Self, String, Int64, approx? : Bool) -> Int64 raise RedisError

XTRIM key MAXLEN [~] n: cap the stream at n entries, returning how many were trimmed.

pub async fn Client::zadd(Self, String, Array[(String, Double)], nx? : Bool, xx? : Bool, ch? : Bool) -> Int64 raise RedisError

ZADD key [NX] [XX] [CH] score member...: add or update members with their scores, returning how many members changed (or, with ch, were added or updated).

pub async fn Client::zcard(Self, String) -> Int64 raise RedisError

ZCARD key: the number of members in the sorted set.

pub async fn Client::zcount(Self, String, String, String) -> Int64 raise RedisError

ZCOUNT key min max: the number of members with scores in [min, max].

pub async fn Client::zincrby(Self, String, Double, String) -> Double raise RedisError

ZINCRBY key increment member: add increment to member's score, returning the new score.

pub async fn Client::zinterstore(Self, String, Array[String], weights? : Array[Double], aggregate? : String) -> Int64 raise RedisError

ZINTERSTORE destination numkeys key... [WEIGHTS w...] [AGGREGATE SUM|MIN|MAX]: store the intersection of the sorted sets, returning how many members the result has.

pub async fn Client::zmscore(Self, String, Array[String]) -> Array[Double?] raise RedisError

ZMSCORE key member...: the score of each member, None where absent, in order.

pub async fn Client::zpopmax(Self, String, count? : Int32) -> Array[(String, Double)] raise RedisError

ZPOPMAX key [count]: remove and return the highest-scoring count members.

pub async fn Client::zpopmin(Self, String, count? : Int32) -> Array[(String, Double)] raise RedisError

ZPOPMIN key [count]: remove and return the lowest-scoring count members and their scores.

pub async fn Client::zrandmember(Self, String, count? : Int32) -> Array[String] raise RedisError

ZRANDMEMBER key [count] [WITHSCORES]: one or more random members, optionally with scores.

pub async fn Client::zrandmember_scores(Self, String, Int32) -> Array[(String, Double)] raise RedisError

ZRANDMEMBER key count WITHSCORES: random members with their scores. A negative count may repeat a member.

pub async fn Client::zrange(Self, String, Int32, Int32) -> Array[String] raise RedisError

ZRANGE key start stop: the members from start to stop (inclusive, negative from the tail), lowest score first.

pub async fn Client::zrange_scores(Self, String, Int32, Int32) -> Array[(String, Double)] raise RedisError

ZRANGE key start stop WITHSCORES: the members and scores in rank order.

pub async fn Client::zrangebyscore(Self, String, String, String, offset? : Int32, count? : Int32) -> Array[String] raise RedisError

ZRANGEBYSCORE key min max [LIMIT offset count]: members with scores in [min, max] (use (score to exclude a bound), lowest score first.

pub async fn Client::zrangebyscore_scores(Self, String, String, String, offset? : Int32, count? : Int32) -> Array[(String, Double)] raise RedisError

ZRANGEBYSCORE ... WITHSCORES: the members and scores in score order.

pub async fn Client::zrank(Self, String, String) -> Int64? raise RedisError

ZRANK key member: the rank (0-based, lowest score first) of member, or None if absent.

pub async fn Client::zrem(Self, String, Array[String]) -> Int64 raise RedisError

ZREM key member...: remove the members, returning how many existed.

pub async fn Client::zremrangebyrank(Self, String, Int32, Int32) -> Int64 raise RedisError

ZREMRANGEBYRANK key start stop: remove members by rank range, returning the removed.

pub async fn Client::zremrangebyscore(Self, String, String, String) -> Int64 raise RedisError

ZREMRANGEBYSCORE key min max: remove members by score range, returning the removed.

pub async fn Client::zrevrange(Self, String, Int32, Int32) -> Array[String] raise RedisError

ZREVRANGE key start stop: the members in rank order, highest score first.

pub async fn Client::zrevrange_scores(Self, String, Int32, Int32) -> Array[(String, Double)] raise RedisError

ZREVRANGE key start stop WITHSCORES: the members and scores, highest score first.

pub async fn Client::zrevrangebyscore(Self, String, String, String, offset? : Int32, count? : Int32) -> Array[String] raise RedisError

ZREVRANGEBYSCORE key max min [LIMIT offset count]: members with scores in [min, max], highest score first.

pub async fn Client::zrevrangebyscore_scores(Self, String, String, String, offset? : Int32, count? : Int32) -> Array[(String, Double)] raise RedisError

ZREVRANGEBYSCORE ... WITHSCORES: the members and scores, highest score first.

pub async fn Client::zrevrank(Self, String, String) -> Int64? raise RedisError

ZREVRANK key member: the rank (0-based, highest score first) of member.

pub async fn Client::zscan(Self, String, String, pattern? : String, count? : Int32) -> (String, Array[String]) raise RedisError

ZSCAN key cursor [MATCH pattern] [COUNT n]: an incremental sorted-set member scan. Returns the next cursor and the members found this call.

pub async fn Client::zscore(Self, String, String) -> Double? raise RedisError

ZSCORE key member: the score of member, or None if absent.

pub async fn Client::zunionstore(Self, String, Array[String], weights? : Array[Double], aggregate? : String) -> Int64 raise RedisError

ZUNIONSTORE destination numkeys key... [WEIGHTS w...] [AGGREGATE SUM|MIN|MAX]: store the union of the sorted sets, returning how many members the result has.

pub fn ClientOptions::at(String, Int32) -> Self

ClientOptions at host:port, over the standard defaults (RESP3, database 0, no TLS).

pub fn ClientOptions::with_auth(Self, String?, String?) -> Self

A copy of self that authenticates with username and password.

pub fn ClientOptions::with_db(Self, Int32) -> Self

A copy of self that SELECTs db on connect.

pub async fn ClusterClient::command(Self, Array[Bytes]) -> @resp.RespValue raise RedisError

Send args to the node owning its key, following redirects up to the limit. The key is the first argument after the command name. MOVED updates the topology, since the slot has gone for good; ASK does not, since only this key has gone ahead so far, and the node it names serves the key only straight after ASKING.

pub fn ClusterClient::new(Array[(String, &RedisConn)], ClusterTopology, limit? : Int32, dial? : async (String) -> &RedisConn raise RedisError) -> Self

A cluster client over nodes (address, connection pairs) and topology.

pub fn ClusterClient::set_topology(Self, ClusterTopology) -> Unit

Replace the routing topology (after a redirect, or on a refresh).

pub fn ClusterSlot::new(Int32, Int32, String) -> Self

A slot range [start, end] owned by node (host:port).

pub fn ClusterTopology::assign(Self, Int32, String) -> Unit

Record that slot lives on node. Singles sit ahead of the ranges, so the first match in node_for_slot is the latest word on a slot.

pub fn ClusterTopology::new(Array[ClusterSlot]) -> Self

ClusterTopology from an explicit slot list (used after parsing CLUSTER SLOTS, or in tests).

pub fn ClusterTopology::node_for_slot(Self, Int32) -> String?

The node address (host:port) that owns slot, or None if no range covers it.

pub fn crc16(Bytes) -> Int32

The CRC16-CCITT (XMODEM) of data: polynomial 0x1021, initial 0, no reflection — the checksum redis uses to place a key in a slot.

pub fn decode_cluster_slots(@resp.RespValue) -> ClusterTopology raise RedisError

Parse a CLUSTER SLOTS reply into a ClusterTopology. Each entry is [start, end, [host, port, id], ...replicas...]; the master's host:port is the owning node.

pub fn decode_info(@resp.RespValue) -> Info raise RedisError

A module INFO reply as an Info. The RESP3 map is read directly; the RESP2 flat array is read pairwise, which is how every module writes it.

pub fn expect_array(@resp.RespValue) -> Array[@resp.RespValue] raise RedisError

A reply as an Array[RespValue]: an array, or the nil an empty result decodes to.

pub fn expect_bool(@resp.RespValue) -> Bool raise RedisError

A reply as a Bool: the 1/0 redis uses for existence, success and comparison, or the boolean RESP3 sends for the same answer.

pub fn expect_bytes(@resp.RespValue) -> Bytes? raise RedisError

A reply as binary bytes, or None for the nil a missing key decodes to.

pub fn expect_double(@resp.RespValue) -> Double raise RedisError

A reply as a Double: a double, the integer a score may come back as, or a parsed decimal string.

pub fn expect_int64(@resp.RespValue) -> Int64 raise RedisError

A reply as an Int64: an integer value, or the +1/-1 a command aliases to.

pub fn expect_map(@resp.RespValue) -> Array[(@resp.RespValue, @resp.RespValue)] raise RedisError

A reply as a map (RESP3 %) of key/value pairs.

pub fn expect_number(@resp.RespValue) -> Int64 raise RedisError

A number redis writes as text: TIME, and the ports and counts of sentinel and stream replies, come back as strings under both protocols.

pub fn expect_score(@resp.RespValue) -> Double? raise RedisError

A score that may be missing: RESP3 sends a double, RESP2 a string, and both nil.

pub fn expect_some(@resp.RespValue) -> Array[@resp.RespValue] raise RedisError

The members of a reply that is one bulk value without a count and an array with one, and nothing when the key is missing.

pub fn expect_string(@resp.RespValue) -> String? raise RedisError

A reply as a String, or None for nil.

pub fn expect_string_value(@resp.RespValue) -> String raise RedisError

A reply as a String, raising on nil (for commands that always return a value).

pub fn expect_text(@resp.RespValue) -> String raise RedisError

A reply as text: a bulk string, a simple string, or a verbatim string. A module returns numbers as text on RESP2, so a call that wants the written form goes through here.

pub fn expect_text_list(@resp.RespValue) -> Array[String] raise RedisError

A list of text, from an array or the set RESP3 answers TS.QUERYINDEX with.

pub async fn FakeConn::execute(Self, Array[Bytes]) -> @resp.RespValue raise RedisError
pub async fn FakeConn::execute_all(Self, Array[Array[Bytes]]) -> Array[@resp.RespValue] raise RedisError
pub fn FakeConn::handler((Array[Bytes]) -> @resp.RespValue) -> Self

A fake that answers every call with handler, ignoring any queue.

pub fn FakeConn::new(Array[@resp.RespValue]) -> Self

A fake that returns replies in order, then Null for every further call.

pub fn FakeConn::sent(Self) -> Array[Array[Bytes]]

Every command the fake was asked to send, in order, so a test can assert the wire form a typed method builds and not only the reply it decodes.

pub fn field_value(@resp.RespValue) -> FieldValue

A reply value as a FieldValue.

pub fn FieldValue::double(Self) -> Double?

A value as a double, when it holds one.

pub fn FieldValue::int(Self) -> Int64?

A value as an integer, when it holds one.

pub fn FieldValue::text(Self) -> String?

A value as text, for the callers that only ever see text.

pub fn Fpha::text(Self) -> String

The keyword FPHA takes for this storage.

pub fn hash_slot(String) -> Int32

The slot a key hashes to. A key of the form prefix{tag}suffix hashes by tag (the hash tag), so those keys colocate; otherwise the whole key is hashed. The result is taken modulo 16384.

pub fn Info::double(Self, String) -> Double?

The value under name as a double, accepting a number or its decimal text.

pub fn Info::flag(Self, String) -> Bool?

The value under name as a flag.

pub fn Info::get(Self, String) -> InfoValue

The value stored under name, or Missing.

pub fn Info::int(Self, String) -> Int64?

The value under name as an integer, or None when it is not a whole number.

pub fn Info::text(Self, String) -> String?

The value under name as text.

pub fn info_scalar(@resp.RespValue) -> InfoValue

One value of an INFO reply: a scalar, a flag, or a null the server left empty.

pub fn is_cluster_down(String) -> Bool

Whether a redis error reply is a CLUSTERDOWN, the cluster unable to serve.

pub fn is_noscript(String) -> Bool

Whether a redis error reply is the NOSCRIPT a forgotten script digest draws, so a Script reloads and retries.

pub fn Message::parse(@resp.RespValue) -> Self?

Parse a pub/sub frame — a RESP2 array or RESP3 push — into a Message, or None if the value is not a pub/sub frame.

pub fn numeric_value(@resp.RespValue) -> Double

A numeric reply: a double, an integer, or the decimal text RESP2 writes. A module that has no value to report writes nan, which arrives as NaN here.

pub fn path_items(@resp.RespValue) -> Array[@resp.RespValue]

A reply that is one value or an array of one, as the items of an array. JSONPath commands answer with an array, the older single-path form with a bare value, and RESP3 adds a wrapper of its own; callers want neither detail.

pub fn Pipeline::add(Self, Array[Bytes]) -> Unit

Queue args as the next command.

pub async fn Pipeline::execute(Self) -> Array[@resp.RespValue] raise RedisError

Run the queued commands in one round trip. Without multi the replies come back in order, an error reply being one among them. With multi they run atomically and the EXEC result comes back: Aborted when a watched key changed, Reply when redis refused the batch, as it does for a command it could not queue.

pub fn Pipeline::multi(Self) -> Unit

Switch the pipeline to transaction mode: execute will wrap the queued commands in MULTI/EXEC.

pub fn Pipeline::new(&RedisConn) -> Self

A pipeline over conn.

pub fn protocol_version(Protocol) -> Int32

The HELLO version argument each protocol negotiates.

pub fn push_some(Array[Bytes], Bytes, Bytes?) -> Unit

Append an optional argument only when it is present, in a when Some arm.

pub fn redirect(String) -> Redirect?

What a MOVED or ASK error reply points at; None when the message is neither.

pub fn reply_error(@resp.RespValue) -> RedisError

The client's reply when a command returns a redis error value, or Protocol when the reply is not an error value at all but also not the shape the command expected.

pub async fn RetryConn::execute(Self, Array[Bytes]) -> @resp.RespValue raise RedisError
pub async fn RetryConn::execute_all(Self, Array[Array[Bytes]]) -> Array[@resp.RespValue] raise RedisError
pub fn RetryConn::new(&RedisConn, RetryOptions, dial? : async () -> &RedisConn raise RedisError, wait? : async (Int64) -> Unit noraise) -> Self

A retrying view of inner under retry.

pub fn same_slot(Array[String]) -> Bool

Whether every key hashes to the same slot — required for multi-key commands in a cluster.

pub fn Schema::new(Array[SchemaField]) -> Self

A schema over fields with the default index options.

pub fn SchemaField::geo(String, as_? : String, sortable? : Bool, unf? : Bool, noindex? : Bool, index_empty? : Bool, index_missing? : Bool) -> Self

A GEO field.

pub fn SchemaField::numeric(String, as_? : String, sortable? : Bool, unf? : Bool, noindex? : Bool, index_empty? : Bool, index_missing? : Bool) -> Self

A NUMERIC field.

pub fn SchemaField::tag(String, as_? : String, separator? : String, case_sensitive? : Bool, sortable? : Bool, unf? : Bool, noindex? : Bool, with_suffix_trie? : Bool, index_empty? : Bool, index_missing? : Bool) -> Self

A TAG field.

pub fn SchemaField::text(String, as_? : String, sortable? : Bool, unf? : Bool, noindex? : Bool, weight? : Double, phonetic? : String, no_stem? : Bool, with_suffix_trie? : Bool, index_empty? : Bool, index_missing? : Bool) -> Self

A TEXT field.

pub fn SchemaField::vector(String, VectorSpec, as_? : String, sortable? : Bool, noindex? : Bool) -> Self

A VECTOR field.

pub fn Script::new(String) -> Self

A script of source. Nothing is sent until run.

pub async fn Script::run(Self, Client, Array[String], Array[String]) -> @resp.RespValue raise RedisError

Run the script over keys and args.

pub fn SearchHit::field(Self, String) -> String?

The field name of a hit as text, or None when the query did not return it.

pub fn SentinelClient::new(Array[&RedisConn]) -> Self

A sentinel client over sentinels (connection to each sentinel node).

pub async fn SentinelClient::resolve(Self, String) -> String raise RedisError

Resolve the master address for name, querying sentinels in order; the first answer wins. Returns the host:port string to dial.

pub fn should_retry(RedisError, Int32, RetryOptions) -> Bool

Whether an error on attempt (0-based, the attempt that just failed) is worth retrying under retry: only a transport failure, and only while attempts remain.

pub fn status_ok(@resp.RespValue) -> Unit raise RedisError

Assert a status reply (the +OK most write commands return). Any other shape is a protocol error.

pub fn TimeBound::text(Self) -> String

The -, + or decimal text a range query writes for this bound.

pub fn VectorSpec::flat(Int32, element? : String, distance? : String, initial_cap? : Int64, block_size? : Int64) -> Self

A flat (brute force) vector index over dim dimensions.

pub fn VectorSpec::hnsw(Int32, element? : String, distance? : String, initial_cap? : Int64, m? : Int64, ef_construction? : Int64, ef_runtime? : Int64, epsilon? : Double) -> Self

An HNSW vector index over dim dimensions.

Implementations 2
pub impl RedisConn for FakeConn

A live redis connection: it sends an encoded command (an array of argument byte strings) and returns the decoded reply. Implementations own the transport — a real socket speaking RESP, or an in-memory fake. It is open and async so a socket can be one: real redis I/O suspends, and a sealed synchronous trait left every implementation a test double.

pub impl RedisConn for RetryConn

A live redis connection: it sends an encoded command (an array of argument byte strings) and returns the decoded reply. Implementations own the transport — a real socket speaking RESP, or an in-memory fake. It is open and async so a socket can be one: real redis I/O suspends, and a sealed synchronous trait left every implementation a test double.

Derived members33
pub fn FieldValue::equal(Self, Self) -> Bool
pub fn FieldValue::not_equal(Self, Self) -> Bool
pub fn FieldValue::to_repr(Self) -> @debug.Repr
pub fn Fpha::equal(Self, Self) -> Bool
pub fn Fpha::not_equal(Self, Self) -> Bool
pub fn Fpha::to_repr(Self) -> @debug.Repr
pub fn Fusion::equal(Self, Self) -> Bool
pub fn Fusion::not_equal(Self, Self) -> Bool
pub fn Fusion::to_repr(Self) -> @debug.Repr
pub fn IndexKind::equal(Self, Self) -> Bool
pub fn IndexKind::not_equal(Self, Self) -> Bool
pub fn IndexKind::to_repr(Self) -> @debug.Repr
pub fn InfoValue::equal(Self, Self) -> Bool
pub fn InfoValue::not_equal(Self, Self) -> Bool
pub fn InfoValue::to_repr(Self) -> @debug.Repr
pub fn Redirect::equal(Self, Self) -> Bool
pub fn Redirect::not_equal(Self, Self) -> Bool
pub fn Redirect::to_repr(Self) -> @debug.Repr
pub fn RedisError::equal(Self, Self) -> Bool
pub fn RedisError::not_equal(Self, Self) -> Bool
pub fn RedisError::to_repr(Self) -> @debug.Repr
pub fn Sample::equal(Self, Self) -> Bool
pub fn Sample::not_equal(Self, Self) -> Bool
pub fn Sample::to_repr(Self) -> @debug.Repr
pub fn SchemaKind::equal(Self, Self) -> Bool
pub fn SchemaKind::not_equal(Self, Self) -> Bool
pub fn SchemaKind::to_repr(Self) -> @debug.Repr
pub fn TimeBound::equal(Self, Self) -> Bool
pub fn TimeBound::not_equal(Self, Self) -> Bool
pub fn TimeBound::to_repr(Self) -> @debug.Repr
pub fn VectorAlgorithm::equal(Self, Self) -> Bool
pub fn VectorAlgorithm::not_equal(Self, Self) -> Bool
pub fn VectorAlgorithm::to_repr(Self) -> @debug.Repr

resp

17 items · moonbitstack/moonredis/resp
Types 3
pub(all) suberror RespError {
  RespError(String)
}

A malformed or truncated RESP frame.

pub struct RespReader {
  data : Bytes
  mut pos : Int32
}

A cursor over a RESP byte stream, decoding one value at a time. A socket client feeds it a buffered reply; read advances past exactly one value, so several pipelined replies decode in sequence.

pub(all) enum RespValue {
  SimpleString(String)
  Error(String)
  Integer(Int64)
  BulkString(Bytes)
  Null
  Array(Array[RespValue])
  Boolean(Bool)
  Double(Double)
  BigNumber(String)
  BulkError(String)
  VerbatimString(String, Bytes)
  RespMap(Array[(RespValue, RespValue)])
  RespSet(Array[RespValue])
  Push(Array[RespValue])
}

A decoded RESP value. RESP2's null bulk string ($-1) and null array (*-1) both decode to Null, unifying with RESP3's explicit null (_). BulkString carries raw bytes (redis values are binary-safe); the text-line types carry the decoded string.

Functions & methods 11
pub fn resp_command(Array[String]) -> Bytes

Encode a command given string arguments (the common case — command names and keys are text), UTF-8 encoding each.

pub fn resp_encode_command(Array[Bytes]) -> Bytes

Encode a command as the client frame redis expects: an array of bulk strings, one per argument (*<n>\r\n$<len>\r\n<arg>\r\n...). Arguments are raw bytes, so binary keys and values round-trip unchanged.

pub fn resp_kind(RespValue) -> String

A short name for a value's RESP type, for error messages ("unexpected <kind> reply") — RespValue derives Eq/Debug but not a renderable form.

pub fn RespReader::at_end(Self) -> Bool

Whether every byte has been consumed.

pub fn RespReader::decode_first(Self) -> RespValue raise RespError

Decode the first RESP value from data, leaving any trailing bytes for the caller (a socket reader feeds a buffered reply and decodes pipelined replies one at a time).

pub fn RespReader::new(Bytes) -> Self

A reader positioned at the start of data.

pub fn RespReader::read(Self) -> RespValue raise RespError

Decode the next RESP value, advancing the cursor past it.

pub fn RespReader::rest(Self) -> Bytes

The bytes from the cursor to the end, as a fresh slice (the remainder of a stream).

pub fn RespValue::decode(Bytes) -> Self raise RespError

Decode exactly one RESP value from data, requiring it to consume the whole input. Trailing bytes after a complete value are a framing error.

pub fn RespValue::encode(Self) -> Bytes

Encode a value back to its RESP wire form. Every type that decodes also encodes, so a value round-trips through bytes unchanged; the documentation site uses this to show the bytes a decoded value becomes.

pub fn RespValue::encode_into(Self, @buffer.Buffer) -> Unit

Append a value's RESP wire form to buf.

Derived members3
pub fn RespValue::equal(Self, Self) -> Bool
pub fn RespValue::not_equal(Self, Self) -> Bool
pub fn RespValue::to_repr(Self) -> @debug.Repr

socket

16 items · moonbitstack/moonredis/socket
Types 3
pub struct Connection {
  conn : @tcp.Conn
  mut pushes : Array[@resp.RespValue]
}

A live redis connection: the socket, its optional TLS, and the push frames read since the last command.

pub struct Pool {
  options : @moonredis.ClientOptions
  idle : Array[Connection]
}

A pool of connections to one server, kept warm up to max_idle.

pub struct Subscription {
  conn : Connection
}

A live subscription: the subscribed connection and the channels/patterns on it.

Functions & methods 12
pub async fn connect_retrying(@moonredis.ClientOptions) -> @moonredis.RetryConn raise @moonredis.RedisError

A connection that opens a new socket when the old one drops, up to options.retry, and waits the policy's backoff between tries. Only for commands that are safe to send twice: a socket that dies after writing cannot say whether redis ran the command.

pub async fn Connection::connect(@moonredis.ClientOptions) -> Self raise @moonredis.RedisError

Open a connection described by options: dial, then negotiate the protocol, authenticate, select the database, and enable tracking when asked.

pub async fn Connection::execute(Self, Array[Bytes]) -> @resp.RespValue raise @moonredis.RedisError
pub async fn Connection::execute_all(Self, Array[Array[Bytes]]) -> Array[@resp.RespValue] raise @moonredis.RedisError
pub fn Connection::take_pushes(Self) -> Array[@resp.RespValue]

The push frames read since the last call, taken (and cleared) for a subscription reader.

pub async fn Pool::get(Self) -> Connection raise @moonredis.RedisError

Borrow a connection: reuse an idle one or open a new one.

pub fn Pool::idle_count(Self) -> Int32

How many idle connections the pool holds.

pub fn Pool::new(@moonredis.ClientOptions) -> Self

An empty pool for options.

pub fn Pool::put(Self, Connection) -> Unit

Return a connection to the pool. It is kept only while the pool is under max_idle; past that it is dropped (the connection closes when its socket is collected).

pub async fn Subscription::next(Self) -> @moonredis.Message? raise @moonredis.RedisError

The next message frame, or None if the next frame is not a pub/sub message (a confirmation, for example).

pub async fn Subscription::subscribe(Connection, Array[String], pattern? : Bool, shard? : Bool) -> Self raise @moonredis.RedisError

Subscribe conn to channels, to patterns with pattern, or to shard channels with shard, and consume the confirmation frames, so the next read returns a message.

pub async fn Subscription::unsubscribe(Self, Array[String], pattern? : Bool, shard? : Bool) -> Unit raise @moonredis.RedisError

Leave the given channels, patterns or shard channels, consuming the confirmation frames.

Implementations 1
pub impl @moonredis.RedisConn for Connection

sd

11 items · moonbitstack/moonredis/sd
Types 1
pub struct Registry {
  client : @moonredis.Client
  prefix : String
  poll : Int32
  lock : @async.Mutex
}

A registry over one Redis client. It is both a Registrar and a Discovery, and any number of tasks may share it. Give it a client of its own: the lock orders the registry's commands, not those of anything else on that connection.

Values 2
pub let poll : Int32

How often a watcher looks, in milliseconds: with no change feed to subscribe to, a change is at worst this late.

pub let prefix : String

What every key of a registry starts with.

Functions & methods 6
pub async fn Registry::deregister(Self, @moonsd.Lease) -> Unit
pub fn Registry::new(@moonredis.Client, prefix? : String, poll? : Int32) -> Self
pub async fn Registry::register(Self, String, @moonsd.Endpoint, Int32) -> @moonsd.Lease
pub async fn Registry::renew(Self, @moonsd.Lease) -> Unit
pub async fn Registry::resolve(Self, String) -> Array[@moonsd.Endpoint]
pub async fn Registry::watch(Self, String) -> &@moonsd.Watcher
Implementations 2
pub impl @moonsd.Discovery for Registry
pub impl @moonsd.Registrar for Registry

moonetcd

908 public items

an etcd client, and the contract on keys attached to leases

moonetcd

671 items · moonbitstack/moonetcd
Types 115
pub(all) struct Alarm {
  member_id : UInt64
  alarm : AlarmType
}

One raised alarm (etcdserverpb.Alarm).

pub(all) enum AlarmAction {
  Get
  Activate
  Deactivate
}

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

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

Query or raise an alarm (etcdserverpb.AlarmRequest).

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

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

pub(all) enum AlarmType {
  None
  Nospace
  Corrupt
}

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

pub(all) struct AuthDisableResponse {
  header : ResponseHeader
}

Disable authentication (etcdserverpb.AuthDisableResponse).

pub(all) struct AuthEnableResponse {
  header : ResponseHeader
}

Enable authentication (etcdserverpb.AuthEnableResponse).

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

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

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

The issued token (etcdserverpb.AuthenticateResponse).

pub(all) struct AuthRoleAddRequest {
  name : String
}

Add a role (etcdserverpb.AuthRoleAddRequest).

pub(all) struct AuthRoleAddResponse {
  header : ResponseHeader
}

Added-role reply (etcdserverpb.AuthRoleAddResponse).

pub(all) struct AuthRoleDeleteRequest {
  role : String
}

Delete a role (etcdserverpb.AuthRoleDeleteRequest).

pub(all) struct AuthRoleDeleteResponse {
  header : ResponseHeader
}

Deleted-role reply (etcdserverpb.AuthRoleDeleteResponse).

pub(all) struct AuthRoleGetRequest {
  role : String
}

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

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

A role's permissions (etcdserverpb.AuthRoleGetResponse).

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

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

pub(all) struct AuthRoleGrantPermissionResponse {
  header : ResponseHeader
}

Granted-permission reply (etcdserverpb.AuthRoleGrantPermissionResponse).

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

All role names (etcdserverpb.AuthRoleListResponse).

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

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

pub(all) struct AuthRoleRevokePermissionResponse {
  header : ResponseHeader
}

Revoked-permission reply (etcdserverpb.AuthRoleRevokePermissionResponse).

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

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

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

Add a user (etcdserverpb.AuthUserAddRequest).

pub(all) struct AuthUserAddResponse {
  header : ResponseHeader
}

Added-user reply (etcdserverpb.AuthUserAddResponse).

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

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

pub(all) struct AuthUserChangePasswordResponse {
  header : ResponseHeader
}

Changed-password reply (etcdserverpb.AuthUserChangePasswordResponse).

pub(all) struct AuthUserDeleteRequest {
  name : String
}

Delete a user (etcdserverpb.AuthUserDeleteRequest).

pub(all) struct AuthUserDeleteResponse {
  header : ResponseHeader
}

Deleted-user reply (etcdserverpb.AuthUserDeleteResponse).

pub(all) struct AuthUserGetRequest {
  name : String
}

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

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

A user's roles (etcdserverpb.AuthUserGetResponse).

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

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

pub(all) struct AuthUserGrantRoleResponse {
  header : ResponseHeader
}

Granted-role reply (etcdserverpb.AuthUserGrantRoleResponse).

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

All user names (etcdserverpb.AuthUserListResponse).

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

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

pub(all) struct AuthUserRevokeRoleResponse {
  header : ResponseHeader
}

Revoked-role reply (etcdserverpb.AuthUserRevokeRoleResponse).

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

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

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

The won leadership (v3election.CampaignResponse).

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

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.

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

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

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

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

pub(all) struct CompactionResponse {
  header : ResponseHeader
}

The result of a compaction (etcdserverpb.CompactionResponse).

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

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

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

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

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

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

pub(all) struct DefragmentResponse {
  header : ResponseHeader
}

The reply to a Defragment (etcdserverpb.DefragmentResponse).

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

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

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

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

pub(all) enum DowngradeAction {
  Validate
  Download
  Cancel
}

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

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

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

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

Downgrade state (etcdserverpb.DowngradeResponse).

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.

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

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

pub(all) enum EventType {
  Put
  Delete
}

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.

pub(all) enum FilterType {
  NoPut
  NoDelete
}

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

pub(all) struct GatewayCall {
  path : String
  request : String
  reply : String
  streaming : Bool
}

One call of etcd's HTTP/JSON gateway: the URL to POST to, the request message, the reply message, and whether the reply arrives as a stream of messages rather than as one.

pub(all) struct HashKVResponse {
  header : ResponseHeader
  hash : UInt32
  compact_revision : Int64
  hash_revision : Int64
}

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

pub(all) struct HashResponse {
  header : ResponseHeader
  hash : UInt32
}

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

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

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.

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

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

pub(all) struct LeaderRequest {
  name : Bytes
}

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

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

The current leader (v3election.LeaderResponse).

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

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

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

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

pub(all) struct LeaseKeepAliveRequest {
  id : Int64
}

Renew lease id (etcdserverpb.LeaseKeepAliveRequest).

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

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

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

The list of leases (etcdserverpb.LeaseLeasesResponse).

pub(all) struct LeaseRevokeRequest {
  id : Int64
}

Revoke lease id (etcdserverpb.LeaseRevokeRequest).

pub(all) struct LeaseRevokeResponse {
  header : ResponseHeader
}

The result of a revoke (etcdserverpb.LeaseRevokeResponse).

pub(all) struct LeaseStatus {
  id : Int64
}

One lease's id (etcdserverpb.LeaseStatus).

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

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

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

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

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

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

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

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

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

One member of the cluster (etcdserverpb.Member).

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

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

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

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

pub(all) struct MemberListRequest {
  linearizable : Bool
}

List the cluster members (etcdserverpb.MemberListRequest).

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

The membership (etcdserverpb.MemberListResponse).

pub(all) struct MemberPromoteRequest {
  id : UInt64
}

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

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

The membership after a promotion (etcdserverpb.MemberPromoteResponse).

pub(all) struct MemberRemoveRequest {
  id : UInt64
}

Remove the member id (etcdserverpb.MemberRemoveRequest).

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

The membership after a removal (etcdserverpb.MemberRemoveResponse).

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

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

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

The membership after an update (etcdserverpb.MemberUpdateResponse).

pub(all) struct MoveLeaderRequest {
  target_id : UInt64
}

Move leadership to target_id (etcdserverpb.MoveLeaderRequest).

pub(all) struct MoveLeaderResponse {
  header : ResponseHeader
}

Move-leadership reply (etcdserverpb.MoveLeaderResponse).

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

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

pub(all) enum PermissionType {
  Read
  Write
  ReadWrite
}

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

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

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

pub(all) struct ProclaimResponse {
  header : ResponseHeader
}

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

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

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

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

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

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
}

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

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

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

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

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

pub(all) struct ResignRequest {
  leader : LeaderKey
}

Give up a held leadership (v3election.ResignRequest).

pub(all) struct ResignResponse {
  header : ResponseHeader
}

Resign reply (v3election.ResignResponse).

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

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

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

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

pub(all) struct SnapshotRequest {
}

Snapshot of cluster state (etcdserverpb.SnapshotRequest).

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

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

pub(all) enum SortOrder {
  None
  Ascend
  Descend
}

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

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

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

pub(all) struct Status {
  code : Int32
  message : String
}

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.

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
}

Cluster status (etcdserverpb.StatusResponse).

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

TLS settings for a connection. With enabled the transports dial TLS: ca_cert is what they trust, cert and key are the client's own certificate for a member that asks for one, and server_name is the name the member's certificate has to carry.

Empty ca_cert means the public roots. Empty server_name means the endpoint's own host, which is what a certificate issued for the address it is reached by says.

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

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

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

The result of a Txn (etcdserverpb.TxnResponse).

pub(all) struct UnlockRequest {
  key : Bytes
}

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

pub(all) struct UnlockResponse {
  header : ResponseHeader
}

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

pub(all) struct UserAddOptions {
  no_password : Bool
}

Options for adding a user (etcdserverpb.UserAddOptions).

pub(all) struct WatchCancelRequest {
  watch_id : Int64
}

Close the watch watch_id (etcdserverpb.WatchCancelRequest).

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
}

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

pub(all) struct WatchProgressRequest {
}

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

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

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

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

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.

Values 2
pub let default_client_config : ClientConfig

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

pub let default_tls : TlsConfig

The preset: no TLS.

Functions & methods 325
pub fn Alarm::decode(Bytes) -> Self raise @proto.PbError
pub fn Alarm::empty() -> Self
pub fn Alarm::encode(Self) -> Bytes
pub fn AlarmAction::from_int(Int32) -> Self
pub fn AlarmAction::to_int(Self) -> Int32
pub fn AlarmRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn AlarmRequest::empty() -> Self
pub fn AlarmRequest::encode(Self) -> Bytes
pub fn AlarmResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AlarmResponse::empty() -> Self
pub fn AlarmResponse::encode(Self) -> Bytes
pub fn AlarmType::from_int(Int32) -> Self
pub fn AlarmType::to_int(Self) -> Int32
pub fn AuthDisableResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthDisableResponse::empty() -> Self
pub fn AuthDisableResponse::encode(Self) -> Bytes
pub fn AuthEnableResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthEnableResponse::empty() -> Self
pub fn AuthEnableResponse::encode(Self) -> Bytes
pub fn AuthenticateRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthenticateRequest::empty() -> Self
pub fn AuthenticateRequest::encode(Self) -> Bytes
pub fn AuthenticateResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthenticateResponse::empty() -> Self
pub fn AuthenticateResponse::encode(Self) -> Bytes
pub fn AuthRoleAddRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthRoleAddRequest::empty() -> Self
pub fn AuthRoleAddRequest::encode(Self) -> Bytes
pub fn AuthRoleAddResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthRoleAddResponse::empty() -> Self
pub fn AuthRoleAddResponse::encode(Self) -> Bytes
pub fn AuthRoleDeleteRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthRoleDeleteRequest::empty() -> Self
pub fn AuthRoleDeleteRequest::encode(Self) -> Bytes
pub fn AuthRoleDeleteResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthRoleDeleteResponse::empty() -> Self
pub fn AuthRoleDeleteResponse::encode(Self) -> Bytes
pub fn AuthRoleGetRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthRoleGetRequest::empty() -> Self
pub fn AuthRoleGetRequest::encode(Self) -> Bytes
pub fn AuthRoleGetResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthRoleGetResponse::empty() -> Self
pub fn AuthRoleGetResponse::encode(Self) -> Bytes
pub fn AuthRoleGrantPermissionRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthRoleGrantPermissionRequest::empty() -> Self
pub fn AuthRoleGrantPermissionRequest::encode(Self) -> Bytes
pub fn AuthRoleGrantPermissionResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthRoleGrantPermissionResponse::empty() -> Self
pub fn AuthRoleGrantPermissionResponse::encode(Self) -> Bytes
pub fn AuthRoleListResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthRoleListResponse::empty() -> Self
pub fn AuthRoleListResponse::encode(Self) -> Bytes
pub fn AuthRoleRevokePermissionRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthRoleRevokePermissionRequest::empty() -> Self
pub fn AuthRoleRevokePermissionRequest::encode(Self) -> Bytes
pub fn AuthRoleRevokePermissionResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthRoleRevokePermissionResponse::empty() -> Self
pub fn AuthRoleRevokePermissionResponse::encode(Self) -> Bytes
pub fn AuthStatusResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthStatusResponse::empty() -> Self
pub fn AuthStatusResponse::encode(Self) -> Bytes
pub fn AuthUserAddRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthUserAddRequest::empty() -> Self
pub fn AuthUserAddRequest::encode(Self) -> Bytes
pub fn AuthUserAddResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthUserAddResponse::empty() -> Self
pub fn AuthUserAddResponse::encode(Self) -> Bytes
pub fn AuthUserChangePasswordRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthUserChangePasswordRequest::empty() -> Self
pub fn AuthUserChangePasswordRequest::encode(Self) -> Bytes
pub fn AuthUserChangePasswordResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthUserChangePasswordResponse::empty() -> Self
pub fn AuthUserChangePasswordResponse::encode(Self) -> Bytes
pub fn AuthUserDeleteRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthUserDeleteRequest::empty() -> Self
pub fn AuthUserDeleteRequest::encode(Self) -> Bytes
pub fn AuthUserDeleteResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthUserDeleteResponse::empty() -> Self
pub fn AuthUserDeleteResponse::encode(Self) -> Bytes
pub fn AuthUserGetRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthUserGetRequest::empty() -> Self
pub fn AuthUserGetRequest::encode(Self) -> Bytes
pub fn AuthUserGetResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthUserGetResponse::empty() -> Self
pub fn AuthUserGetResponse::encode(Self) -> Bytes
pub fn AuthUserGrantRoleRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthUserGrantRoleRequest::empty() -> Self
pub fn AuthUserGrantRoleRequest::encode(Self) -> Bytes
pub fn AuthUserGrantRoleResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthUserGrantRoleResponse::empty() -> Self
pub fn AuthUserGrantRoleResponse::encode(Self) -> Bytes
pub fn AuthUserListResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthUserListResponse::empty() -> Self
pub fn AuthUserListResponse::encode(Self) -> Bytes
pub fn AuthUserRevokeRoleRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthUserRevokeRoleRequest::empty() -> Self
pub fn AuthUserRevokeRoleRequest::encode(Self) -> Bytes
pub fn AuthUserRevokeRoleResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn AuthUserRevokeRoleResponse::empty() -> Self
pub fn AuthUserRevokeRoleResponse::encode(Self) -> Bytes
pub fn CampaignRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn CampaignRequest::empty() -> Self
pub fn CampaignRequest::encode(Self) -> Bytes
pub fn CampaignResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn CampaignResponse::empty() -> Self
pub fn CampaignResponse::encode(Self) -> Bytes
pub fn CompactionRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn CompactionRequest::empty() -> Self
pub fn CompactionRequest::encode(Self) -> Bytes
pub fn CompactionResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn CompactionResponse::empty() -> Self
pub fn CompactionResponse::encode(Self) -> Bytes
pub fn Compare::decode(Bytes) -> Self raise @proto.PbError
pub fn Compare::empty() -> Self
pub fn Compare::encode(Self) -> Bytes
pub fn CompareResult::from_int(Int32) -> Self
pub fn CompareResult::to_int(Self) -> Int32
pub fn CompareTarget::from_int(Int32) -> Self
pub fn CompareTarget::to_int(Self) -> Int32
pub fn DefragmentResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn DefragmentResponse::empty() -> Self
pub fn DefragmentResponse::encode(Self) -> Bytes
pub fn DeleteRangeRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn DeleteRangeRequest::empty() -> Self
pub fn DeleteRangeRequest::encode(Self) -> Bytes
pub fn DeleteRangeResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn DeleteRangeResponse::empty() -> Self
pub fn DeleteRangeResponse::encode(Self) -> Bytes
pub fn DowngradeAction::from_int(Int32) -> Self
pub fn DowngradeAction::to_int(Self) -> Int32
pub fn DowngradeRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn DowngradeRequest::empty() -> Self
pub fn DowngradeRequest::encode(Self) -> Bytes
pub fn DowngradeResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn DowngradeResponse::empty() -> Self
pub fn DowngradeResponse::encode(Self) -> Bytes
pub fn EtcdError::message(Self) -> String
pub fn EtcdError::of(Int32, String) -> Self

The error a failed call ended with, from the status its transport reported. Both revision conditions are sent as OUT_OF_RANGE over gRPC and as UNKNOWN by the lock and election services, so they are told apart by the message text — the way etcd's own client does — rather than by the code.

pub fn Event::decode(Bytes) -> Self raise @proto.PbError

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

pub fn Event::empty() -> Self
pub fn Event::encode(Self) -> Bytes

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

pub fn EventType::from_int(Int32) -> Self

The event type for a protobuf enum number; an unknown number reads as Put, the first variant, which is what a protobuf decoder does with an unrecognised value.

pub fn EventType::to_int(Self) -> Int32
pub fn exact(Bytes) -> (Bytes, Bytes)

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

pub fn FilterType::from_int(Int32) -> Self
pub fn FilterType::to_int(Self) -> Int32
pub fn gateway_call(String) -> GatewayCall?

The call a gRPC method such as /etcdserverpb.KV/Range has on the gateway, or None for a method etcd does not publish there.

pub fn gateway_failure(StringView) -> EtcdError

The error a failed call ended with. The gateway answers with the gRPC status it would have returned — {"error": ..., "code": 3, "message": ...} — so the same mapping applies as over gRPC; a body that is not a status (a proxy in the way, say) becomes Refused with what it did say.

pub fn GatewayCall::decode_reply(Self, StringView) -> Bytes raise EtcdError

The reply message in its wire form, from one JSON body or one JSON frame of a streamed reply. A streamed reply wraps each message as {"result": ...}; an error that ends a stream arrives in the same place, so it is read here rather than surfacing as a missing field.

pub fn GatewayCall::encode_request(Self, Bytes) -> String raise EtcdError

The JSON body that carries body — one request message in its wire form — to the gateway.

pub fn has_prefix(Bytes, Bytes) -> Bool

True when key begins with prefix as a byte sequence.

pub fn HashKVResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn HashKVResponse::empty() -> Self
pub fn HashKVResponse::encode(Self) -> Bytes
pub fn HashResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn HashResponse::empty() -> Self
pub fn HashResponse::encode(Self) -> Bytes
pub fn KeyValue::decode(Bytes) -> Self raise @proto.PbError

Decode a KeyValue; unknown fields are skipped.

pub fn KeyValue::empty() -> Self

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

pub fn KeyValue::encode(Self) -> Bytes

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

pub fn KeyValue::is_empty(Self) -> Bool

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

pub fn LeaderKey::decode(Bytes) -> Self raise @proto.PbError
pub fn LeaderKey::empty() -> Self
pub fn LeaderKey::encode(Self) -> Bytes
pub fn LeaderRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn LeaderRequest::empty() -> Self
pub fn LeaderRequest::encode(Self) -> Bytes
pub fn LeaderResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn LeaderResponse::empty() -> Self
pub fn LeaderResponse::encode(Self) -> Bytes
pub fn LeaseGrantRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn LeaseGrantRequest::empty() -> Self
pub fn LeaseGrantRequest::encode(Self) -> Bytes
pub fn LeaseGrantResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn LeaseGrantResponse::empty() -> Self
pub fn LeaseGrantResponse::encode(Self) -> Bytes
pub fn LeaseKeepAliveRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn LeaseKeepAliveRequest::empty() -> Self
pub fn LeaseKeepAliveRequest::encode(Self) -> Bytes
pub fn LeaseKeepAliveResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn LeaseKeepAliveResponse::empty() -> Self
pub fn LeaseKeepAliveResponse::encode(Self) -> Bytes
pub fn LeaseLeasesResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn LeaseLeasesResponse::empty() -> Self
pub fn LeaseLeasesResponse::encode(Self) -> Bytes
pub fn LeaseRevokeRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn LeaseRevokeRequest::empty() -> Self
pub fn LeaseRevokeRequest::encode(Self) -> Bytes
pub fn LeaseRevokeResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn LeaseRevokeResponse::empty() -> Self
pub fn LeaseRevokeResponse::encode(Self) -> Bytes
pub fn LeaseStatus::decode(Bytes) -> Self raise @proto.PbError
pub fn LeaseStatus::empty() -> Self
pub fn LeaseStatus::encode(Self) -> Bytes
pub fn LeaseTimeToLiveRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn LeaseTimeToLiveRequest::empty() -> Self
pub fn LeaseTimeToLiveRequest::encode(Self) -> Bytes
pub fn LeaseTimeToLiveResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn LeaseTimeToLiveResponse::empty() -> Self
pub fn LeaseTimeToLiveResponse::encode(Self) -> Bytes
pub fn LockRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn LockRequest::empty() -> Self
pub fn LockRequest::encode(Self) -> Bytes
pub fn LockResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn LockResponse::empty() -> Self
pub fn LockResponse::encode(Self) -> Bytes
pub fn Member::decode(Bytes) -> Self raise @proto.PbError
pub fn Member::empty() -> Self
pub fn Member::encode(Self) -> Bytes
pub fn MemberAddRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn MemberAddRequest::empty() -> Self
pub fn MemberAddRequest::encode(Self) -> Bytes
pub fn MemberAddResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn MemberAddResponse::empty() -> Self
pub fn MemberAddResponse::encode(Self) -> Bytes
pub fn MemberListRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn MemberListRequest::empty() -> Self
pub fn MemberListRequest::encode(Self) -> Bytes
pub fn MemberListResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn MemberListResponse::empty() -> Self
pub fn MemberListResponse::encode(Self) -> Bytes
pub fn MemberPromoteRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn MemberPromoteRequest::empty() -> Self
pub fn MemberPromoteRequest::encode(Self) -> Bytes
pub fn MemberPromoteResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn MemberPromoteResponse::empty() -> Self
pub fn MemberPromoteResponse::encode(Self) -> Bytes
pub fn MemberRemoveRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn MemberRemoveRequest::empty() -> Self
pub fn MemberRemoveRequest::encode(Self) -> Bytes
pub fn MemberRemoveResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn MemberRemoveResponse::empty() -> Self
pub fn MemberRemoveResponse::encode(Self) -> Bytes
pub fn MemberUpdateRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn MemberUpdateRequest::empty() -> Self
pub fn MemberUpdateRequest::encode(Self) -> Bytes
pub fn MemberUpdateResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn MemberUpdateResponse::empty() -> Self
pub fn MemberUpdateResponse::encode(Self) -> Bytes
pub fn MoveLeaderRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn MoveLeaderRequest::empty() -> Self
pub fn MoveLeaderRequest::encode(Self) -> Bytes
pub fn MoveLeaderResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn MoveLeaderResponse::empty() -> Self
pub fn MoveLeaderResponse::encode(Self) -> Bytes
pub fn Permission::decode(Bytes) -> Self raise @proto.PbError
pub fn Permission::empty() -> Self
pub fn Permission::encode(Self) -> Bytes
pub fn PermissionType::from_int(Int32) -> Self
pub fn PermissionType::to_int(Self) -> Int32
pub fn prefix(Bytes) -> Bytes

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

pub fn prefix_range(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.

pub fn ProclaimRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn ProclaimRequest::empty() -> Self
pub fn ProclaimRequest::encode(Self) -> Bytes
pub fn ProclaimResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn ProclaimResponse::empty() -> Self
pub fn ProclaimResponse::encode(Self) -> Bytes
pub fn PutRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn PutRequest::empty() -> Self
pub fn PutRequest::encode(Self) -> Bytes
pub fn PutResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn PutResponse::empty() -> Self
pub fn PutResponse::encode(Self) -> Bytes
pub fn RangeRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn RangeRequest::empty() -> Self
pub fn RangeRequest::encode(Self) -> Bytes
pub fn RangeResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn RangeResponse::empty() -> Self
pub fn RangeResponse::encode(Self) -> Bytes
pub fn RequestOp::decode(Bytes) -> Self raise @proto.PbError
pub fn RequestOp::encode(Self) -> Bytes
pub fn ResignRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn ResignRequest::empty() -> Self
pub fn ResignRequest::encode(Self) -> Bytes
pub fn ResignResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn ResignResponse::empty() -> Self
pub fn ResignResponse::encode(Self) -> Bytes
pub fn ResponseHeader::decode(Bytes) -> Self raise @proto.PbError
pub fn ResponseHeader::empty() -> Self
pub fn ResponseHeader::encode(Self) -> Bytes
pub fn ResponseOp::decode(Bytes) -> Self raise @proto.PbError
pub fn ResponseOp::encode(Self) -> Bytes
pub fn SnapshotRequest::decode(Bytes) -> Self
pub fn SnapshotRequest::encode(Self) -> Bytes
pub fn SnapshotResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn SnapshotResponse::empty() -> Self
pub fn SnapshotResponse::encode(Self) -> Bytes
pub fn SortOrder::from_int(Int32) -> Self
pub fn SortOrder::to_int(Self) -> Int32
pub fn SortTarget::from_int(Int32) -> Self
pub fn SortTarget::to_int(Self) -> Int32
pub fn Status::to_string(Self) -> String

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

pub fn StatusResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn StatusResponse::empty() -> Self
pub fn StatusResponse::encode(Self) -> Bytes
pub fn TxnRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn TxnRequest::empty() -> Self
pub fn TxnRequest::encode(Self) -> Bytes
pub fn TxnResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn TxnResponse::empty() -> Self
pub fn TxnResponse::encode(Self) -> Bytes
pub fn UnlockRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn UnlockRequest::empty() -> Self
pub fn UnlockRequest::encode(Self) -> Bytes
pub fn UnlockResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn UnlockResponse::empty() -> Self
pub fn UnlockResponse::encode(Self) -> Bytes
pub fn UserAddOptions::decode(Bytes) -> Self raise @proto.PbError
pub fn UserAddOptions::empty() -> Self
pub fn UserAddOptions::encode(Self) -> Bytes
pub fn WatchCancelRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn WatchCancelRequest::empty() -> Self
pub fn WatchCancelRequest::encode(Self) -> Bytes
pub fn WatchCreateRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn WatchCreateRequest::empty() -> Self
pub fn WatchCreateRequest::encode(Self) -> Bytes
pub fn WatchProgressRequest::decode(Bytes) -> Self
pub fn WatchProgressRequest::encode(Self) -> Bytes
pub fn WatchRequest::decode(Bytes) -> Self raise @proto.PbError
pub fn WatchRequest::encode(Self) -> Bytes
pub fn WatchResponse::decode(Bytes) -> Self raise @proto.PbError
pub fn WatchResponse::empty() -> Self
pub fn WatchResponse::encode(Self) -> Bytes
pub fn WatchResponse::is_progress_notify(Self) -> Bool

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

Implementations 1
pub impl Show for EtcdError
Derived members228
pub fn Alarm::equal(Self, Self) -> Bool
pub fn Alarm::not_equal(Self, Self) -> Bool
pub fn AlarmAction::equal(Self, Self) -> Bool
pub fn AlarmAction::not_equal(Self, Self) -> Bool
pub fn AlarmRequest::equal(Self, Self) -> Bool
pub fn AlarmRequest::not_equal(Self, Self) -> Bool
pub fn AlarmResponse::equal(Self, Self) -> Bool
pub fn AlarmResponse::not_equal(Self, Self) -> Bool
pub fn AlarmType::equal(Self, Self) -> Bool
pub fn AlarmType::not_equal(Self, Self) -> Bool
pub fn AuthDisableResponse::equal(Self, Self) -> Bool
pub fn AuthDisableResponse::not_equal(Self, Self) -> Bool
pub fn AuthEnableResponse::equal(Self, Self) -> Bool
pub fn AuthEnableResponse::not_equal(Self, Self) -> Bool
pub fn AuthenticateRequest::equal(Self, Self) -> Bool
pub fn AuthenticateRequest::not_equal(Self, Self) -> Bool
pub fn AuthenticateResponse::equal(Self, Self) -> Bool
pub fn AuthenticateResponse::not_equal(Self, Self) -> Bool
pub fn AuthRoleAddRequest::equal(Self, Self) -> Bool
pub fn AuthRoleAddRequest::not_equal(Self, Self) -> Bool
pub fn AuthRoleAddResponse::equal(Self, Self) -> Bool
pub fn AuthRoleAddResponse::not_equal(Self, Self) -> Bool
pub fn AuthRoleDeleteRequest::equal(Self, Self) -> Bool
pub fn AuthRoleDeleteRequest::not_equal(Self, Self) -> Bool
pub fn AuthRoleDeleteResponse::equal(Self, Self) -> Bool
pub fn AuthRoleDeleteResponse::not_equal(Self, Self) -> Bool
pub fn AuthRoleGetRequest::equal(Self, Self) -> Bool
pub fn AuthRoleGetRequest::not_equal(Self, Self) -> Bool
pub fn AuthRoleGetResponse::equal(Self, Self) -> Bool
pub fn AuthRoleGetResponse::not_equal(Self, Self) -> Bool
pub fn AuthRoleGrantPermissionRequest::equal(Self, Self) -> Bool
pub fn AuthRoleGrantPermissionRequest::not_equal(Self, Self) -> Bool
pub fn AuthRoleGrantPermissionResponse::equal(Self, Self) -> Bool
pub fn AuthRoleGrantPermissionResponse::not_equal(Self, Self) -> Bool
pub fn AuthRoleListResponse::equal(Self, Self) -> Bool
pub fn AuthRoleListResponse::not_equal(Self, Self) -> Bool
pub fn AuthRoleRevokePermissionRequest::equal(Self, Self) -> Bool
pub fn AuthRoleRevokePermissionRequest::not_equal(Self, Self) -> Bool
pub fn AuthRoleRevokePermissionResponse::equal(Self, Self) -> Bool
pub fn AuthRoleRevokePermissionResponse::not_equal(Self, Self) -> Bool
pub fn AuthStatusResponse::equal(Self, Self) -> Bool
pub fn AuthStatusResponse::not_equal(Self, Self) -> Bool
pub fn AuthUserAddRequest::equal(Self, Self) -> Bool
pub fn AuthUserAddRequest::not_equal(Self, Self) -> Bool
pub fn AuthUserAddResponse::equal(Self, Self) -> Bool
pub fn AuthUserAddResponse::not_equal(Self, Self) -> Bool
pub fn AuthUserChangePasswordRequest::equal(Self, Self) -> Bool
pub fn AuthUserChangePasswordRequest::not_equal(Self, Self) -> Bool
pub fn AuthUserChangePasswordResponse::equal(Self, Self) -> Bool
pub fn AuthUserChangePasswordResponse::not_equal(Self, Self) -> Bool
pub fn AuthUserDeleteRequest::equal(Self, Self) -> Bool
pub fn AuthUserDeleteRequest::not_equal(Self, Self) -> Bool
pub fn AuthUserDeleteResponse::equal(Self, Self) -> Bool
pub fn AuthUserDeleteResponse::not_equal(Self, Self) -> Bool
pub fn AuthUserGetRequest::equal(Self, Self) -> Bool
pub fn AuthUserGetRequest::not_equal(Self, Self) -> Bool
pub fn AuthUserGetResponse::equal(Self, Self) -> Bool
pub fn AuthUserGetResponse::not_equal(Self, Self) -> Bool
pub fn AuthUserGrantRoleRequest::equal(Self, Self) -> Bool
pub fn AuthUserGrantRoleRequest::not_equal(Self, Self) -> Bool
pub fn AuthUserGrantRoleResponse::equal(Self, Self) -> Bool
pub fn AuthUserGrantRoleResponse::not_equal(Self, Self) -> Bool
pub fn AuthUserListResponse::equal(Self, Self) -> Bool
pub fn AuthUserListResponse::not_equal(Self, Self) -> Bool
pub fn AuthUserRevokeRoleRequest::equal(Self, Self) -> Bool
pub fn AuthUserRevokeRoleRequest::not_equal(Self, Self) -> Bool
pub fn AuthUserRevokeRoleResponse::equal(Self, Self) -> Bool
pub fn AuthUserRevokeRoleResponse::not_equal(Self, Self) -> Bool
pub fn CampaignRequest::equal(Self, Self) -> Bool
pub fn CampaignRequest::not_equal(Self, Self) -> Bool
pub fn CampaignResponse::equal(Self, Self) -> Bool
pub fn CampaignResponse::not_equal(Self, Self) -> Bool
pub fn ClientConfig::equal(Self, Self) -> Bool
pub fn ClientConfig::not_equal(Self, Self) -> Bool
pub fn CmpTarget::equal(Self, Self) -> Bool
pub fn CmpTarget::not_equal(Self, Self) -> Bool
pub fn CompactionRequest::equal(Self, Self) -> Bool
pub fn CompactionRequest::not_equal(Self, Self) -> Bool
pub fn CompactionResponse::equal(Self, Self) -> Bool
pub fn CompactionResponse::not_equal(Self, Self) -> Bool
pub fn Compare::equal(Self, Self) -> Bool
pub fn Compare::not_equal(Self, Self) -> Bool
pub fn CompareResult::equal(Self, Self) -> Bool
pub fn CompareResult::not_equal(Self, Self) -> Bool
pub fn CompareTarget::equal(Self, Self) -> Bool
pub fn CompareTarget::not_equal(Self, Self) -> Bool
pub fn DefragmentResponse::equal(Self, Self) -> Bool
pub fn DefragmentResponse::not_equal(Self, Self) -> Bool
pub fn DeleteRangeRequest::equal(Self, Self) -> Bool
pub fn DeleteRangeRequest::not_equal(Self, Self) -> Bool
pub fn DeleteRangeResponse::equal(Self, Self) -> Bool
pub fn DeleteRangeResponse::not_equal(Self, Self) -> Bool
pub fn DowngradeAction::equal(Self, Self) -> Bool
pub fn DowngradeAction::not_equal(Self, Self) -> Bool
pub fn DowngradeRequest::equal(Self, Self) -> Bool
pub fn DowngradeRequest::not_equal(Self, Self) -> Bool
pub fn DowngradeResponse::equal(Self, Self) -> Bool
pub fn DowngradeResponse::not_equal(Self, Self) -> Bool
pub fn EtcdError::output(Self, &Logger) -> Unit
pub fn EtcdError::to_string(Self) -> String
pub fn Event::equal(Self, Self) -> Bool
pub fn Event::not_equal(Self, Self) -> Bool
pub fn EventType::equal(Self, Self) -> Bool
pub fn EventType::not_equal(Self, Self) -> Bool
pub fn FilterType::equal(Self, Self) -> Bool
pub fn FilterType::not_equal(Self, Self) -> Bool
pub fn HashKVResponse::equal(Self, Self) -> Bool
pub fn HashKVResponse::not_equal(Self, Self) -> Bool
pub fn HashResponse::equal(Self, Self) -> Bool
pub fn HashResponse::not_equal(Self, Self) -> Bool
pub fn KeyValue::equal(Self, Self) -> Bool
pub fn KeyValue::not_equal(Self, Self) -> Bool
pub fn LeaderKey::equal(Self, Self) -> Bool
pub fn LeaderKey::not_equal(Self, Self) -> Bool
pub fn LeaderRequest::equal(Self, Self) -> Bool
pub fn LeaderRequest::not_equal(Self, Self) -> Bool
pub fn LeaderResponse::equal(Self, Self) -> Bool
pub fn LeaderResponse::not_equal(Self, Self) -> Bool
pub fn LeaseGrantRequest::equal(Self, Self) -> Bool
pub fn LeaseGrantRequest::not_equal(Self, Self) -> Bool
pub fn LeaseGrantResponse::equal(Self, Self) -> Bool
pub fn LeaseGrantResponse::not_equal(Self, Self) -> Bool
pub fn LeaseKeepAliveRequest::equal(Self, Self) -> Bool
pub fn LeaseKeepAliveRequest::not_equal(Self, Self) -> Bool
pub fn LeaseKeepAliveResponse::equal(Self, Self) -> Bool
pub fn LeaseKeepAliveResponse::not_equal(Self, Self) -> Bool
pub fn LeaseLeasesResponse::equal(Self, Self) -> Bool
pub fn LeaseLeasesResponse::not_equal(Self, Self) -> Bool
pub fn LeaseRevokeRequest::equal(Self, Self) -> Bool
pub fn LeaseRevokeRequest::not_equal(Self, Self) -> Bool
pub fn LeaseRevokeResponse::equal(Self, Self) -> Bool
pub fn LeaseRevokeResponse::not_equal(Self, Self) -> Bool
pub fn LeaseStatus::equal(Self, Self) -> Bool
pub fn LeaseStatus::not_equal(Self, Self) -> Bool
pub fn LeaseTimeToLiveRequest::equal(Self, Self) -> Bool
pub fn LeaseTimeToLiveRequest::not_equal(Self, Self) -> Bool
pub fn LeaseTimeToLiveResponse::equal(Self, Self) -> Bool
pub fn LeaseTimeToLiveResponse::not_equal(Self, Self) -> Bool
pub fn LockRequest::equal(Self, Self) -> Bool
pub fn LockRequest::not_equal(Self, Self) -> Bool
pub fn LockResponse::equal(Self, Self) -> Bool
pub fn LockResponse::not_equal(Self, Self) -> Bool
pub fn Member::equal(Self, Self) -> Bool
pub fn Member::not_equal(Self, Self) -> Bool
pub fn MemberAddRequest::equal(Self, Self) -> Bool
pub fn MemberAddRequest::not_equal(Self, Self) -> Bool
pub fn MemberAddResponse::equal(Self, Self) -> Bool
pub fn MemberAddResponse::not_equal(Self, Self) -> Bool
pub fn MemberListRequest::equal(Self, Self) -> Bool
pub fn MemberListRequest::not_equal(Self, Self) -> Bool
pub fn MemberListResponse::equal(Self, Self) -> Bool
pub fn MemberListResponse::not_equal(Self, Self) -> Bool
pub fn MemberPromoteRequest::equal(Self, Self) -> Bool
pub fn MemberPromoteRequest::not_equal(Self, Self) -> Bool
pub fn MemberPromoteResponse::equal(Self, Self) -> Bool
pub fn MemberPromoteResponse::not_equal(Self, Self) -> Bool
pub fn MemberRemoveRequest::equal(Self, Self) -> Bool
pub fn MemberRemoveRequest::not_equal(Self, Self) -> Bool
pub fn MemberRemoveResponse::equal(Self, Self) -> Bool
pub fn MemberRemoveResponse::not_equal(Self, Self) -> Bool
pub fn MemberUpdateRequest::equal(Self, Self) -> Bool
pub fn MemberUpdateRequest::not_equal(Self, Self) -> Bool
pub fn MemberUpdateResponse::equal(Self, Self) -> Bool
pub fn MemberUpdateResponse::not_equal(Self, Self) -> Bool
pub fn MoveLeaderRequest::equal(Self, Self) -> Bool
pub fn MoveLeaderRequest::not_equal(Self, Self) -> Bool
pub fn MoveLeaderResponse::equal(Self, Self) -> Bool
pub fn MoveLeaderResponse::not_equal(Self, Self) -> Bool
pub fn Permission::equal(Self, Self) -> Bool
pub fn Permission::not_equal(Self, Self) -> Bool
pub fn PermissionType::equal(Self, Self) -> Bool
pub fn PermissionType::not_equal(Self, Self) -> Bool
pub fn ProclaimRequest::equal(Self, Self) -> Bool
pub fn ProclaimRequest::not_equal(Self, Self) -> Bool
pub fn ProclaimResponse::equal(Self, Self) -> Bool
pub fn ProclaimResponse::not_equal(Self, Self) -> Bool
pub fn PutRequest::equal(Self, Self) -> Bool
pub fn PutRequest::not_equal(Self, Self) -> Bool
pub fn PutResponse::equal(Self, Self) -> Bool
pub fn PutResponse::not_equal(Self, Self) -> Bool
pub fn RangeRequest::equal(Self, Self) -> Bool
pub fn RangeRequest::not_equal(Self, Self) -> Bool
pub fn RangeResponse::equal(Self, Self) -> Bool
pub fn RangeResponse::not_equal(Self, Self) -> Bool
pub fn RequestOp::equal(Self, Self) -> Bool
pub fn RequestOp::not_equal(Self, Self) -> Bool
pub fn ResignRequest::equal(Self, Self) -> Bool
pub fn ResignRequest::not_equal(Self, Self) -> Bool
pub fn ResignResponse::equal(Self, Self) -> Bool
pub fn ResignResponse::not_equal(Self, Self) -> Bool
pub fn ResponseHeader::equal(Self, Self) -> Bool
pub fn ResponseHeader::not_equal(Self, Self) -> Bool
pub fn ResponseOp::equal(Self, Self) -> Bool
pub fn ResponseOp::not_equal(Self, Self) -> Bool
pub fn SnapshotRequest::equal(Self, Self) -> Bool
pub fn SnapshotRequest::not_equal(Self, Self) -> Bool
pub fn SnapshotResponse::equal(Self, Self) -> Bool
pub fn SnapshotResponse::not_equal(Self, Self) -> Bool
pub fn SortOrder::equal(Self, Self) -> Bool
pub fn SortOrder::not_equal(Self, Self) -> Bool
pub fn SortTarget::equal(Self, Self) -> Bool
pub fn SortTarget::not_equal(Self, Self) -> Bool
pub fn Status::equal(Self, Self) -> Bool
pub fn Status::not_equal(Self, Self) -> Bool
pub fn StatusResponse::equal(Self, Self) -> Bool
pub fn StatusResponse::not_equal(Self, Self) -> Bool
pub fn TlsConfig::equal(Self, Self) -> Bool
pub fn TlsConfig::not_equal(Self, Self) -> Bool
pub fn TxnRequest::equal(Self, Self) -> Bool
pub fn TxnRequest::not_equal(Self, Self) -> Bool
pub fn TxnResponse::equal(Self, Self) -> Bool
pub fn TxnResponse::not_equal(Self, Self) -> Bool
pub fn UnlockRequest::equal(Self, Self) -> Bool
pub fn UnlockRequest::not_equal(Self, Self) -> Bool
pub fn UnlockResponse::equal(Self, Self) -> Bool
pub fn UnlockResponse::not_equal(Self, Self) -> Bool
pub fn UserAddOptions::equal(Self, Self) -> Bool
pub fn UserAddOptions::not_equal(Self, Self) -> Bool
pub fn WatchCancelRequest::equal(Self, Self) -> Bool
pub fn WatchCancelRequest::not_equal(Self, Self) -> Bool
pub fn WatchCreateRequest::equal(Self, Self) -> Bool
pub fn WatchCreateRequest::not_equal(Self, Self) -> Bool
pub fn WatchProgressRequest::equal(Self, Self) -> Bool
pub fn WatchProgressRequest::not_equal(Self, Self) -> Bool
pub fn WatchRequest::equal(Self, Self) -> Bool
pub fn WatchRequest::not_equal(Self, Self) -> Bool
pub fn WatchResponse::equal(Self, Self) -> Bool
pub fn WatchResponse::not_equal(Self, Self) -> Bool

client

211 items · moonbitstack/moonetcd/client
Types 21
pub struct Auth {
  client : Client
}

A typed handle for the Auth service. Obtain it with client.auth().

pub struct Client {
  transport : &Transport
  config : @moonetcd.ClientConfig
  targets : Array[(String, Int32)]
  mut token : String
}

A live etcd client. Construct it with Client::connect for gRPC or Client::connect_gateway for the HTTP/JSON gateway; the handles returned by kv, watch, lease, … share its connection.

pub struct Cluster {
  client : Client
}

A typed handle for the Cluster service. Obtain it with client.cluster().

pub struct Election {
  client : Client
}

A typed handle for the Election service. Obtain it with client.election().

pub struct GatewayKeepAliveStream {
  transport : GatewayTransport
  metadata : Array[@header.Header]
  pending : Array[@moonetcd.LeaseKeepAliveResponse]
}

A keep-alive session over the gateway. The gateway answers one request with one acknowledgement and ends the reply, so each tick is its own exchange; next returns what the last tick was told. That is fewer round trips than a stream only when a client holds one lease, and it is the only shape the gateway offers.

pub struct GatewayTransport {
  targets : Array[(String, Int32)]
  idle : Array[HttpConn]
  mut next_endpoint : Int32
  mutex : @async.Mutex
  tls : @tls.Client?
  name : String?
}

etcd over its HTTP/JSON gateway. Built by Client::connect_gateway.

A unary call keeps its connection for the next one; the pool is what makes a client shared by many tasks cheap. A stream owns its connection until it ends, because the gateway streams one call per request — there is no duplex to multiplex on.

pub struct GatewayWatchStream {
  transport : GatewayTransport
  call : @moonetcd.GatewayCall
  metadata : Array[@header.Header]
  mut conn : HttpConn
  mut create : @moonetcd.WatchCreateRequest
  mut last_revision : Int64
  mut pending : Bytes
  mut reconnects : Int32
  mut closed : Bool
}

One watch over the gateway. Each event arrives as a line of a streamed reply; a stream the server ends is re-opened from just past the last revision seen, so a watched key is not missed because a connection went away.

pub struct GrpcKeepAliveStream {
  mux : @net.MuxChannel
  bidi : @net.BidiStream
}

One keep-alive session over gRPC: a bidi stream on its own connection, so it never disturbs the unary path.

pub struct GrpcTransport {
  targets : Array[(String, Int32)]
  tls : @tls.Client?
  name : String?
  channels : Map[String, @net.Channel]
  mut next : Int32
}

etcd over gRPC. Built by Client::connect.

name is what a certificate has to carry, and what the handshake offers as SNI: a member reached by address and certified by name is dialled by its address and checked against its name, at every dial including a reconnection.

pub struct GrpcWatchStream {
  transport : GrpcTransport
  group : @async.TaskGroup[Unit]
  metadata : Array[@header.Header]
  mut mux : @net.MuxChannel
  mut bidi : @net.BidiStream
  mut create : @moonetcd.WatchCreateRequest
  mut last_revision : Int64
  mut watch_id : Int64
  mut endpoint : Int32
  mut reconnects : Int32
  mut closed : Bool
}

One watch over gRPC. The stream carries the create request; on a dropped connection it reconnects to the next endpoint and re-issues the create just past the last event it saw — the resume etcd's own client does. Closing the channel is what cancels the watch on the server.

pub struct HttpConn {
  socket : @tcp.Conn
  http : @http1.Conn
  authority : String
  mut reusable : Bool
}

A connection to one endpoint, with the request in flight or the last one finished.

pub struct KeepAlive {
  stream : &KeepAliveStream
}

A live KeepAlive session. Open it with keep_alive, ask it to hold leases with keep_alive(id), drain acknowledgements with next, and close it with close.

pub(open) trait KeepAliveStream {
  async fn keep_alive(Self, Int64) -> Unit raise @moonetcd.EtcdError
  async fn next(Self) -> @moonetcd.LeaseKeepAliveResponse? raise @moonetcd.EtcdError
  fn close(Self) -> Unit
}

A lease keep-alive session: requests go out, acknowledgements come back.

pub struct KV {
  client : Client
}

A typed handle for the KV service. Obtain it with client.kv().

pub struct Lease {
  client : Client
}

A typed handle for the Lease service. Obtain it with client.lease().

pub struct Lock {
  client : Client
}

A typed handle for the Lock service. Obtain it with client.lock().

pub struct Maintenance {
  client : Client
}

A typed handle for the Maintenance service. Obtain it with client.maintenance().

pub(open) trait Transport {
  async fn unary(Self, String, Bytes, metadata~ : Array[@header.Header], timeout? : Int32) -> Bytes raise @moonetcd.EtcdError
  async fn collect(Self, String, Bytes, metadata~ : Array[@header.Header]) -> Array[Bytes] raise @moonetcd.EtcdError
  async fn watch(Self, @moonetcd.WatchCreateRequest, metadata~ : Array[@header.Header], group~ : @async.TaskGroup[Unit]) -> &WatchStream raise @moonetcd.EtcdError
  async fn keep_alive(Self, metadata~ : Array[@header.Header], group~ : @async.TaskGroup[Unit]) -> &KeepAliveStream raise @moonetcd.EtcdError
  fn close(Self) -> Unit
}

One etcd endpoint reached one way: gRPC over HTTP/2, or etcd's HTTP/JSON gateway. connect and connect_gateway build the two that ship; Client::of_transport takes any implementation.

pub struct Watch {
  client : Client
}

A typed handle for the Watch service. Obtain it with client.watch().

pub struct WatchChan {
  stream : &WatchStream
  mut closed : Bool
}

An open watch. Pull events with next; end it with cancel.

pub(open) trait WatchStream {
  async fn next(Self) -> @moonetcd.WatchResponse? raise @moonetcd.EtcdError
  fn close(Self) -> Unit
}

A watch in progress: events arrive one at a time, and a stream that drops resumes from the last revision it reported.

Functions & methods 76
pub async fn Auth::disable(Self) -> @moonetcd.AuthDisableResponse raise @moonetcd.EtcdError

Turn authentication off.

pub async fn Auth::enable(Self) -> @moonetcd.AuthEnableResponse raise @moonetcd.EtcdError

Turn authentication on. From here on, calls need a token.

pub async fn Auth::role_add(Self, String) -> @moonetcd.AuthRoleAddResponse raise @moonetcd.EtcdError

Create role name.

pub async fn Auth::role_delete(Self, String) -> @moonetcd.AuthRoleDeleteResponse raise @moonetcd.EtcdError

Delete role role.

pub async fn Auth::role_get(Self, String) -> @moonetcd.AuthRoleGetResponse raise @moonetcd.EtcdError

The permissions granted to role role.

pub async fn Auth::role_grant_permission(Self, String, @moonetcd.Permission) -> @moonetcd.AuthRoleGrantPermissionResponse raise @moonetcd.EtcdError

Grant perm to role name.

pub async fn Auth::role_list(Self) -> @moonetcd.AuthRoleListResponse raise @moonetcd.EtcdError

Every role name.

pub async fn Auth::role_revoke_permission(Self, String, Bytes, Bytes) -> @moonetcd.AuthRoleRevokePermissionResponse raise @moonetcd.EtcdError

Revoke the permission on [key, range_end) from role role.

pub async fn Auth::status(Self) -> @moonetcd.AuthStatusResponse raise @moonetcd.EtcdError

Report whether authentication is enabled and the current auth revision.

pub async fn Auth::user_add(Self, String, String, no_password? : Bool) -> @moonetcd.AuthUserAddResponse raise @moonetcd.EtcdError

Create user name with password; no_password creates a user without one.

pub async fn Auth::user_change_password(Self, String, String) -> @moonetcd.AuthUserChangePasswordResponse raise @moonetcd.EtcdError

Change user name's password.

pub async fn Auth::user_delete(Self, String) -> @moonetcd.AuthUserDeleteResponse raise @moonetcd.EtcdError

Delete user name.

pub async fn Auth::user_get(Self, String) -> @moonetcd.AuthUserGetResponse raise @moonetcd.EtcdError

The roles held by user name.

pub async fn Auth::user_grant_role(Self, String, String) -> @moonetcd.AuthUserGrantRoleResponse raise @moonetcd.EtcdError

Grant role role to user user.

pub async fn Auth::user_list(Self) -> @moonetcd.AuthUserListResponse raise @moonetcd.EtcdError

Every user name.

pub async fn Auth::user_revoke_role(Self, String, String) -> @moonetcd.AuthUserRevokeRoleResponse raise @moonetcd.EtcdError

Revoke role role from user name.

pub fn Client::auth(Self) -> Auth

The Auth handle: enable/disable and user/role management.

pub async fn Client::authenticate(Self, String, String) -> String raise @moonetcd.EtcdError

Authenticate with the given user and password and return the auth token. Call Client::connect to have the token cached, or store the return value and set it on the client when re-authenticating.

pub fn Client::close(Self) -> Unit

Close every backend connection. Outstanding calls are abandoned.

pub fn Client::cluster(Self) -> Cluster

The Cluster handle: member add/remove/update/list/promote.

pub async fn Client::connect(@moonetcd.ClientConfig) -> Self raise @moonetcd.EtcdError

Dial the configured endpoints over gRPC and, if a username and password are set, authenticate and cache the token. The token travels as the token metadata header on every later call. TLS is dialled when the configuration enables it.

pub async fn Client::connect_gateway(@moonetcd.ClientConfig) -> Self raise @moonetcd.EtcdError

Reach the same endpoints through etcd's HTTP/JSON gateway, which every etcd serves on its client port. The handles are identical to the gRPC ones, down to the messages they carry; only the wire changes, with keys and values in base64.

pub fn Client::election(Self) -> Election

The Election handle: the v3election service.

pub fn Client::endpoint_at(Self, Int32) -> (String, Int32)

The i-th endpoint as (host, port), wrapping around so the next endpoint after the last is the first — the basis of stream failover.

pub fn Client::endpoint_count(Self) -> Int32

The number of configured endpoints.

pub fn Client::kv(Self) -> KV

The KV handle: Put, Range, DeleteRange, Txn, Compact.

pub fn Client::lease(Self) -> Lease

The Lease handle: grant, revoke, TimeToLive, list, and KeepAlive.

pub fn Client::lock(Self) -> Lock

The Lock handle: the v3lock service.

pub fn Client::maintenance(Self) -> Maintenance

The Maintenance handle: status, alarms, defragment, snapshot, leader moves.

pub async fn Client::of_transport(@moonetcd.ClientConfig, &Transport) -> Self

A client over a transport of the caller's own, with the same authentication handshake as the two that ship.

pub fn Client::watch(Self) -> Watch

The Watch handle: a stream that resumes from the last revision.

pub async fn Cluster::member_add(Self, Array[String], is_learner? : Bool) -> @moonetcd.MemberAddResponse raise @moonetcd.EtcdError

Add a member with the given peer URLs; is_learner joins it as a non-voting learner.

pub async fn Cluster::member_list(Self, linearizable? : Bool) -> @moonetcd.MemberListResponse raise @moonetcd.EtcdError

List every cluster member. linearizable reads through the leader.

pub async fn Cluster::member_promote(Self, UInt64) -> @moonetcd.MemberPromoteResponse raise @moonetcd.EtcdError

Promote the learner id to a voting member.

pub async fn Cluster::member_remove(Self, UInt64) -> @moonetcd.MemberRemoveResponse raise @moonetcd.EtcdError

Remove the member with id id.

pub async fn Cluster::member_update(Self, UInt64, Array[String]) -> @moonetcd.MemberUpdateResponse raise @moonetcd.EtcdError

Replace member id's peer URLs.

pub async fn Election::campaign(Self, Bytes, Bytes, Int64) -> @moonetcd.CampaignResponse raise @moonetcd.EtcdError

Campaign for leadership of election name, carrying value and holding the candidacy on lease. Blocks until name is won (or the lease dies).

pub async fn Election::leader(Self, Bytes) -> @moonetcd.LeaderResponse raise @moonetcd.EtcdError

The current leader of election name.

pub async fn Election::proclaim(Self, @moonetcd.LeaderKey, Bytes) -> @moonetcd.ProclaimResponse raise @moonetcd.EtcdError

Proclaim value as the leader identified by leader.

pub async fn Election::resign(Self, @moonetcd.LeaderKey) -> @moonetcd.ResignResponse raise @moonetcd.EtcdError

Resign the leadership identified by leader.

pub fn gateway_tls(@moonetcd.TlsConfig) -> @tls.Client? raise @moonetcd.EtcdError

The TLS setup for the gateway port: no protocol in ALPN, which is what leaves etcd serving HTTP/1.1 rather than the HTTP/2 it offers. None when TLS is switched off.

pub fn grpc_tls(@moonetcd.TlsConfig) -> @tls.Client? raise @moonetcd.EtcdError

The TLS setup for the gRPC port: HTTP/2, so the client names h2 and nothing else. None when the configuration has TLS switched off.

pub fn GrpcTransport::connect(Array[(String, Int32)], tls? : @tls.Client, name? : String) -> Self

Dial the endpoints. Nothing is sent until the first call, and a member that is not up yet is dialled when a call first reaches it.

pub async fn HttpConn::body(Self) -> Bytes raise @moonetcd.EtcdError

The rest of the body, up to the end of the message.

pub fn HttpConn::close(Self) -> Unit

Drop the connection. A stream holds its own, so this is how a watch a caller has lost interest in is cancelled: the gateway cancels the watch when the request ends.

pub fn HttpConn::is_reusable(Self) -> Bool

Whether the connection can carry another request.

pub async fn HttpConn::next_event(Self) -> @http1.Event raise @moonetcd.EtcdError

The next event the peer sends, with more octets read from the socket whenever the state machine asks for them. Closed means the peer hung up.

pub async fn HttpConn::open(String, Int32, tls? : @tls.Client, name? : String) -> Self raise @moonetcd.EtcdError

Dial host:port and start an HTTP/1.1 client on it. With tls the socket is upgraded before the first request; name, when given, is the SNI the handshake offers and the name the certificate is checked against.

pub async fn HttpConn::post(Self, String, Bytes, Array[@header.Header]) -> Unit raise @moonetcd.EtcdError

Post body to path, with the gateway's headers plus whatever metadata the call carries. The gateway reads the auth token from Authorization, which is where the token metadata goes.

pub fn HttpConn::ready(Self) -> Unit raise @moonetcd.EtcdError

Begin the next exchange on a kept-alive connection.

pub async fn HttpConn::response_head(Self) -> @http1.Response raise @moonetcd.EtcdError

The status line and headers of the reply, as soon as they have arrived.

pub fn KeepAlive::close(Self) -> Unit

End the session and release its connection.

pub async fn KeepAlive::keep_alive(Self, Int64) -> Unit raise @moonetcd.EtcdError

Ask the server to keep id alive for another period.

pub async fn KeepAlive::next(Self) -> @moonetcd.LeaseKeepAliveResponse? raise @moonetcd.EtcdError

The next acknowledgement, or None when the session has ended.

pub async fn KV::compact(Self, Int64, physical? : Bool) -> @moonetcd.CompactionResponse raise @moonetcd.EtcdError

Compact the key-value store up to revision. physical forces a physical compaction.

pub async fn KV::delete_range(Self, @moonetcd.DeleteRangeRequest) -> @moonetcd.DeleteRangeResponse raise @moonetcd.EtcdError

Delete key (or the range [key, range_end)); with prev_kv the deleted values come back in prev_kvs.

pub async fn KV::get(Self, Bytes) -> @moonetcd.RangeResponse raise @moonetcd.EtcdError

Read a single key.

pub async fn KV::get_prefix(Self, Bytes) -> @moonetcd.RangeResponse raise @moonetcd.EtcdError

Read every key under prefix ([prefix, prefix+1)), in key order.

pub async fn KV::put(Self, Bytes, Bytes, lease? : Int64, prev_kv? : Bool) -> @moonetcd.PutResponse raise @moonetcd.EtcdError

Put key = value; lease (when non-zero) attaches the key to a lease. With prev_kv set, the previous KeyValue comes back in the response's prev_kv.

pub async fn KV::range(Self, @moonetcd.RangeRequest) -> @moonetcd.RangeResponse raise @moonetcd.EtcdError

Read the keys in [key, range_end) (an empty range_end is a single key).

pub async fn KV::txn(Self, @moonetcd.TxnRequest) -> @moonetcd.TxnResponse raise @moonetcd.EtcdError

Run a Txn: the comparisons decide whether the success or the failure ops run.

pub async fn Lease::grant(Self, Int64, id? : Int64) -> @moonetcd.LeaseGrantResponse raise @moonetcd.EtcdError

Create a lease that lives for ttl seconds; an explicit id pins the lease id.

pub async fn Lease::keep_alive(Self, @async.TaskGroup[Unit]) -> KeepAlive raise @moonetcd.EtcdError

Open the keep-alive session. g is the task group that carries the stream's background work, so this — like Watch::watch_create — must run inside @async.with_task_group.

pub async fn Lease::leases(Self) -> @moonetcd.LeaseLeasesResponse raise @moonetcd.EtcdError

List every lease id currently known to the cluster.

pub async fn Lease::revoke(Self, Int64) -> @moonetcd.LeaseRevokeResponse raise @moonetcd.EtcdError

Revoke the lease id; all keys attached to it are deleted.

pub async fn Lease::time_to_live(Self, Int64, keys? : Bool) -> @moonetcd.LeaseTimeToLiveResponse raise @moonetcd.EtcdError

Inspect lease id: its remaining TTL, the granted TTL, and (with keys) the keys it guards.

pub async fn Lock::lock(Self, Bytes, Int64) -> @moonetcd.LockResponse raise @moonetcd.EtcdError

Acquire the lock named name. The returned key is what unlock takes; name is the lock's identity, shared by every contender.

pub async fn Lock::unlock(Self, Bytes) -> @moonetcd.UnlockResponse raise @moonetcd.EtcdError

Release the lock whose key key was returned by lock.

pub async fn Maintenance::alarm(Self, @moonetcd.AlarmAction, UInt64, @moonetcd.AlarmType) -> @moonetcd.AlarmResponse raise @moonetcd.EtcdError

Get, activate, or deactivate an alarm. alarm selects the alarm type; use Get with None to read them all.

pub async fn Maintenance::defragment(Self) -> @moonetcd.DefragmentResponse raise @moonetcd.EtcdError

Defragment the member's backend database.

pub async fn Maintenance::move_leader(Self, UInt64) -> @moonetcd.MoveLeaderResponse raise @moonetcd.EtcdError

Transfer leadership of the cluster to member target_id.

pub async fn Maintenance::snapshot(Self) -> Array[@moonetcd.SnapshotResponse] raise @moonetcd.EtcdError

Stream a point-in-time snapshot of the backend, returned as its ordered blobs. The transport collects the whole stream, so this loads the snapshot into memory.

pub async fn Maintenance::status(Self) -> @moonetcd.StatusResponse raise @moonetcd.EtcdError

The status of the member this handle reaches: version, db size, leader, raft indices, and any active alarms.

pub async fn Watch::watch_create(Self, @async.TaskGroup[Unit], @moonetcd.WatchCreateRequest) -> WatchChan raise @moonetcd.EtcdError

Open a watch for request. The call runs inside @async.with_task_group, whose group g carries the stream's background work — pass it in so the transport can read the connection while the caller waits for events.

pub fn WatchChan::cancel(Self) -> Unit

End the watch and release its connection.

pub async fn WatchChan::next(Self) -> @moonetcd.WatchResponse? raise @moonetcd.EtcdError

The next WatchResponse, or None once the watch has ended.

Re-exports 114
pub using @moonetcd {type AlarmAction}
pub using @moonetcd {type AlarmRequest}
pub using @moonetcd {type AlarmResponse}
pub using @moonetcd {type AlarmType}
pub using @moonetcd {type Alarm}
pub using @moonetcd {type AuthDisableResponse}
pub using @moonetcd {type AuthEnableResponse}
pub using @moonetcd {type AuthenticateRequest}
pub using @moonetcd {type AuthenticateResponse}
pub using @moonetcd {type AuthRoleAddRequest}
pub using @moonetcd {type AuthRoleAddResponse}
pub using @moonetcd {type AuthRoleDeleteRequest}
pub using @moonetcd {type AuthRoleDeleteResponse}
pub using @moonetcd {type AuthRoleGetRequest}
pub using @moonetcd {type AuthRoleGetResponse}
pub using @moonetcd {type AuthRoleGrantPermissionRequest}
pub using @moonetcd {type AuthRoleGrantPermissionResponse}
pub using @moonetcd {type AuthRoleListResponse}
pub using @moonetcd {type AuthRoleRevokePermissionRequest}
pub using @moonetcd {type AuthRoleRevokePermissionResponse}
pub using @moonetcd {type AuthStatusResponse}
pub using @moonetcd {type AuthUserAddRequest}
pub using @moonetcd {type AuthUserAddResponse}
pub using @moonetcd {type AuthUserChangePasswordRequest}
pub using @moonetcd {type AuthUserChangePasswordResponse}
pub using @moonetcd {type AuthUserDeleteRequest}
pub using @moonetcd {type AuthUserDeleteResponse}
pub using @moonetcd {type AuthUserGetRequest}
pub using @moonetcd {type AuthUserGetResponse}
pub using @moonetcd {type AuthUserGrantRoleRequest}
pub using @moonetcd {type AuthUserGrantRoleResponse}
pub using @moonetcd {type AuthUserListResponse}
pub using @moonetcd {type AuthUserRevokeRoleRequest}
pub using @moonetcd {type AuthUserRevokeRoleResponse}
pub using @moonetcd {type CampaignRequest}
pub using @moonetcd {type CampaignResponse}
pub using @moonetcd {type ClientConfig}
pub using @moonetcd {type CmpTarget}
pub using @moonetcd {type CompactionRequest}
pub using @moonetcd {type CompactionResponse}
pub using @moonetcd {type CompareResult}
pub using @moonetcd {type CompareTarget}
pub using @moonetcd {type Compare}
pub using @moonetcd {type DefragmentResponse}
pub using @moonetcd {type DeleteRangeRequest}
pub using @moonetcd {type DeleteRangeResponse}
pub using @moonetcd {type DowngradeAction}
pub using @moonetcd {type DowngradeRequest}
pub using @moonetcd {type DowngradeResponse}
pub using @moonetcd {type EtcdError}
pub using @moonetcd {type EventType}
pub using @moonetcd {type Event}
pub using @moonetcd {type FilterType}
pub using @moonetcd {type HashKVResponse}
pub using @moonetcd {type HashResponse}
pub using @moonetcd {type KeyValue}
pub using @moonetcd {type LeaderKey}
pub using @moonetcd {type LeaderRequest}
pub using @moonetcd {type LeaderResponse}
pub using @moonetcd {type LeaseGrantRequest}
pub using @moonetcd {type LeaseGrantResponse}
pub using @moonetcd {type LeaseKeepAliveRequest}
pub using @moonetcd {type LeaseKeepAliveResponse}
pub using @moonetcd {type LeaseLeasesResponse}
pub using @moonetcd {type LeaseRevokeRequest}
pub using @moonetcd {type LeaseRevokeResponse}
pub using @moonetcd {type LeaseStatus}
pub using @moonetcd {type LeaseTimeToLiveRequest}
pub using @moonetcd {type LeaseTimeToLiveResponse}
pub using @moonetcd {type LockRequest}
pub using @moonetcd {type LockResponse}
pub using @moonetcd {type MemberAddRequest}
pub using @moonetcd {type MemberAddResponse}
pub using @moonetcd {type MemberListRequest}
pub using @moonetcd {type MemberListResponse}
pub using @moonetcd {type MemberPromoteRequest}
pub using @moonetcd {type MemberPromoteResponse}
pub using @moonetcd {type MemberRemoveRequest}
pub using @moonetcd {type MemberRemoveResponse}
pub using @moonetcd {type MemberUpdateRequest}
pub using @moonetcd {type MemberUpdateResponse}
pub using @moonetcd {type Member}
pub using @moonetcd {type MoveLeaderRequest}
pub using @moonetcd {type MoveLeaderResponse}
pub using @moonetcd {type PermissionType}
pub using @moonetcd {type Permission}
pub using @moonetcd {type ProclaimRequest}
pub using @moonetcd {type ProclaimResponse}
pub using @moonetcd {type PutRequest}
pub using @moonetcd {type PutResponse}
pub using @moonetcd {type RangeRequest}
pub using @moonetcd {type RangeResponse}
pub using @moonetcd {type RequestOp}
pub using @moonetcd {type ResignRequest}
pub using @moonetcd {type ResignResponse}
pub using @moonetcd {type ResponseHeader}
pub using @moonetcd {type ResponseOp}
pub using @moonetcd {type SnapshotRequest}
pub using @moonetcd {type SnapshotResponse}
pub using @moonetcd {type SortOrder}
pub using @moonetcd {type SortTarget}
pub using @moonetcd {type StatusResponse}
pub using @moonetcd {type Status}
pub using @moonetcd {type TlsConfig}
pub using @moonetcd {type TxnRequest}
pub using @moonetcd {type TxnResponse}
pub using @moonetcd {type UnlockRequest}
pub using @moonetcd {type UnlockResponse}
pub using @moonetcd {type UserAddOptions}
pub using @moonetcd {type WatchCancelRequest}
pub using @moonetcd {type WatchCreateRequest}
pub using @moonetcd {type WatchProgressRequest}
pub using @moonetcd {type WatchRequest}
pub using @moonetcd {type WatchResponse}

concurrency

16 items · moonbitstack/moonetcd/concurrency
Types 3
pub struct Election {
  client : @client.Client
  lease_id : Int64
  name : Bytes
  mut leader : @moonetcd.LeaderKey
}

A client-side election for name. Create it with Election::new, then campaign, proclaim, and resign.

pub struct Mutex {
  client : @client.Client
  lease_id : Int64
  name : Bytes
  mut key : Bytes
}

A distributed mutex named name, held by the session's lease. Create it with Mutex::new, then lock and unlock.

pub struct Session {
  client : @client.Client
  lease_id : Int64
  ttl : Int64
}

A lease-backed session. Create it with Session::new; attach keys to lease_id(), and call close to revoke it.

Functions & methods 13
pub async fn Election::campaign(Self, Bytes) -> Unit raise @moonetcd.EtcdError

Campaign for leadership carrying value; blocks until name is won (or the lease dies), then records the resulting leader key.

pub async fn Election::current_leader(Self) -> @moonetcd.KeyValue raise @moonetcd.EtcdError

The current leader of the election.

The current leader's key-value of the election.

pub fn Election::new(@client.Client, Session, Bytes) -> Self

Build an election over name, campaigning on session's lease.

pub async fn Election::proclaim(Self, Bytes) -> Unit raise @moonetcd.EtcdError

Proclaim value as the current leader's.

pub async fn Election::resign(Self) -> Unit raise @moonetcd.EtcdError

Resign the leadership.

pub async fn Mutex::lock(Self) -> Unit raise @moonetcd.EtcdError

Acquire the mutex. Blocks until the lock is granted; then unlock releases it.

pub fn Mutex::new(@client.Client, Session, Bytes) -> Self

Build a mutex over name, using session's lease to hold it.

pub async fn Mutex::unlock(Self) -> Unit raise @moonetcd.EtcdError

Release the mutex (a no-op if it is not held).

pub async fn Session::close(Self) -> Unit raise @moonetcd.EtcdError

Revoke the lease — deleting every key attached to it.

pub async fn Session::keep_alive(Self, @async.TaskGroup[Unit]) -> @client.KeepAlive raise @moonetcd.EtcdError

Open a KeepAlive stream for this lease. g is the task group that drives the channel's read pump, so call this inside @async.with_task_group; then drive keep_alive/next to hold the lease.

pub fn Session::lease_id(Self) -> Int64

The lease id to attach keys to (via a Put's lease field).

pub async fn Session::new(@client.Client, Int64) -> Self raise @moonetcd.EtcdError

Grant a lease of ttl seconds. For a long-lived session, also open keep_alive and drive it so the lease does not expire.

pub fn Session::ttl(Self) -> Int64

The granted TTL, in seconds.

sd

10 items · moonbitstack/moonetcd/sd
Types 1
pub struct Registry {
  client : @client.Client
  prefix : String
}

A registry over one etcd client. It is both a Registrar and a Discovery.

Values 1
pub let prefix : String

What every key of a registry starts with.

Functions & methods 6
pub async fn Registry::deregister(Self, @moonsd.Lease) -> Unit
pub fn Registry::new(@client.Client, prefix? : String) -> Self
pub async fn Registry::register(Self, String, @moonsd.Endpoint, Int32) -> @moonsd.Lease
pub async fn Registry::renew(Self, @moonsd.Lease) -> Unit
pub async fn Registry::resolve(Self, String) -> Array[@moonsd.Endpoint]
pub async fn Registry::watch(Self, String) -> &@moonsd.Watcher
Implementations 2
pub impl @moonsd.Discovery for Registry
pub impl @moonsd.Registrar for Registry

moonconsul

322 public items

a Consul client, and the contract as services with ttl checks

moonconsul

284 items · moonbitstack/moonconsul
Types 93
pub struct ACL {
  client : Client
}

A handle to the ACL API: tokens (the credentials calls carry), policies (rule sets), roles (policy groupings), auth methods and binding rules.

pub(all) struct ACLAuthMethod {
  name : String?
  kind : String?
  description : String?
  config : Map[String, @json.Json]?
  ns : String?
  partition : String?
}

An auth method: a name and kind (e.g. jwt, kubernetes), its config, and its description. The configuration is held as JSON because a provider's settings mix strings, numbers, booleans and lists (a JWT method's JWTValidationPubkeys is a list of PEM keys).

pub(all) struct ACLBindingRule {
  id : String?
  description : String?
  auth_method : String?
  selector : String?
  bind_type : String?
  bind_name : String?
  ns : String?
  partition : String?
}

A binding rule: selects identities from an auth method and maps them to a bind_type/bind_name via selector.

pub(all) struct ACLLoginParams {
  auth_method : String?
  bearer_token : String?
  token_metadata : Map[String, String]?
}

Parameters for token_login.

pub(all) struct ACLPolicy {
  id : String?
  name : String?
  description : String?
  rules : String?
  datacenter : String?
  ns : String?
  partition : String?
  hash : String?
}

A policy: a name and its rules (HCL or JSON) plus its description.

pub(all) struct ACLRole {
  id : String?
  name : String?
  description : String?
  policies : Array[ACLRolePolicyLink]?
  ns : String?
  partition : String?
  hash : String?
}

A role: a name grouping policies, plus its description and hash.

pub(all) struct ACLRolePolicyLink {
  id : String?
  name : String?
}

A link from a role to a policy, by id or name.

pub(all) struct ACLToken {
  id : String?
  accessor_id : String?
  secret_id : String?
  description : String?
  policies : Array[ACLTokenPolicyLink]?
  roles : Array[ACLTokenRoleLink]?
  is_local : Bool?
  ns : String?
  partition : String?
  hash : String?
  expiration_time : String?
}

A token: its accessor_id (for reference) and secret_id (for calls), the policies and roles it binds, whether it is is_local to one datacenter, and its description and hash.

pub(all) struct ACLTokenPolicyLink {
  id : String?
  name : String?
}

A link from a token to a policy, by id or name.

pub(all) struct ACLTokenRoleLink {
  id : String?
  name : String?
}

A link from a token to a role, by id or name.

pub struct Agent {
  client : Client
}

A handle to the Agent API: register and deregister services and checks on this agent, keep TTL checks alive, read the agent's own state, and manage cluster membership and maintenance mode.

pub(all) struct AgentAuthorize {
  authorized : Bool
  reason : String
}

The answer to an authorization request, with the agent's reason.

pub(all) struct AgentAuthorizeParams {
  target : String
  client_cert_uri : String
  client_cert_serial : String
}

The parameters of an authorization decision: the service a connection is headed for, and the SPIFFE identity and serial the client presented.

pub(all) struct AgentCheck {
  id : String
  name : String?
  status : String?
  notes : String?
  output : String?
  service_id : String?
  service_name : String?
  ns : String?
}

A check as reported by self and the check endpoints: its id, name, current status (passing, warning, critical), output, and the service it guards.

pub(all) struct AgentCheckRegistration {
  id : String?
  name : String
  notes : String?
  service_id : String?
  ns : String?
  status : String?
  definition : AgentServiceCheck
}

The body of PUT /v1/agent/check/register: the identity fields plus the check definition folded in as definition. The agent names the check's id ID here, while a check nested in a service registration calls it CheckID; a registration binds a check to a service by id, so there is no field for the service's name.

pub(all) struct AgentCheckUpdate {
  check_id : String
  status : String
  output : String?
}

The body of PUT /v1/agent/check/update: set a TTL check's status and output without sending a fresh TTL. check_id names the check to update.

pub(all) struct AgentMember {
  name : String
  addr : String
  port : Int32
  tags : Map[String, String]?
  status : String?
}

A cluster member as seen by the agent's gossip layer: its name, addr, port, status, and the tags it gossips (including role, dc, vsn).

pub(all) struct AgentSelf {
  config : @json.Json
  agent_member : AgentMember
  stats : @json.Json
}

The agent's own state: its config, its agent_member record, and stats.

pub(all) struct AgentService {
  id : String
  service : String
  tags : Array[String]
  address : String?
  port : Int32?
  meta : Map[String, String]?
  ns : String?
  weights : AgentWeights?
}

A service registered on this agent. id defaults to name when empty; tags and meta are free-form; address and port are where the instance listens (when unset, the agent's address is used).

pub(all) struct AgentServiceCheck {
  id : String?
  name : String?
  notes : String?
  service_id : String?
  status : String?
  ttl : String?
  interval : String?
  timeout : String?
  http : String?
  tls_skip_verify : Bool?
  http_method : String?
  tcp : String?
  grpc : String?
  grpc_use_tls : Bool?
  header : Map[String, Array[String]]?
  deregister_critical_service_after : String?
  alias_node : String?
  alias_service : String?
  success_before_passing : Int32?
  failures_before_critical : Int32?
}

A health check registered alongside a service or on its own. One of ttl, interval+script/http/tcp/grpc, or alias_* selects the check kind; deregister_critical_service_after lets a failing check auto-remove its service.

pub(all) struct AgentServiceRegistration {
  id : String?
  name : String
  tags : Array[String]?
  address : String?
  port : Int32?
  meta : Map[String, String]?
  ns : String?
  check : AgentServiceCheck?
  checks : Array[AgentServiceCheck]?
  enable_tag_override : Bool?
  weights : AgentWeights?
}

The body of PUT /v1/agent/service/register: a service plus at most one inline check (check) or several (checks); enable_tag_override lets the agent's tags be overridden by the catalog.

pub(all) struct AgentWeights {
  passing : Int32?
  warning : Int32?
}

The primary and passing weights of a service, used by DNS and prepared queries. passing defaults to 1 and warning to 1 when unset.

pub(all) struct CAConfig {
  provider : String
  config : Map[String, @json.Json]?
  state : Map[String, String]?
  force_without_cross_signing : Bool
  create_index : UInt64
  modify_index : UInt64
}

The cluster-wide Connect CA configuration: the provider that signs, its arbitrary settings, and the read-only state the provider persisted.

pub(all) struct CARoot {
  id : String
  name : String
  serial_number : UInt64
  signing_key_id : String
  external_trust_domain : String
  not_before : String?
  not_after : String?
  root_cert_pem : String
  intermediate_cert_pems : Array[String]
  active : Bool
  private_key_type : String?
  private_key_bits : Int32?
  create_index : UInt64
  modify_index : UInt64
}

One trusted root certificate of the Connect CA.

pub(all) struct CARoots {
  active_root_id : String
  trust_domain : String
  roots : Array[CARoot]
}

The roots an agent trusts: the active root's id, the trust domain every SPIFFE identity of the cluster sits under, and the roots themselves.

pub struct Catalog {
  client : Client
}

A handle to the Catalog API: datacenter-wide registration of nodes and services, and read-only listing of nodes, services and their metadata.

pub(all) struct CatalogDeregistration {
  node : String
  address : String?
  service_id : String?
  check_id : String?
  ns : String?
  partition : String?
}

The body of PUT /v1/catalog/deregister: identifies a node, service or check to remove.

pub(all) struct CatalogNode {
  node : Node
  services : Map[String, CatalogNodeService]?
}

A node together with every service registered on it.

pub(all) struct CatalogNodeService {
  id : String
  service : String
  tags : Array[String]
  meta : Map[String, String]?
  ns : String?
  port : Int32?
  address : String?
  weights : AgentWeights?
}

A single service bound to a node, as returned by node.

pub(all) struct CatalogRegistration {
  node : String
  address : String
  node_meta : Map[String, String]?
  ns : String?
  partition : String?
  service : CatalogService?
  check : AgentCheck?
  checks : Array[AgentCheck]?
}

The body of PUT /v1/catalog/register: a node and address, optional node_meta, and at most one service and check (or several checks) to register against that node.

pub(all) struct CatalogService {
  id : String
  node : String
  address : String
  service : String
  tags : Array[String]
  meta : Map[String, String]?
  ns : String?
  partition : String?
  port : Int32?
  weights : AgentWeights?
  create_index : UInt64?
  modify_index : UInt64?
}

A service as listed by the catalog: its id, the node it runs on, and its tags, meta and port.

pub struct Client {
  config : Config
  transport : &Transport
}

A Consul client. It carries a Config and the Transport that performs the HTTP calls, and hands out one handle per API group; each handle shares this client, so a token or datacenter set on the client applies across groups.

pub(all) struct Config {
  address : String
  scheme : String
  datacenter : String?
  ns : String?
  token : String?
  wait_time : Int64
  consistency : ConsistencyMode
  tls : TlsConfig
  transport : &Transport?
}

A Consul client configuration. address is host:port; scheme is http or https. datacenter, namespace and token are the defaults applied to every call unless a call's own options override them. wait_time bounds a blocking query when QueryOptions.wait_time is unset. transport overrides the default moonfetch-backed medium; tests pass an in-memory fake.

pub struct ConfigEntries {
  client : Client
}

A handle to the Config Entries API: typed, centrally-stored configuration objects (service defaults, routers, splitters, resolvers, mesh-wide settings) that Consul serves to the data plane.

pub(all) enum ConfigEntry {
  ServiceDefault(ServiceDefaultConfigEntry)
  ServiceRouter(ServiceRouterConfigEntry)
  ServiceSplitter(ServiceSplitterConfigEntry)
  ServiceResolver(ServiceResolverConfigEntry)
  Mesh(MeshConfigEntry)
}

A config entry. Each variant carries the typed entry for one kind; a read returns the variant for the stored kind, and a write carries the variant to store. kind and name are read from the wrapped entry.

pub struct Connect {
  client : Client
}

A handle to the Connect API: the certificate authority's roots and configuration, and the intentions that decide which services may talk to which.

pub(all) enum ConsistencyMode {
  Default
  Consistent
  Stale
}

How strongly a read must reflect cluster state. Default is served from a follower that may be stale within a bounded window; Consistent is served from the leader and linearizable; Stale is served from any node, including one with no leader, for maximum availability.

pub struct Coordinate {
  client : Client
}

A handle to the Coordinate API: network coordinates (Vivaldi-embedded positions) for latency-aware routing and nearest-node selection.

pub(all) struct CoordinateEntry {
  node : String
  segment : String?
  coord : CoordinateValue?
}

One node's coordinate in a segment.

pub(all) struct CoordinateNode {
  node : String
  coordinates : Array[CoordinateEntry]
}

A node and the coordinates it holds for each datacenter segment.

pub(all) struct CoordinateValue {
  vec : Array[Double]
  error : Double
  adjustment : Double
  height : Double
}

A single node's network coordinate: a vec in the embedded space plus an error, adjustment and height.

pub(all) struct DNSQuery {
  ttl : String?
}

DNS tuning for a query.

pub struct Event {
  client : Client
}

A handle to the Event API: user events are fire-and-forget messages fanned out across the datacenter, optionally scoped to nodes, services or tags.

pub(all) struct EventFireOptions {
  node_filter : String?
  service_filter : String?
  tag_filter : String?
}

Scope filters for fire.

pub(all) struct EventListOptions {
  name : String?
}

List filters for list.

pub struct Health {
  client : Client
}

A handle to the Health API: checks and the healthy instances of a service, including blocking queries that watch a service for membership changes.

pub(all) struct HealthCheck {
  node : String
  check_id : String
  name : String?
  status : String?
  notes : String?
  output : String?
  service_id : String?
  service_name : String?
  ns : String?
}

A check as reported by the health endpoints: its check_id, name, current status, and output.

pub(all) struct HealthService {
  id : String
  service : String
  address : String?
  tags : Array[String]
  meta : Map[String, String]?
  ns : String?
  partition : String?
  port : Int32?
  weights : AgentWeights?
}

One instance of a service as returned by service and connect_service, paired with the node it runs on and its live checks.

pub(all) struct Intention {
  id : String?
  description : String?
  source_ns : String?
  source_name : String
  source_partition : String?
  source_peer : String?
  destination_ns : String?
  destination_name : String
  destination_partition : String?
  source_type : String?
  action : IntentionAction
  meta : Map[String, String]?
  permissions : @json.Json?
  precedence : Int32
  created_at : String?
  updated_at : String?
  create_index : UInt64
  modify_index : UInt64
}

One intention of the service graph. source and destination name a service, ns and partition where it lives (either may be the wildcard ), and as the whole name matches any service. precedence is the agent's: the higher it is, the earlier the intention is considered, and an exact pair outranks a wildcard.

pub(all) enum IntentionAction {
  Allow
  Deny
}

What an intention does with a connection it matches.

pub(all) enum IntentionMatchBy {
  Source
  Destination
}

Which half of an intention a match or a check looks up by.

pub struct KV {
  client : Client
}

A handle to the KV API: the key/value store. Reads and writes are paired with blocking queries; compare-and-swap, acquire and release are what the locks and semaphores of moonconsul/concurrency are built from.

pub(all) struct KVPair {
  key : String
  create_index : UInt64
  modify_index : UInt64
  lock_index : UInt64
  flags : UInt64
  value : Bytes
  session : String?
}

One key/value entry: create_index and modify_index are the indexes that gate blocking reads and CAS; lock_index, flags and session are used by the lock primitives.

pub(all) struct KVTxnError {
  op_index : Int32
  message : String
}

A per-operation failure inside a transaction.

pub(all) struct KVTxnOp {
  verb : KVTxnOpVerb
  key : String
  value : Bytes?
  index : UInt64?
  session : String?
  flags : UInt64?
}

One operation in a txn batch.

pub(all) enum KVTxnOpVerb {
  Set
  CAS
  Delete
  DeleteTree
  DeleteCAS
  Acquire
  Release
  Get
  GetKeys
  CheckSession
  CheckIndex
  CheckNotExists
  Lock
  Unlock
  Read
}

The verb of a transaction operation.

pub(all) struct KVTxnResponse {
  results : Array[KVPair]
  errors : Array[KVTxnError]?
}

The outcome of a txn: the results for the read verbs and the errors for any operation that failed.

pub(all) struct LeafCert {
  serial_number : String
  cert_pem : String
  private_key_pem : String
  service : String
  service_uri : String
  valid_after : String?
  valid_before : String?
  create_index : UInt64
  modify_index : UInt64
}

A leaf certificate the CA issued for one service: the PEM certificate and key, and the SPIFFE identity they carry.

pub(all) struct MeshConfigEntry {
  name : String
  partition : String?
  transparent_proxy : MeshTransparentProxy?
}

Mesh-wide configuration.

pub(all) struct MeshTransparentProxy {
  mode : String?
}

Transparent-proxy settings for the mesh.

pub(all) struct Node {
  node : String
  address : String
  meta : Map[String, String]?
  ns : String?
  partition : String?
  tagged_addresses : Map[String, String]?
  create_index : UInt64?
  modify_index : UInt64?
  deregister_critical_service_after : String?
}

A Consul node: its node name, address, and free-form meta.

pub struct PreparedQuery {
  client : Client
}

A handle to the Prepared Query API: named and templated service queries with failover, used as a stable service-discovery entry point.

pub(all) struct PreparedQueryDefinition {
  id : String?
  name : String?
  token : String?
  ns : String?
  partition : String?
  service : ServiceQuery?
  dns : DNSQuery?
}

A prepared query definition: its id (assigned by Consul), name, token, and the service and dns blocks.

pub(all) struct PreparedQueryExecuteParams {
  ns : String?
  near : String?
  limit : Int32?
}

Parameters for execute: the datacenter to run in, the near node to sort by, and a limit on nodes returned.

pub(all) struct PreparedQueryExecuteResponse {
  service : String?
  datacenter : String?
  nodes : Array[ServiceEntry]?
}

The result of executing a query.

pub(all) struct QueryDatacenterOptions {
  nearest : Bool?
  datacenters : Array[String]?
}

Failover policy: prefer the nearest datacenter, then fall back through datacenters.

pub(all) struct QueryMeta {
  last_index : UInt64
  last_hash : String?
  last_contact : Int64
  known_leader : Bool
  request_time : Int64
}

Metadata returned by every read. last_index is the index the agent last saw for the queried data and is the wait_index of the next blocking query; known_leader and last_contact describe leadership; request_time is the round-trip time in nanoseconds.

pub(all) struct QueryOptions {
  datacenter : String?
  ns : String?
  token : String?
  wait_index : UInt64?
  wait_hash : String?
  wait_time : Int64?
  consistency : ConsistencyMode
  near : String?
  filter : String?
  node_meta : Map[String, String]?
}

Options for a read. wait_index and wait_time drive a blocking query: the agent holds the request until the data's index advances past wait_index or wait_time nanoseconds elapse, then returns the new QueryMeta.last_index to feed the next blocking call. The agent's own endpoints block on a content hash instead, which is what wait_hash and QueryMeta.last_hash carry. datacenter, namespace and token override the client defaults for this call only.

pub(all) suberror Refused {
  Transport(String)
  Status(Int32, String)
  Json(String)
  Conflict(String)
  NotFound
  Param(String)
}

Errors raised by a Consul API call: a transport failure, a non-2xx agent response, a JSON decode failure, a lock conflict, or a bad input.

pub(all) struct Request {
  verb : String
  url : String
  headers : Map[String, String]
  body : Bytes
}

A single HTTP request to a Consul agent: the verb, the full URL (scheme, address, path and query already joined), the request headers, and the body for writes. The transport owns the socket and the TLS configuration.

pub(all) struct Response {
  status : Int32
  headers : Map[String, String]
  body : Bytes
}

A Consul agent's HTTP response: the status code, the response headers (the blocking-query metadata rides on X-Consul-Index and its siblings), and the raw body bytes.

pub(all) struct ServiceDefaultConfigEntry {
  name : String
  ns : String?
  partition : String?
  protocol : String?
  mesh_gateway : ServiceMeshGateway?
}

Default protocol, mesh and per-service settings.

pub(all) struct ServiceEntry {
  node : Node
  service : HealthService?
  checks : Array[HealthCheck]
}

A healthy service instance: the node it runs on, the service instance, and its checks.

pub(all) struct ServiceMeshGateway {
  mode : String?
}

A service's mesh-gateway mode.

pub(all) struct ServiceQuery {
  service : String
  ns : String?
  tags_any : Array[String]?
  only_passing : Bool?
  node_type : String?
  failover : QueryDatacenterOptions?
}

The service a query targets, with tag and health criteria and failover.

pub(all) struct ServiceResolverConfigEntry {
  name : String
  ns : String?
  partition : String?
  datacenter : String?
  service : String?
  failover : QueryDatacenterOptions?
  redirect : String?
}

How a service resolves to healthy instances, with failover.

pub(all) struct ServiceRoute {
  matcher : ServiceRouteMatch?
  destination : ServiceRouteDestination?
}

One routing match/rewrite rule.

pub(all) struct ServiceRouteDestination {
  service : String?
  ns : String?
}

The destination half of a route.

pub(all) struct ServiceRouteHTTPMatch {
  path : String?
  prefix : String?
  regex : String?
}

HTTP match fields.

pub(all) struct ServiceRouteMatch {
  http : ServiceRouteHTTPMatch?
}

The match half of a route.

pub(all) struct ServiceRouterConfigEntry {
  name : String
  ns : String?
  partition : String?
  routes : Array[ServiceRoute]?
}

Layer-7 routing rules for a service.

pub(all) struct ServiceSplit {
  weight : Double
  service : String?
  ns : String?
}

One weighted destination in a split.

pub(all) struct ServiceSplitterConfigEntry {
  name : String
  ns : String?
  partition : String?
  splits : Array[ServiceSplit]?
}

Weighted traffic split for a service.

pub struct Session {
  client : Client
}

A handle to the Session API: sessions are ephemeral leases, bound to a set of checks, that back locks and semaphores. moonconsul/concurrency keeps one alive. When a session's checks fail or its TTL lapses, its held keys are released.

pub(all) enum SessionBehavior {
  Release
  Delete
}

What happens to a session's held keys when it is invalidated: Release frees them, Delete removes them.

pub(all) struct SessionEntry {
  id : String?
  name : String?
  node : String?
  checks : Array[String]?
  lock_delay : Int64?
  behavior : SessionBehavior?
  ttl : String?
}

A session: its id (assigned by Consul), the checks that keep it alive, the lock_delay before a key can be locked again after the session dies, in nanoseconds (Consul reads a value under 1000 as seconds), the behavior on invalidation, and the ttl that bounds its life without a renewal.

pub struct Status {
  client : Client
}

A handle to the Status API: the cluster's leader and its raft peer set.

pub(all) struct TlsConfig {
  ca_file : String?
  cert_file : String?
  key_file : String?
  insecure_skip_verify : Bool
}

TLS settings for an HTTPS agent. The three file paths point at a CA bundle, a client certificate, and its key; insecure_skip_verify turns certificate checking off and is for development against a self-signed agent only.

pub(open) trait Transport {
  async fn send(Self, Request) -> Response raise Refused
}

The HTTP medium a Client drives. It performs one request and returns the response, or raises Refused on a transport failure. The production client plugs an HTTP-backed transport in here; tests plug an in-memory fake that returns canned responses, so the request shaping and JSON parsing run against a real agent's wire format without a network.

pub(all) struct UserEvent {
  id : String
  name : String
  payload : Bytes?
  node_filter : String?
  service_filter : String?
  tag_filter : String?
  version : Int32?
  ltime : Int64?
}

A user event as fired and as listed back.

pub(all) enum WatchKind {
  Key(String)
  KeyPrefix(String)
  Services
  Nodes
  Service(String, passing~ : Bool)
  Checks(String)
  State(String)
  Event(String)
  ConnectRoots
  ConnectLeaf(String)
  AgentService(String)
}

What a blocking read can follow, in the words of Consul's own watch types.

pub(all) struct WriteMeta {
  request_time : Int64
}

Metadata returned by every write: request_time is the round-trip time in nanoseconds.

pub(all) struct WriteOptions {
  datacenter : String?
  ns : String?
  token : String?
}

Options for a write: the datacenter and namespace to target and the ACL token to use, overriding the client defaults for this call only.

Values 11
pub let default_config : Config

The default configuration: http://127.0.0.1:8500, no datacenter, namespace or token, a default-consistency read, and no transport override.

pub let default_event_fire_options : EventFireOptions

No scope filter.

pub let default_event_list_options : EventListOptions

List every event.

pub let default_intention : Intention

An intention with only the two service names set, denying by default: the starting point for one built field by field.

pub let default_prepared_query_execute_params : PreparedQueryExecuteParams

No execution parameters.

pub let default_query_options : QueryOptions

The default read options: no overrides, a default-consistency non-blocking read with no wait.

pub let default_service_check : AgentServiceCheck

A check with nothing set, to update the fields a check needs.

pub let default_service_registration : AgentServiceRegistration

A registration with nothing set but an empty name, to update the fields a service needs.

pub let default_session_entry : SessionEntry

The default session: no id, the default checks, and Consul's default lock delay and TTL.

pub let default_tls : TlsConfig

The default TLS settings: no client certificates and verification on.

pub let default_write_options : WriteOptions

The default write options: no overrides.

Functions & methods 180
pub async fn ACL::auth_method_create(Self, ACLAuthMethod, options? : WriteOptions) -> (ACLAuthMethod, WriteMeta) raise Refused

Create an auth method.

pub async fn ACL::auth_method_delete(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Delete an auth method by name.

pub async fn ACL::auth_method_list(Self, options? : QueryOptions) -> (Array[ACLAuthMethod], QueryMeta) raise Refused

List auth methods.

pub async fn ACL::auth_method_read(Self, String, options? : QueryOptions) -> (ACLAuthMethod, QueryMeta) raise Refused

Read an auth method by name.

pub async fn ACL::auth_method_update(Self, ACLAuthMethod, options? : WriteOptions) -> (ACLAuthMethod, WriteMeta) raise Refused

Update an auth method.

pub async fn ACL::binding_rule_create(Self, ACLBindingRule, options? : WriteOptions) -> (ACLBindingRule, WriteMeta) raise Refused

Create a binding rule.

pub async fn ACL::binding_rule_delete(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Delete a binding rule by id.

pub async fn ACL::binding_rule_list(Self, options? : QueryOptions) -> (Array[ACLBindingRule], QueryMeta) raise Refused

List binding rules.

pub async fn ACL::binding_rule_read(Self, String, options? : QueryOptions) -> (ACLBindingRule, QueryMeta) raise Refused

Read a binding rule by id.

pub async fn ACL::binding_rule_update(Self, ACLBindingRule, options? : WriteOptions) -> (ACLBindingRule, WriteMeta) raise Refused

Update a binding rule.

pub async fn ACL::policy_create(Self, ACLPolicy, options? : WriteOptions) -> (ACLPolicy, WriteMeta) raise Refused

Create a policy.

pub async fn ACL::policy_delete(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Delete a policy by id or name.

pub async fn ACL::policy_list(Self, options? : QueryOptions) -> (Array[ACLPolicy], QueryMeta) raise Refused

List policies.

pub async fn ACL::policy_read(Self, String, options? : QueryOptions) -> (ACLPolicy, QueryMeta) raise Refused

Read a policy by id or name.

pub async fn ACL::policy_update(Self, ACLPolicy, options? : WriteOptions) -> (ACLPolicy, WriteMeta) raise Refused

Update a policy.

pub async fn ACL::role_create(Self, ACLRole, options? : WriteOptions) -> (ACLRole, WriteMeta) raise Refused

Create a role.

pub async fn ACL::role_delete(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Delete a role by id or name.

pub async fn ACL::role_list(Self, options? : QueryOptions) -> (Array[ACLRole], QueryMeta) raise Refused

List roles.

pub async fn ACL::role_read(Self, String, options? : QueryOptions) -> (ACLRole, QueryMeta) raise Refused

Read a role by id or name.

pub async fn ACL::role_read_by_name(Self, String, options? : QueryOptions) -> (ACLRole, QueryMeta) raise Refused

Read a role by name.

pub async fn ACL::role_update(Self, ACLRole, options? : WriteOptions) -> (ACLRole, WriteMeta) raise Refused

Update a role.

pub async fn ACL::token_clone(Self, String, options? : WriteOptions) -> (ACLToken, WriteMeta) raise Refused

Clone a token, returning a new one with the same policies and roles.

pub async fn ACL::token_create(Self, ACLToken, options? : WriteOptions) -> (ACLToken, WriteMeta) raise Refused

Create a token.

pub async fn ACL::token_delete(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Delete a token by id or accessor id.

pub async fn ACL::token_list(Self, options? : QueryOptions) -> (Array[ACLToken], QueryMeta) raise Refused

List tokens.

pub async fn ACL::token_login(Self, ACLLoginParams, options? : WriteOptions) -> (ACLToken, WriteMeta) raise Refused

Exchange an auth-method bearer_token for a Consul token.

pub async fn ACL::token_logout(Self, options? : WriteOptions) -> WriteMeta raise Refused

Drop the token the client is authenticated with.

pub async fn ACL::token_read(Self, String, options? : QueryOptions) -> (ACLToken, QueryMeta) raise Refused

Read a token by id or accessor id.

pub async fn ACL::token_read_self(Self, options? : QueryOptions) -> (ACLToken, QueryMeta) raise Refused

Read the token the client is authenticated with.

pub async fn ACL::token_update(Self, ACLToken, options? : WriteOptions) -> (ACLToken, WriteMeta) raise Refused

Update a token.

pub async fn Agent::check_deregister(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Deregister the check check_id from this agent.

pub async fn Agent::check_fail(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Mark the check check_id failing.

pub async fn Agent::check_pass(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Mark the TTL/http/tcp/grpc check check_id passing; the keep-alive that renews a service's lease.

pub async fn Agent::check_register(Self, AgentCheckRegistration, options? : WriteOptions) -> WriteMeta raise Refused

Register reg (a check, optionally bound to a service by id) with this agent.

pub async fn Agent::check_update(Self, AgentCheckUpdate, options? : WriteOptions) -> WriteMeta raise Refused

Set a TTL check's status and output without resetting its TTL clock.

pub async fn Agent::checks(Self, options? : QueryOptions) -> (Map[String, HealthCheck], QueryMeta) raise Refused

The checks registered with this agent, by id.

pub async fn Agent::connect_authorize(Self, AgentAuthorizeParams, options? : WriteOptions) -> (AgentAuthorize, WriteMeta) raise Refused

Ask the agent whether the client certificate described by params may open a connection to params.target, by the intentions in place.

pub async fn Agent::connect_leaf(Self, String, options? : QueryOptions) -> (LeafCert, QueryMeta) raise Refused

Issue a leaf certificate for the service instance service_id. The name is a path segment, so it is percent-encoded; the identity the agent puts in the certificate is spiffe://<trust domain>/ns/<namespace>/dc/<datacenter>/svc/ <service_id>.

pub async fn Agent::connect_roots(Self, options? : QueryOptions) -> (CARoots, QueryMeta) raise Refused

The roots this agent's Connect CA trusts, with the blocking-query metadata that lets a caller wait for a CA rotation.

pub async fn Agent::disable_node_maintenance(Self, options? : WriteOptions) -> WriteMeta raise Refused

Take the node out of maintenance mode.

pub async fn Agent::disable_service_maintenance(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Take the service instance service_id out of maintenance mode.

pub async fn Agent::enable_node_maintenance(Self, reason? : String, options? : WriteOptions) -> WriteMeta raise Refused

Put the whole node into maintenance mode.

pub async fn Agent::enable_service_maintenance(Self, String, reason? : String, options? : WriteOptions) -> WriteMeta raise Refused

Put the service instance service_id into maintenance mode, marking its checks maintenance with reason; the instance stays registered but looks down to health checks.

pub async fn Agent::force_leave(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Force a node out of the cluster without its cooperation.

pub async fn Agent::join(Self, String, wan? : Bool, options? : WriteOptions) -> WriteMeta raise Refused

Ask the agent at address to join the cluster; wan joins over the WAN gossip pool rather than the LAN pool.

pub async fn Agent::leave(Self, options? : WriteOptions) -> WriteMeta raise Refused

Ask this agent to leave the cluster gracefully.

pub async fn Agent::members(Self, options? : QueryOptions) -> (Array[AgentMember], QueryMeta) raise Refused

The cluster members this agent gossips with. options.filter (a go-compatible tag expression) narrows the returned set.

pub async fn Agent::members_with_filter(Self, String, options? : QueryOptions) -> (Array[AgentMember], QueryMeta) raise Refused

Like members, but filter is required rather than optional.

pub async fn Agent::self(Self, options? : QueryOptions) -> (AgentSelf, QueryMeta) raise Refused

The agent's own configuration, member record and runtime stats.

pub async fn Agent::service_deregister(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Deregister the service instance id from this agent. An id may hold a space or a slash, so it goes into the path percent-encoded, as every id in this group does.

pub async fn Agent::service_register(Self, AgentServiceRegistration, options? : WriteOptions) -> WriteMeta raise Refused

Register reg with this agent. A service with an inline TTL check starts critical; follow with check_pass to make it healthy. A namespace on reg travels as the query parameter Consul reads it from.

pub async fn Agent::services(Self, options? : QueryOptions) -> (Map[String, AgentService], QueryMeta) raise Refused

The services registered with this agent, by id.

pub async fn Agent::update_acl_token(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Replace the agent's ACL token (used when the local token must change without restarting the agent).

pub fn CAConfig::new(String) -> Self

A CA configuration for provider, with no settings and cross-signing required.

pub async fn Catalog::datacenters(Self, options? : QueryOptions) -> (Array[String], QueryMeta) raise Refused

The datacenters in the WAN federation.

pub async fn Catalog::deregister(Self, CatalogDeregistration, options? : WriteOptions) -> WriteMeta raise Refused

Deregister dereg from the catalog.

pub async fn Catalog::node(Self, String, options? : QueryOptions) -> (CatalogNode, QueryMeta) raise Refused

One node and every service registered on it.

pub async fn Catalog::nodes(Self, options? : QueryOptions) -> (Array[Node], QueryMeta) raise Refused

The nodes in this datacenter, narrowed by options.filter.

pub async fn Catalog::register(Self, CatalogRegistration, options? : WriteOptions) -> WriteMeta raise Refused

Register reg against the catalog.

pub async fn Catalog::service(Self, String, options? : QueryOptions) -> (Array[CatalogService], QueryMeta) raise Refused

The instances of service in this datacenter.

pub async fn Catalog::services(Self, options? : QueryOptions) -> (Map[String, Array[String]], QueryMeta) raise Refused

The service names in this datacenter, each with its tag set.

pub fn Client::acl(Self) -> ACL

The ACL API: tokens, policies, roles, auth methods and binding rules.

pub fn Client::agent(Self) -> Agent

The Agent API: service and check lifecycle on this agent.

pub fn Client::catalog(Self) -> Catalog

The Catalog API: datacenter-wide node and service registration.

pub fn Client::config_entries(Self) -> ConfigEntries

The Config Entries API: centralized configuration objects.

pub fn Client::connect(Self) -> Connect

The Connect API: the certificate authority and the intentions that decide which services may talk to which.

pub fn Client::coordinate(Self) -> Coordinate

The Coordinate API: network coordinates for latency-aware routing.

pub async fn Client::do_delete(Self, String, WriteOptions, Array[(String, String)]) -> (@json.Json, WriteMeta) raise Refused

A DELETE with opt and extra query pairs, returning the parsed body and a fresh write metadata.

pub async fn Client::do_get(Self, String, QueryOptions, Array[(String, String)]) -> (@json.Json, QueryMeta) raise Refused

A GET with opt and extra query pairs, returning the parsed body and the query metadata.

pub async fn Client::do_get_found(Self, String, QueryOptions, Array[(String, String)]) -> (@json.Json?, QueryMeta) raise Refused

A GET that takes a 404 for an answer: None, with the index the agent gave it, which is what a blocking read of something absent waits from.

pub async fn Client::do_post(Self, String, Bytes, WriteOptions, Array[(String, String)]) -> (@json.Json, WriteMeta) raise Refused

A POST with opt and extra query pairs (used by the ACL login/logout endpoints), returning the parsed body and a fresh write metadata.

pub async fn Client::do_put(Self, String, Bytes, WriteOptions, Array[(String, String)]) -> (@json.Json, WriteMeta) raise Refused

A PUT with opt and extra query pairs, returning the parsed body and a fresh write metadata.

pub async fn Client::do_put_q(Self, String, Bytes, WriteOptions, Array[(String, String)]) -> (@json.Json, QueryMeta) raise Refused

A PUT over a query-style call (e.g. txn): returns the parsed body and the blocking-query metadata instead of a WriteMeta.

pub fn Client::event(Self) -> Event

The Event API: user events fanned out across the datacenter.

pub fn Client::health(Self) -> Health

The Health API: checks and the healthy instances of a service.

pub fn Client::kv(Self) -> KV

The KV API: the key/value store, with compare-and-swap, locks and semaphores.

pub fn Client::new(Config, &Transport) -> Self

A client over config and transport.

pub async fn Client::poll(Self, WatchKind, options? : QueryOptions) -> (@json.Json?, QueryMeta) raise Refused

One read of kind, as raw JSON, blocking as options says. None is a 404, which is what a key answers until it exists. @concurrency.watch is the loop around this.

pub fn Client::prepared_query(Self) -> PreparedQuery

The Prepared Query API: named and templated service queries.

pub fn Client::session(Self) -> Session

The Session API: sessions that back locks and semaphores.

pub fn Client::status(Self) -> Status

The Status API: leader and peer membership.

pub fn Client::with_address(String, &Transport) -> Self

A client targeting address over transport, with the rest at defaults.

pub fn config_with_address(String) -> Config

A configuration targeting address, with the remaining fields at their defaults.

pub async fn ConfigEntries::delete(Self, String, String, options? : WriteOptions) -> WriteMeta raise Refused

Delete the config entry of kind and name.

pub async fn ConfigEntries::get(Self, String, String, options? : QueryOptions) -> (ConfigEntry, QueryMeta) raise Refused

Read one config entry by kind and name.

pub async fn ConfigEntries::list(Self, String, options? : QueryOptions) -> (Array[ConfigEntry], QueryMeta) raise Refused

List the config entries of kind.

pub async fn ConfigEntries::set(Self, ConfigEntry, options? : WriteOptions) -> WriteMeta raise Refused

Write entry; the wrapped entry carries its own kind and name.

pub async fn Connect::ca_config(Self, options? : QueryOptions) -> (CAConfig, QueryMeta) raise Refused

The cluster-wide CA configuration.

pub async fn Connect::ca_roots(Self, options? : QueryOptions) -> (CARoots, QueryMeta) raise Refused

The roots this cluster's CA trusts, read cluster-wide rather than from the local agent.

pub async fn Connect::ca_set_config(Self, CAConfig, options? : WriteOptions) -> WriteMeta raise Refused

Replace the cluster-wide CA configuration. Changing the provider rotates the CA; writing the configuration the cluster already has changes nothing.

pub async fn Connect::intention_check(Self, String, String, source_type? : String, options? : QueryOptions) -> (Bool, QueryMeta) raise Refused

Whether a connection from source to destination would be allowed, as the agent decides it from the intentions in place.

pub async fn Connect::intention_delete(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Delete the intention with the agent's id.

pub async fn Connect::intention_delete_exact(Self, String, String, options? : WriteOptions) -> WriteMeta raise Refused

Delete the intention between the two services named.

pub async fn Connect::intention_get(Self, String, options? : QueryOptions) -> (Intention?, QueryMeta) raise Refused

One intention by the agent's id, or None when there is none.

pub async fn Connect::intention_get_exact(Self, String, String, options? : QueryOptions) -> (Intention?, QueryMeta) raise Refused

One intention by the pair of services it names, or None when there is none. source and destination are names, namespace/name when the service lives outside the default namespace.

pub async fn Connect::intention_list(Self, options? : QueryOptions) -> (Array[Intention], QueryMeta) raise Refused

Every intention in the datacenter, highest precedence first.

pub async fn Connect::intention_match(Self, IntentionMatchBy, Array[String], options? : QueryOptions) -> (Map[String, Array[Intention]], QueryMeta) raise Refused

The intentions that come into play for each name given, keyed by that name, highest precedence first. Matching by source answers "what may reach this service", matching by destination "what may this service reach".

pub async fn Connect::intention_upsert(Self, Intention, options? : WriteOptions) -> WriteMeta raise Refused

Create the intention, or replace the one between the same two services. Creating and updating are the same request: the pair of services names the intention.

pub async fn Coordinate::datacenters(Self, options? : QueryOptions) -> (Array[CoordinateNode], QueryMeta) raise Refused

The coordinates of every datacenter, as seen from this node.

pub async fn Coordinate::nodes(Self, options? : QueryOptions) -> (Array[CoordinateEntry], QueryMeta) raise Refused

The coordinates of the nodes in this datacenter.

pub async fn Coordinate::update(Self, CoordinateValue, options? : WriteOptions) -> WriteMeta raise Refused

Publish this node's own coord.

pub fn empty_query_meta() -> QueryMeta

A zeroed QueryMeta, used where a call fails before a response is read.

pub fn empty_write_meta() -> WriteMeta

A zeroed WriteMeta.

pub async fn Event::fire(Self, String, Bytes, options? : EventFireOptions, write_options? : WriteOptions) -> (UserEvent, WriteMeta) raise Refused

Fire name with payload, scoped by options, returning the accepted event.

pub async fn Event::list(Self, options? : EventListOptions, query_options? : QueryOptions) -> (Array[UserEvent], QueryMeta) raise Refused

List events, optionally only those named options.name.

pub async fn Health::checks(Self, String, options? : QueryOptions) -> (Array[HealthCheck], QueryMeta) raise Refused

The checks belonging to service.

pub async fn Health::checks_in_state(Self, String, options? : QueryOptions) -> (Array[HealthCheck], QueryMeta) raise Refused

The checks in state (passing, warning or critical).

pub async fn Health::connect_service(Self, String, passing? : Bool, options? : QueryOptions) -> (Array[ServiceEntry], QueryMeta) raise Refused

Like service, but only instances reachable over the connect mesh.

pub async fn Health::node(Self, String, options? : QueryOptions) -> (Array[HealthCheck], QueryMeta) raise Refused

The checks on node.

pub async fn Health::service(Self, String, passing? : Bool, options? : QueryOptions) -> (Array[ServiceEntry], QueryMeta) raise Refused

The healthy instances of service; passing filters to passing instances only. A blocking query (QueryOptions.wait_index) watches the set change.

pub async fn Health::state(Self, String, options? : QueryOptions) -> (Array[HealthCheck], QueryMeta) raise Refused

The checks in state (any of the three states).

pub fn Intention::destination_ref(Self) -> String

The destination parameter naming this intention's destination.

pub fn Intention::new(String, String, IntentionAction) -> Self

An intention from source to destination with action, both names in the default namespace.

pub fn Intention::source_ref(Self) -> String

The source parameter naming this intention's source.

pub fn IntentionAction::code(Self) -> String

The wire value of an action: allow or deny.

pub fn IntentionAction::of(StringView) -> Self?

An action from its wire value, or None for anything else.

pub fn IntentionMatchBy::code(Self) -> String

The wire value of a match target: source or destination.

pub fn jarray(Map[String, @json.Json], String) -> Array[@json.Json]

The key value as an array, or [] when absent or not an array.

pub fn jbool(Map[String, @json.Json], String) -> Bool

The key value as a bool, false when absent or not a bool.

pub fn jbool_opt(Map[String, @json.Json], String) -> Bool?

The key value as a bool, or None.

pub fn jbytes_b64_opt(Map[String, @json.Json], String) -> Bytes?

The key value as bytes, base64-decoded (Consul's encoding for binary fields), or None.

pub fn jdouble_opt(Map[String, @json.Json], String) -> Double?

The key value as a Double, or None.

pub fn ji32(Map[String, @json.Json], String) -> Int32

The key value as an Int32, or 0 when absent or not a number.

pub fn ji32_opt(Map[String, @json.Json], String) -> Int32?

The key value as an Int32, or None.

pub fn ji64(Map[String, @json.Json], String) -> Int64

The key value as an Int64, or 0L when absent or not a number.

pub fn ji64_opt(Map[String, @json.Json], String) -> Int64?

The key value as an Int64, or None.

pub fn jmap_opt(Map[String, @json.Json], String) -> Map[String, String]?

The key value as a String map, or None.

pub fn jobj() -> Map[String, @json.Json]

An empty JSON object to fill with put_*.

pub fn jobj_opt(Map[String, @json.Json], String) -> Map[String, @json.Json]?

The key value as a nested object, or None.

pub fn json_array(@json.Json) -> Array[@json.Json]

The array behind a Json, or an empty array when it is not an array.

pub fn json_bool(@json.Json) -> Bool

A Json as a bool: true only for True.

pub fn json_map(@json.Json) -> Map[String, @json.Json]

The object map behind a Json, or an empty map when it is not an object.

pub fn json_null() -> @json.Json

The JSON null, built through Unit's ToJson (the Null variant is read-only and cannot be constructed directly).

pub fn jstr(Map[String, @json.Json], String) -> String

The key value as a string, or "" when absent or not a string.

pub fn jstr_array_opt(Map[String, @json.Json], String) -> Array[String]?

The key value as a string array, or None.

pub fn jstr_opt(Map[String, @json.Json], String) -> String?

The key value as a string, or None.

pub fn ju64(Map[String, @json.Json], String) -> UInt64

The key value as a UInt64, or 0. A Double cannot hold a large one, so it comes from the number's text.

pub fn ju64_opt(Map[String, @json.Json], String) -> UInt64?

The key value as a UInt64, or None.

pub async fn KV::acquire(Self, KVPair, options? : WriteOptions) -> (Bool, WriteMeta) raise Refused

Acquire the lock on key for pair.session; succeed only when the key is unlocked or already held by that session.

pub async fn KV::cas(Self, KVPair, options? : WriteOptions) -> (Bool, WriteMeta) raise Refused

Compare-and-swap: succeed only when pair.modify_index matches the stored index. The returned Bool is true on success.

pub async fn KV::delete(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Delete key.

pub async fn KV::delete_cas(Self, KVPair, options? : WriteOptions) -> (Bool, WriteMeta) raise Refused

Delete pair.key only if its index is still pair.modify_index. The returned Bool is true on success.

pub async fn KV::delete_tree(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Delete every entry under prefix.

pub async fn KV::get(Self, String, options? : QueryOptions) -> (KVPair?, QueryMeta) raise Refused

Read key, returning None when it does not exist.

pub async fn KV::keys(Self, String, options? : QueryOptions) -> (Array[String], QueryMeta) raise Refused

List only the keys under prefix (lighter than list).

pub async fn KV::list(Self, String, options? : QueryOptions) -> (Array[KVPair], QueryMeta) raise Refused

List every entry under prefix.

pub async fn KV::put(Self, KVPair, options? : WriteOptions) -> WriteMeta raise Refused

Write pair; modify_index is ignored on a fresh write.

pub async fn KV::release(Self, KVPair, options? : WriteOptions) -> (Bool, WriteMeta) raise Refused

Release the lock on key held by pair.session; succeed only when that session holds it.

pub async fn KV::txn(Self, Array[KVTxnOp], options? : QueryOptions) -> (KVTxnResponse, QueryMeta) raise Refused

Run ops as an atomic batch; results carries the reads, errors the failures.

pub fn map_to_json(Map[String, String]) -> @json.Json

A String map as a JSON object.

pub fn node_of(@json.Json) -> Node

A Node from its JSON object.

pub fn parse_i64(StringView) -> Int64

The leading decimal integer of s, or 0.

pub fn parse_u64(StringView) -> UInt64

Parse a decimal Int64 from a string, returning 0L on anything non-numeric.

pub async fn PreparedQuery::create(Self, PreparedQueryDefinition, options? : WriteOptions) -> (String, WriteMeta) raise Refused

Create a query, returning its assigned id.

pub async fn PreparedQuery::delete(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Delete the query id.

pub async fn PreparedQuery::execute(Self, String, params? : PreparedQueryExecuteParams, options? : QueryOptions) -> (PreparedQueryExecuteResponse, QueryMeta) raise Refused

Execute the query named or identified by id_or_name.

pub async fn PreparedQuery::get(Self, String, options? : QueryOptions) -> (Array[PreparedQueryDefinition], QueryMeta) raise Refused

Read the query id (returns it wrapped in an array, matching the API).

pub async fn PreparedQuery::list(Self, options? : QueryOptions) -> (Array[PreparedQueryDefinition], QueryMeta) raise Refused

List every query in the datacenter.

pub async fn PreparedQuery::update(Self, PreparedQueryDefinition, options? : WriteOptions) -> WriteMeta raise Refused

Update an existing query.

pub fn put_bool(Map[String, @json.Json], String, Bool?) -> Unit

Set a bool field when Some.

pub fn put_i32(Map[String, @json.Json], String, Int32?) -> Unit

Set an Int32 field when Some.

pub fn put_i64(Map[String, @json.Json], String, Int64?) -> Unit

Set an Int64 field when Some.

pub fn put_json(Map[String, @json.Json], String, @json.Json?) -> Unit

Set a nested JSON value when Some.

pub fn put_str(Map[String, @json.Json], String, String?) -> Unit

Set m[key] when v is Some, leaving it out when None.

pub fn put_str_array(Map[String, @json.Json], String, Array[String]?) -> Unit

Set a string-array field when Some.

pub fn put_u64(Map[String, @json.Json], String, UInt64?) -> Unit

Set a UInt64 field when Some, with its text so that a large one survives.

pub fn Request::new(String, String) -> Self

A request with no headers and an empty body.

pub fn Request::new_full(String, String, Map[String, String], Bytes) -> Self

A request with headers and body.

pub fn Response::header(Self, String) -> String?

A response header by name, case-insensitively (HTTP header names are not case-sensitive; Consul spells them X-Consul-Index and friends).

pub fn Response::new(Int32, Bytes) -> Self

A response carrying status and body, with no headers.

pub fn Response::new_full(Int32, Map[String, String], Bytes) -> Self

A response carrying status, headers and body.

pub async fn Session::create(Self, entry? : SessionEntry, options? : WriteOptions) -> (SessionEntry, WriteMeta) raise Refused

Create a session from entry; the returned entry carries the assigned id.

pub async fn Session::destroy(Self, String, options? : WriteOptions) -> WriteMeta raise Refused

Destroy id, releasing everything it holds.

pub async fn Session::info(Self, String, options? : QueryOptions) -> (SessionEntry?, QueryMeta) raise Refused

Read one session by id.

pub async fn Session::list(Self, options? : QueryOptions) -> (Array[SessionEntry], QueryMeta) raise Refused

Every session in the datacenter.

pub async fn Session::node(Self, String, options? : QueryOptions) -> (Array[SessionEntry], QueryMeta) raise Refused

The sessions active on node.

pub async fn Session::renew(Self, String, options? : WriteOptions) -> (SessionEntry?, WriteMeta) raise Refused

Renew id, returning the refreshed entry (or None if it expired).

pub async fn Status::leader(Self, options? : QueryOptions) -> (String, QueryMeta) raise Refused

The address of the Raft leader, or empty when none is elected.

pub async fn Status::peers(Self, options? : QueryOptions) -> (Array[String], QueryMeta) raise Refused

The Raft peer addresses of the cluster.

pub fn url_encode(String) -> String

Percent-encode a path segment or a query component, keeping only the RFC 3986 unreserved set. The input is encoded as UTF-8 first, so a name outside ASCII arrives at the agent as the bytes the agent expects.

fetch

5 items · moonbitstack/moonconsul/fetch
Types 1
pub struct Fetch {
  http : @moonfetch.Client
}

HTTP to a Consul agent. It sets no timeout of its own: a blocking query is meant to wait for as long as the agent says.

Functions & methods 3
pub fn connect(config? : @moonconsul.Config) -> @moonconsul.Client raise @moonconsul.Refused

A client that talks to the agent config names.

pub fn Fetch::new() -> Self raise @moonconsul.Refused
pub async fn Fetch::send(Self, @moonconsul.Request) -> @moonconsul.Response raise @moonconsul.Refused
Implementations 1
pub impl @moonconsul.Transport for Fetch

concurrency

22 items · moonbitstack/moonconsul/concurrency
Types 4
pub struct Lock {
  client : @moonconsul.Client
  key : String
  options : LockOptions
  // private fields
}

A lock on one key, built on a session. A session that dies takes the lock with it, which is the point: a holder that crashes does not hold the lock forever.

pub(all) struct LockOptions {
  value : Bytes
  session : String?
  entry : @moonconsul.SessionEntry
  wait : Int64
  retry : Int32
  monitor_retries : Int32
  monitor_retry : Int32
}

A lock's settings. The session comes from entry unless session names one to reuse, and a session the lock created is the lock's to renew and destroy. wait bounds one blocking query, in nanoseconds. retry is the pause, in milliseconds, while a lock delay runs out, and monitor_retries and monitor_retry are how a held lock rides out an unreachable agent.

pub struct Semaphore {
  client : @moonconsul.Client
  prefix : String
  limit : Int32
  options : SemaphoreOptions
  // private fields
}

Up to limit holders at once under prefix.

pub(all) struct SemaphoreOptions {
  value : Bytes
  session : String?
  entry : @moonconsul.SessionEntry
  wait : Int64
  monitor_retries : Int32
  monitor_retry : Int32
}

A semaphore's settings, with the meanings they have in LockOptions.

Values 4
pub let default_lock_options : LockOptions

The presets a Consul lock is created with.

pub let default_semaphore_options : SemaphoreOptions

The presets a Consul semaphore is created with.

pub let lock_flag : UInt64

The Flags of a lock's key. A key with any other value is in use for something else.

pub let semaphore_flag : UInt64

The Flags of a semaphore's keys.

Functions & methods 14
pub async fn keep_alive(@moonconsul.Session, String, Int32) -> Unit

Keep session id alive until the task is cancelled, renewing at half of ttl milliseconds and following the TTL the agent answers with.

A failed renewal is tried again each second until ttl has passed since the last good one, and then raised. A session the agent no longer knows raises NotFound.

pub async fn Lock::acquire(Self) -> Unit

Wait until the lock is taken. Cancelling the task gives up, and @async.with_timeout bounds the wait.

The session is renewed only while waiting: after this, the holder keeps it alive with keep_alive. hold does all of that.

pub async fn Lock::destroy(Self) -> Unit raise @moonconsul.Refused

Delete the key of a lock nobody holds. Raises Conflict if it is held or is not a lock.

pub async fn[T] Lock::hold(Self, async () -> T) -> T

Take the lock, run body, give the lock back. The session is renewed throughout, and if the lock is lost body is cancelled and this raises Conflict.

pub fn Lock::new(@moonconsul.Client, String, options? : LockOptions) -> Self

A lock on key.

pub async fn Lock::release(Self) -> Unit raise @moonconsul.Refused

Give the lock back, and destroy the session if this lock created it.

pub async fn Lock::try_acquire(Self) -> Bool

Take the lock if it is free now, without waiting.

pub async fn Semaphore::acquire(Self) -> Unit

Wait for a seat. Cancelling the task gives up, and @async.with_timeout bounds the wait.

The session is renewed only while waiting: after this, the holder keeps it alive with keep_alive. hold does all of that.

pub async fn Semaphore::destroy(Self) -> Unit raise @moonconsul.Refused

Delete the seats key of a semaphore nobody holds. Raises Conflict if it is held or is not a semaphore.

pub async fn[T] Semaphore::hold(Self, async () -> T) -> T

Take a seat, run body, give it up. The session is renewed throughout, and if the seat is lost body is cancelled and this raises Conflict.

pub fn Semaphore::new(@moonconsul.Client, String, Int32, options? : SemaphoreOptions) -> Self raise @moonconsul.Refused

A semaphore admitting limit holders under prefix. Every contender must agree on limit.

pub async fn Semaphore::release(Self) -> Unit raise @moonconsul.Refused

Give up the seat, and destroy the session if this semaphore created it.

pub async fn Semaphore::try_acquire(Self) -> Bool

Take a seat if one is free now, without waiting.

pub async fn watch(@moonconsul.Client, @moonconsul.WatchKind, async (UInt64, @json.Json) -> Unit, options? : @moonconsul.QueryOptions, retry? : Int32, limit? : Int32) -> Unit

Follow kind until the task is cancelled, calling handler with the index and the value each time the value changes. The first value is reported too, and an absent one reads as Null.

options applies to every query; wait_index and wait_hash are this loop's to set. A failed query is tried again after retry milliseconds, then 4, 9, 16... times that, up to limit.

sd

11 items · moonbitstack/moonconsul/sd
Types 1
pub struct Registry {
  client : @moonconsul.Client
  wait : Int64
  reap_after : String
}

A registry over one Consul client. It is both a Registrar and a Discovery, and any number of tasks may share it.

Values 2
pub let reap_after : String

How long a service whose check has failed stays registered; Consul's minimum. It is out of resolve as soon as the check fails, so this is only how long the agent keeps the corpse.

pub let wait : Int64

How long a blocking query waits for a change, in nanoseconds, as QueryOptions takes it. Consul's own default is five minutes; a closed watcher only notices between queries.

Functions & methods 6
pub async fn Registry::deregister(Self, @moonsd.Lease) -> Unit
pub fn Registry::new(@moonconsul.Client, wait? : Int64, reap_after? : String) -> Self
pub async fn Registry::register(Self, String, @moonsd.Endpoint, Int32) -> @moonsd.Lease
pub async fn Registry::renew(Self, @moonsd.Lease) -> Unit
pub async fn Registry::resolve(Self, String) -> Array[@moonsd.Endpoint]
pub async fn Registry::watch(Self, String) -> &@moonsd.Watcher
Implementations 2
pub impl @moonsd.Discovery for Registry
pub impl @moonsd.Registrar for Registry