Struct consul_rs::api::QueryOptions[][src]

pub struct QueryOptions {
Show fields pub Namespace: Option<String>, pub Datacenter: Option<String>, pub AllowStale: Option<bool>, pub RequireConsistent: Option<bool>, pub UseCache: Option<bool>, pub MaxAge: Option<Duration>, pub StaleIfError: Option<Duration>, pub WaitIndex: Option<usize>, pub WaitHash: Option<String>, pub WaitTime: Option<Duration>, pub Token: Option<String>, pub Near: Option<String>, pub NodeMeta: Option<HashMap<String, String>>, pub RelayFactor: Option<u8>, pub LocalOnly: Option<bool>, pub Connect: Option<bool>, pub Filter: Option<String>,
}
Expand description

QueryOptions are used to parameterize a query

Fields

Namespace: Option<String>

Namespace overrides the default namespace Note: Namespaces are available only in Consul Enterprise

Datacenter: Option<String>

Providing a datacenter overwrites the DC provided by the Config

AllowStale: Option<bool>

AllowStale allows any Consul server (non-leader) to service a read. This allows for lower latency and higher throughput

RequireConsistent: Option<bool>

RequireConsistent forces the read to be fully consistent. This is more expensive but prevents ever performing a stale read.

UseCache: Option<bool>

UseCache requests that the agent cache results locally. See https:///www.consul.io/api/features/caching.html for more details on the semantics.

MaxAge: Option<Duration>

MaxAge limits how old a cached value will be returned if UseCache is true. If there is a cached response that is older than the MaxAge, it is treated as a cache miss and a new fetch invoked. If the fetch fails, the error is returned. Clients that wish to allow for stale results on error can set StaleIfError to a longer duration to change this behavior. It is ignored if the endpoint supports background refresh caching. See https:///www.consul.io/api/features/caching.html for more details.

StaleIfError: Option<Duration>

StaleIfError specifies how stale the client will accept a cached response if the servers are unavailable to fetch a fresh one. Only makes sense when UseCache is true and MaxAge is set to a lower, non-zero value. It is ignored if the endpoint supports background refresh caching. See https:///www.consul.io/api/features/caching.html for more details.

WaitIndex: Option<usize>

WaitIndex is used to enable a blocking query. Waits until the timeout or the next index is reached

WaitHash: Option<String>

WaitHash is used by some endpoints instead of WaitIndex to perform blocking on state based on a hash of the response rather than a monotonic index. This is required when the state being blocked on is not stored in Raft, for example agent-local proxy configuration.

WaitTime: Option<Duration>

WaitTime is used to bound the duration of a wait. Defaults to that of the Config, but can be overridden.

Token: Option<String>

Token is used to provide a per-request ACL token which overrides the agent’s default token.

Near: Option<String>

Near is used to provide a node name that will sort the results in ascending order based on the estimated round trip time from that node. Setting this to “_agent” will use the agent’s node for the sort.

NodeMeta: Option<HashMap<String, String>>

NodeMeta is used to filter results by nodes with the given metadata key/value pairs. Currently, only one key/value pair can be provided for filtering.

RelayFactor: Option<u8>

RelayFactor is used in keyring operations to cause responses to be relayed back to the sender through N other random nodes. Must be a value from 0 to 5 (inclusive).

LocalOnly: Option<bool>

LocalOnly is used in keyring list operation to force the keyring query to only hit local servers (no WAN traffic).

Connect: Option<bool>

Connect filters prepared query execution to only include Connect-capable services. This currently affects prepared query execution.

Filter: Option<String>

Filter requests filtering data prior to it being returned. The string is a go-bexpr compatible expression.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more