Skip to content
Snippets Groups Projects

FindAllLocalBranches: support paginated responses

Merged Zeger-Jan van de Weg requested to merge zj-pagination-lines-sender into master

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.

Edited by GitLab Release Tools Bot

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added 1 commit

    • dc06206b - Allow pagination for FindAllLocalBranches

    Compare with previous version

  • added 1 commit

    • 7d551b20 - Allow pagination for FindAllLocalBranches

    Compare with previous version

  • 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 with limit: 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.

    • Please register or sign in to reply
  • Patrick Steinhardt
  • Patrick Steinhardt
  • Patrick Steinhardt
  • Patrick Steinhardt assigned to @zj-gitlab and unassigned @pks-t

    assigned to @zj-gitlab and unassigned @pks-t

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading