10,000 Items Scenario
Assume 10,000 items of a particular resource (i.e. environments) are stored in an Octopus Deploy instance. How should the CLI behave and operate in this scenario for various commands (i.e. list)?
Interactive Mode
sequenceDiagram
Note left of CLI: create results buffer
CLI->>+Octopus: get first page of results
Octopus->>+CLI: page 1
Note left of CLI: append to buffer
loop for each page
CLI->>+Octopus: get page n
Octopus->>+CLI: page n
Note left of CLI: append to buffer
end
actor User
CLI->>+User: display selector with entire result buffer
Loading 10,000 items will impact the user experience (UX) in interactive mode; populating a control (i.e. Select or MultiSelect) will be done in a manner that aligns to the Octopus REST API, which supports paging. The CLI will support loading data in a paged manner; it will preload the data to be bound to the selector BEFORE it is displayed to a user. The selector will have the entire dataset that is mandated by the scenario (i.e. "if the customer expects to see 10,000 items then they should get 10,000 items").
The CLI will support a --limit [size] flag to control the size of the item page. Example:
$ octopus environment list --limit 1000
Automation Mode
sequenceDiagram
CLI->>+Octopus: get first page of results
Octopus->>+CLI: page 1
Note left of CLI: print page 1
loop for each page
CLI->>+Octopus: get page n
Octopus->>+CLI: page n
Note left of CLI: print page n
end
In automation mode, the result sets should be unlimited.
Iteration 1: Buffer everything and output to stdout
Iteration 2: Stream to stdout as pages are returned from the Octopus REST API