Class: Gitlab::Cleanup::OrphanJobArtifactFinalObjects::Paginators::BasePaginator

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/cleanup/orphan_job_artifact_final_objects/paginators/base_paginator.rb

Direct Known Subclasses

Aws, Azure, Google

Constant Summary collapse

BATCH_SIZE =
Rails.env.development? ? 5 : 1000

Instance Method Summary collapse

Constructor Details

#initialize(bucket_prefix: nil) ⇒ BasePaginator

Returns a new instance of BasePaginator.



10
11
12
# File 'lib/gitlab/cleanup/orphan_job_artifact_final_objects/paginators/base_paginator.rb', line 10

def initialize(bucket_prefix: nil)
  @bucket_prefix = bucket_prefix
end

Instance Method Details

#filters(marker) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/gitlab/cleanup/orphan_job_artifact_final_objects/paginators/base_paginator.rb', line 14

def filters(marker)
  {
    page_marker_filter_key => marker,
    max_results_filter_key => BATCH_SIZE,
    prefix: bucket_prefix
  }
end

#get_next_marker(batch) ⇒ Object

Raises:

  • (NotImplementedError)


28
29
30
31
32
# File 'lib/gitlab/cleanup/orphan_job_artifact_final_objects/paginators/base_paginator.rb', line 28

def get_next_marker(batch)
  # Fog providers have different ways to get the next marker, so we want to delegate this
  # knowledge to the specific provider implementation.
  raise NotImplementedError, "Subclasses must define `get_next_marker(batch)` instance method"
end

#last_page?(batch) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


22
23
24
25
26
# File 'lib/gitlab/cleanup/orphan_job_artifact_final_objects/paginators/base_paginator.rb', line 22

def last_page?(batch)
  # Fog providers have different indicators of last page, so we want to delegate this
  # knowledge to the specific provider implementation.
  raise NotImplementedError, "Subclasses must define `last_page?(batch)` instance method"
end