Skip to main content

QueryOptions

Struct QueryOptions 

Source
pub struct QueryOptions {
Show 17 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§

Source§

impl Clone for QueryOptions

Source§

fn clone(&self) -> QueryOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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> 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> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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> 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>,