Struct QueryOptions

Source
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

Source§

fn clone(&self) -> QueryOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for QueryOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for QueryOptions

Source§

fn default() -> QueryOptions

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

impl<'de> Deserialize<'de> for QueryOptions

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for QueryOptions

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,