Sha256: 1d28b90f0c8383428f751cd5d90dfadffd5960ae18d0d39534b7ab3edab1569e

Contents?: true

Size: 715 Bytes

Versions: 7

Compression:

Stored size: 715 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'])
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pg_eventstore-1.2.0 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.1.5 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.1.4 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.1.3 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.1.2 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.1.1 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb
pg_eventstore-1.1.0 lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb