open-nomad/api
Luiz Aoqui 01931587ba
api: paginated results with different ordering (#12128)
The paginator logic was built when go-memdb iterators would return items
ordered lexicographically by their ID prefixes, but #12054 added the
option for some tables to return results ordered by their `CreateIndex`
instead, which invalidated the previous paginator assumption.

The iterator used for pagination must still return results in some order
so that the paginator can properly handle requests where the next_token
value is not present in the results anymore (e.g., the eval was GC'ed).

In these situations, the paginator will start the returned page in the
first element right after where the requested token should've been.

This commit moves the logic to generate pagination tokens from the
elements being paginated to the iterator itself so that callers can have
more control over the token format to make sure they are properly
ordered and stable.

It also allows configuring the paginator as being ordered in ascending
or descending order, which is relevant when looking for a token that may
not be present anymore.
2022-03-01 15:36:49 -05:00
..
contexts api: implement fuzzy search API 2021-04-16 16:36:07 -06:00
internal/testutil cleanup: stop referencing depreceted HeaderMap field 2022-01-12 10:32:54 -06:00
acl.go HTTP API support for 'nomad ui -login' 2021-03-10 08:17:56 -05:00
acl_test.go HTTP API support for 'nomad ui -login' 2021-03-10 08:17:56 -05:00
agent.go Make number of scheduler workers reloadable (#11593) 2022-01-06 11:56:13 -05:00
agent_test.go Make number of scheduler workers reloadable (#11593) 2022-01-06 11:56:13 -05:00
allocations.go exec: api: handle closing errors differently 2021-05-25 11:19:42 -04:00
allocations_exec.go cleanup: prevent leaks from time.After 2022-02-02 14:32:26 -06:00
allocations_test.go api: add Allocation client and server terminal status funcs. 2021-03-25 08:52:59 +01:00
api.go CSI: use HTTP headers for passing CSI secrets (#12144) 2022-03-01 08:47:01 -05:00
api_test.go api: return sorted results in certain list endpoints 2022-02-15 13:48:28 -06:00
compose_test.go
constraint.go Tag Job spec with HCLv2 tags 2020-10-21 14:05:46 -04:00
constraint_test.go
consul.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
consul_test.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
csi.go CSI: implement support for topology (#12129) 2022-03-01 10:15:46 -05:00
csi_test.go csi: add -force flag to volume deregister (#8295) 2020-07-01 12:17:51 -04:00
deployments.go
evaluations.go
evaluations_test.go api: paginated results with different ordering (#12128) 2022-03-01 15:36:49 -05:00
event_stream.go API: Event stream use full name instead of Eval/Alloc (#9509) 2020-12-03 11:48:18 -05:00
event_stream_test.go Node Drain Metadata (#10250) 2021-05-07 13:58:40 -04:00
fs.go
fs_test.go
go.mod deps: update api go version and dependencies 2022-01-24 12:23:26 -06:00
go.sum deps: update api go version and dependencies 2022-01-24 12:23:26 -06:00
ioutil.go
ioutil_test.go
jobs.go provide -no-shutdown-delay flag for job/alloc stop (#11596) 2021-12-13 14:54:53 -05:00
jobs_test.go core: allow setting and propagation of eval priority on job de/registration (#11532) 2021-11-23 09:23:31 +01:00
namespace.go namespaces: allow enabling/disabling allowed drivers per namespace 2022-02-24 09:27:32 -05:00
namespace_test.go api: remove ent build tag on namespace test file. 2022-02-24 16:40:04 +01:00
nodes.go CSI: implement support for topology (#12129) 2022-03-01 10:15:46 -05:00
nodes_test.go api: add Node.{Min,Max}DynamicPort 2021-09-30 17:05:10 -07:00
operator.go api: return error when LicenseGet status is not 200 (#11644) 2021-12-14 19:47:09 -05:00
operator_autopilot.go
operator_ent_test.go api: return error when LicenseGet status is not 200 (#11644) 2021-12-14 19:47:09 -05:00
operator_metrics.go Metrics gotemplate support, debug bundle features (#9067) 2020-10-14 15:16:10 -04:00
operator_metrics_test.go agent: return req error if prometheus metrics are disabled. 2021-03-09 15:28:58 +01:00
operator_test.go
quota.go
quota_test.go gofmt all the files 2021-10-01 10:14:28 -04:00
raw.go
recommendations.go added new policy capabilities for recommendations API 2020-10-28 14:32:16 +00:00
regions.go cli: ensure -stale flag is respected by nomad operator debug (#11678) 2021-12-15 10:44:03 -05:00
regions_test.go
resources.go allow configuration of Docker hostnames in bridge mode (#11173) 2021-09-16 08:13:09 +02:00
resources_test.go api: add Resource.Canonicalize test and fix tests to handle ReservedCores field 2021-03-19 22:08:27 -04:00
scaling.go chore: bump golangci-lint from v1.24 to v1.39 2021-04-03 09:50:23 +02:00
scaling_test.go add scaling policy type 2020-09-29 17:57:46 -04:00
search.go api: implement fuzzy search API 2021-04-16 16:36:07 -06:00
search_test.go api: include ent fuzzy struct types in oss 2021-04-20 11:19:38 -06:00
sentinel.go
sentinel_test.go gofmt all the files 2021-10-01 10:14:28 -04:00
services.go Enable parsing of terminating gateways 2021-06-30 05:34:16 +00:00
services_test.go consul/connect: fix tests for mesh gateway mode 2021-06-04 09:31:38 -05:00
status.go
status_test.go
system.go
system_test.go
tasks.go Expose Consul template configuration parameters (#11606) 2022-01-10 10:19:07 -05:00
tasks_test.go Expose Consul template configuration parameters (#11606) 2022-01-10 10:19:07 -05:00
util_test.go appease the linter and fix an incorrect test 2021-01-08 19:38:25 +00:00
utils.go
utils_test.go