Sha256: 1fb8b0bcdfa92da3b1da102c1ba52cf9d475055f37c2a744a0183421786adf9c

Contents?: true

Size: 1.4 KB

Versions: 10

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

module Karafka
  module Web
    module Tracking
      module Consumers
        module Contracts
          # Contract for the job reporting details
          class Job < Web::Contracts::Base
            configure

            required(:consumer) { |val| val.is_a?(String) }
            required(:consumer_group) { |val| val.is_a?(String) }
            required(:updated_at) { |val| val.is_a?(Float) && val >= 0 }
            required(:topic) { |val| val.is_a?(String) }
            required(:partition) { |val| val.is_a?(Integer) && val >= 0 }
            required(:first_offset) { |val| val.is_a?(Integer) && (val >= 0 || val == -1001) }
            required(:last_offset) { |val| val.is_a?(Integer) && (val >= 0 || val == -1001) }
            required(:committed_offset) { |val| val.is_a?(Integer) }
            required(:messages) { |val| val.is_a?(Integer) && val >= 0 }
            required(:type) { |val| %w[consume revoked shutdown tick].include?(val) }
            required(:tags) { |val| val.is_a?(Karafka::Core::Taggable::Tags) }
            # -1 can be here for workless flows
            required(:consumption_lag) { |val| val.is_a?(Integer) && (val >= 0 || val == -1) }
            required(:processing_lag) { |val| val.is_a?(Integer) && (val >= 0 || val == -1) }
            required(:status) { |val| %w[running pending].include?(val) }
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
karafka-web-0.10.0.beta1 lib/karafka/web/tracking/consumers/contracts/job.rb
karafka-web-0.9.1 lib/karafka/web/tracking/consumers/contracts/job.rb
karafka-web-0.9.0 lib/karafka/web/tracking/consumers/contracts/job.rb
karafka-web-0.9.0.rc3 lib/karafka/web/tracking/consumers/contracts/job.rb
karafka-web-0.9.0.rc2 lib/karafka/web/tracking/consumers/contracts/job.rb
karafka-web-0.9.0.rc1 lib/karafka/web/tracking/consumers/contracts/job.rb
karafka-web-0.8.2 lib/karafka/web/tracking/consumers/contracts/job.rb
karafka-web-0.8.1 lib/karafka/web/tracking/consumers/contracts/job.rb
karafka-web-0.8.0 lib/karafka/web/tracking/consumers/contracts/job.rb
karafka-web-0.8.0.rc1 lib/karafka/web/tracking/consumers/contracts/job.rb