Class: Projects::BranchesByModeService
- Inherits:
-
Object
- Object
- Projects::BranchesByModeService
- Includes:
- Gitlab::Routing
- Defined in:
- app/services/projects/branches_by_mode_service.rb
Overview
Projects::BranchesByModeService uses Gitaly page-token pagination in order to optimally fetch branches. The drawback of the page-token pagination is that it doesn’t provide an option of going to the previous page of the collection. That’s why we need to fall back to offset pagination when previous page is requested.
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, params = {}) ⇒ BranchesByModeService
constructor
A new instance of BranchesByModeService.
Methods included from Gitlab::Routing
includes_helpers, redirect_legacy_paths, url_helpers
Constructor Details
#initialize(project, params = {}) ⇒ BranchesByModeService
Returns a new instance of BranchesByModeService.
14 15 16 17 |
# File 'app/services/projects/branches_by_mode_service.rb', line 14 def initialize(project, params = {}) @project = project @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
12 13 14 |
# File 'app/services/projects/branches_by_mode_service.rb', line 12 def params @params end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
12 13 14 |
# File 'app/services/projects/branches_by_mode_service.rb', line 12 def project @project end |
Instance Method Details
#execute ⇒ Object
19 20 21 22 23 |
# File 'app/services/projects/branches_by_mode_service.rb', line 19 def execute return fetch_branches_via_gitaly_pagination if use_gitaly_pagination? fetch_branches_via_offset_pagination end |