pub struct QueryOptions {Show 22 fields
pub namespace: String,
pub partition: String,
pub sameness_group: String,
pub datacenter: String,
pub peer: String,
pub allow_stale: bool,
pub require_consistent: bool,
pub use_cache: bool,
pub max_age: Option<String>,
pub stale_if_error: Option<String>,
pub wait_index: u64,
pub wait_hash: String,
pub wait_time: Option<String>,
pub token: String,
pub near: String,
pub node_meta: HashMap<String, String>,
pub relay_factor: u8,
pub local_only: bool,
pub connect: bool,
pub filter: String,
pub merge_central_config: bool,
pub global: bool,
}
Expand description
QueryOptions are used to parameterize a query
Fields§
§namespace: String
Namespace overrides the default
namespace
Note: Namespaces are available only in Consul Enterprise
partition: String
Partition overrides the default
partition
Note: Partitions are available only in Consul Enterprise
sameness_group: String
SamenessGroup is used find the SamenessGroup in the given Partition and will find the failover order for the Service from the SamenessGroup Members, with the given Partition being the first member. Note: SamenessGroups are available only in Consul Enterprise
datacenter: String
Providing a datacenter overwrites the DC provided by the Config
peer: String
Providing a peer name in the query option
allow_stale: bool
AllowStale allows any Consul server (non-leader) to service a read. This allows for lower latency and higher throughput
require_consistent: bool
RequireConsistent forces the read to be fully consistent. This is more expensive but prevents ever performing a stale read.
use_cache: bool
UseCache requests that the agent cache results locally. See https://www.consul.io/api/features/caching.html for more details on the semantics.
max_age: Option<String>
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.
stale_if_error: Option<String>
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.
wait_index: u64
WaitIndex is used to enable a blocking query. Waits until the timeout or the next index is reached
wait_hash: 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.
wait_time: Option<String>
WaitTime is used to bound the duration of a wait. Defaults to that of the Config, but can be overridden.
token: String
Token is used to provide a per-request ACL token which overrides the agent’s default token.
near: 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.
node_meta: 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.
relay_factor: 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).
local_only: bool
LocalOnly is used in keyring list operation to force the keyring query to only hit local servers (no WAN traffic).
connect: bool
Connect filters prepared query execution to only include Connect-capable services. This currently affects prepared query execution.
filter: String
Filter requests filtering data prior to it being returned. The string is a go-bexpr compatible expression.
merge_central_config: bool
MergeCentralConfig returns a service definition merged with the proxy-defaults/global and service-defaults/:service config entries. This can be used to ensure a full service definition is returned in the response especially when the service might not be written into the catalog that way.
global: bool
Global is used to request information from all datacenters. Currently only used for operator usage requests.
Trait Implementations§
Source§impl Clone for QueryOptions
impl Clone for QueryOptions
Source§fn clone(&self) -> QueryOptions
fn clone(&self) -> QueryOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more