FindAllLocalBranches: support paginated responses
Pagination has always been ad hoc within Gitaly, and there was no convergence to a standard. This change creates a structure around this, which an implementation for one RPC to try it.
This change introduces a structure for pagination in the shared.proto
, and allows FindAllLocalBranches to respond correctly to the new fields. Which required changes to the lines.Send()
behaviour.
Most of the behaviour is captured in the SenderOpts
in the lines
package, and depends on a PageToken to skip results. Page tokens allow for a generic interface in other RPCs too, and for this RPC its the last branch name.
Merge request reports
Activity
changed milestone to %13.1
added typefeature label
added devopscreate groupgitaly labels
added Category:Gitaly label
- Resolved by Patrick Steinhardt
mentioned in issue gitlab-foss#48097 (moved)
97 114 return w.flush() 98 115 } 99 116 100 // Send reads output from `r`, splits it at `delim`, then handles the buffered lines using `sender`. 101 func Send(r io.Reader, sender Sender, delim []byte) error { 102 if len(delim) == 0 { 103 delim = []byte{'\n'} 117 func (w *writer) delimiter() []byte { return w.options.Delimiter } 118 119 // Send reads output from `r`, splits it at `opts.Delimiter``, then handles the 120 // buffered lines using `sender`. 121 func Send(r io.Reader, sender Sender, opts SenderOpts) error { The diff would be smaller if
limit: 0
was normalized to maxInt32 too. But it felt more correct to have 0 actually mean 0. Additionally it might be useful to allow to test the whole procedure withlimit: 0
. That is, run validation, the command, just don't send any results back.That doesn't apply to this RPC, but given I hope this pagination structure is applicable throughout the codebase, that's a choice I think we should make now.
- Resolved by Patrick Steinhardt
- Resolved by Patrick Steinhardt
- Resolved by Zeger-Jan van de Weg
- Resolved by Patrick Steinhardt
- Resolved by Zeger-Jan van de Weg
- Resolved by Zeger-Jan van de Weg
- Resolved by Patrick Steinhardt
assigned to @zj-gitlab and unassigned @pks-t