Tornex.Query (Tornex v0.1.0)
View SourceThe query struct containing API request data.
The Tornex.Query
struct is utilized by Tornex.API.torn_get/1
and Tornex.Scheduler.Bucket.enqueue/1
to make API calls. The struct stores the required information to perform the API call.
Summary
Functions
Determines the priority of a Tornex.Query
by the nice
value as a priority "bucket" atom.
Types
@type t() :: %Tornex.Query{ from: Integer, key: String.t(), key_owner: Integer, limit: Integer, nice: Integer, origin: GenServer.from() | nil, params: Keyword, resource: String.t(), resource_id: Integer | String.t(), selections: List, sort: :asc | :desc, timestamp: Integer, to: Integer }
Functions
@spec query_priority(t()) :: :user_request | :high_priority | :generic_request
Determines the priority of a Tornex.Query
by the nice
value as a priority "bucket" atom.
The nice value of a query is based on the Linux niceness value between -20 and 19. A niceness of -20 is the highest priority request and 19 is the lowest priority. For more information on the scheduling of requests against Tornex.Query
, see Tornex.Scheduler.Bucket
.
There are three priority buckets:
- generic requests (nice > 0) => Requests that are intended to be made with as much latency as needed
- high priority requests (-10 < nice <= 0) => Requests where latency matters
- user requests (nice <= -10) => Requests that should be performed immediately, typically initiated by a user action