Skip to main content

Class QueryOptions

Namespace: Consul
Assembly: Consul.dll

QueryOptions are used to parameterize a query

public class QueryOptions

Inheritance

objectQueryOptions

Inherited Members

object.Equals(object) , object.Equals(object, object) , object.GetHashCode() , object.GetType() , object.MemberwiseClone() , object.ReferenceEquals(object, object) , object.ToString()

Fields

Default

public static readonly QueryOptions Default

Field Value

QueryOptions

Properties

Consistency

The consistency level required for the operation.

public ConsistencyMode Consistency { get; set; }

Property Value

ConsistencyMode

Datacenter

Providing a datacenter overwrites the DC provided by the Config.

public string Datacenter { get; set; }

Property Value

string

MaxAge

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.

public TimeSpan? MaxAge { get; set; }

Property Value

TimeSpan ?

Namespace

Namespace is the name of the namespace to send along for the request when no other Namespace is present in the QueryOptions. Namespace is an Enterprise-only feature.

public string Namespace { get; set; }

Property Value

string

Near

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.

public string Near { get; set; }

Property Value

string

StaleIfError

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.

public TimeSpan? StaleIfError { get; set; }

Property Value

TimeSpan ?

Token

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

public string Token { get; set; }

Property Value

string

UseCache

WaitIndex is used to enable a blocking query. Waits until the timeout or the next index is reached. UseCache requests that the agent cache results locally. See https://www.consul.io/api/features/caching.html for more details on the semantics.

public bool UseCache { get; set; }

Property Value

bool

WaitIndex

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

public ulong WaitIndex { get; set; }

Property Value

ulong

WaitTime

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

public TimeSpan? WaitTime { get; set; }

Property Value

TimeSpan ?

  • Fields
    • Default
  • Properties
    • Consistency
    • Datacenter
    • MaxAge
    • Namespace
    • Near
    • StaleIfError
    • Token
    • UseCache
    • WaitIndex
    • WaitTime