Module kv

nim_consul.kv: KV operations for Consul

Types

KvResponse = (KvIndex, seq[KvItem])
KV Responses take the form of a tuple where the first element is the global index for the Consul KV at the time of access, and the second is a sequence of KV Items.
KvItem = object
  createIndex*, modifyIndex*, lockIndex*, flags*: int
  key*, value*, session*: string
key will be the key that the item is accessible at, and value is the value currently stored in the KV.

Procs

proc kvPath(key, aclToken: string = nil): string {.
raises: [], tags: []
.}
Given a key to request and any optional request parameters, construct a URI path pointing to the Consul KV API.
proc isSome(item: KvItem): bool {.
raises: [], tags: []
.}
Return whether a requested key was found in the KV.
proc initKvItem(body: string): KvItem {.
raises: [Exception, ValueError, JsonParsingError, KeyError], tags: [ReadIOEffect]
.}
Given an API response body, extract the expected KV API values from it.
proc handleErrors(resp: Response | AsyncResponse): KvErrorResponse
Convert HTTP response errors into KvResponse response values.