Sha256: 047ef1cb6831ecefee8eefab11b6e30e6f90b2bf47527a79211f9772e2b8a2ce

Contents?: true

Size: 1.08 KB

Versions: 20

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module Karafka
  module Web
    module Ui
      module Models
        # Model used for accessing watermark offsets
        class WatermarkOffsets < Lib::HashProxy
          class << self
            # Retrieve watermark offsets for given topic partition
            #
            # @param topic_id [String]
            # @param partition_id [Integer]
            # @return [WatermarkOffsets]
            def find(topic_id, partition_id)
              offsets = Lib::Admin.read_watermark_offsets(topic_id, partition_id)

              new(
                low: offsets.first,
                high: offsets.last
              )
            end
          end

          # @return [Boolean] true if given partition never had any messages and is empty
          def empty?
            low.zero? && high.zero?
          end

          # @return [Boolean] true if given partition had data but all of it was removed due
          #   to log retention and compaction policies
          def cleaned?
            !empty? && low == high
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
karafka-web-0.10.4 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.10.3 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.10.2 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.10.1 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.10.0 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.10.0.rc2 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.10.0.rc1 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.10.0.beta1 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.9.1 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.9.0 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.9.0.rc3 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.9.0.rc2 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.9.0.rc1 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.8.2 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.8.1 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.8.0 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.8.0.rc1 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.7.10 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.7.9 lib/karafka/web/ui/models/watermark_offsets.rb
karafka-web-0.7.8 lib/karafka/web/ui/models/watermark_offsets.rb