Sha256: 4cbc9479910f0d899ff0c3dd7ac3df89ed10afd91d602cfb2cfafb52cc866188

Contents?: true

Size: 766 Bytes

Versions: 11

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true

module PgEventstore
  module SubscriptionRunnerCommands
    # @!visibility private
    class ResetPosition < Base
      class << self
        # @param data [Hash]
        # @return [Hash]
        def parse_data(data)
          { 'position' => Integer(data['position']) }
        end
      end

      # @param subscription_runner [PgEventstore::SubscriptionRunner]
      # @return [void]
      def exec_cmd(subscription_runner)
        subscription_runner.within_state(:stopped) do
          subscription_runner.clear_chunk
          subscription_runner.subscription.update(
            last_chunk_greatest_position: nil, current_position: data['position'], total_processed_events: 0
          )
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pg_eventstore-1.9.0 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.8.0 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.7.0 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.6.0 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.5.0 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.4.0 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.3.4 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.3.3 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.3.2 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.3.1 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.3.0 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb