class OperationTimeline
Chronological log of maintenance executions — the “what happened recently” view. The per-table history stays in iceberg_tables#show.
Public Class Methods
# File app/services/operation_timeline.rb, line 10 def initialize(catalog_id: nil, table_id: nil, status: nil, operation: nil, stopped_at_step: nil) @catalog_id = catalog_id @table_id = table_id @status = status @operation = operation @stopped_at_step = stopped_at_step end
Creates the timeline query with the active filters.
@param catalog_id [Integer, nil] restrict to one catalog @param status [String, nil] restrict by status @param operation [String, nil] executions containing this step @param stopped_at_step [String, nil] executions failed at this step
Public Instance Methods
Source
# File app/services/operation_timeline.rb, line 36 def collection Collection.new(self) end
A paginable collection exposing the Pagy helper’s expected interface (count, offset, limit). Using the official pagy helper keeps the pager on the framework’s own (Brakeman-recognised) path instead of a hand-built Pagy::Offset carrying request parameters.
@return [OperationTimeline::Collection] the paginable wrapper
Source
# File app/services/operation_timeline.rb, line 21 def count sql = <<~SQL SELECT COUNT(*) AS n FROM ( #{timeline_sql} ) AS timeline SQL execute(sql).first["n"].to_i end
The total number of rows, for pagination.
@return [Integer] the row count
Source
# File app/services/operation_timeline.rb, line 45 def rows(limit:, offset:) sql = <<~SQL SELECT kind, record_id, iceberg_table_id, occurred_at, status, created_at FROM ( #{timeline_sql} ) AS timeline ORDER BY occurred_at DESC LIMIT #{limit.to_i} OFFSET #{offset.to_i} SQL execute(sql).map { |row| row.symbolize_keys } end
The rows for one page, newest first, each a hash of the shared shape.
@param limit [Integer] the page size @param offset [Integer] the page offset @return [Array<Hash>] { “kind”, “record_id”, “iceberg_table_id”, “occurred_at”, “status” }