<commit_before>module EventSourcery
  module Postgres
    class Config
      attr_accessor :event_store_database,
                    :lock_table_to_guarantee_linear_sequence_id_growth,
                    :write_events_function_name,
                    :events_table_name,
                    :aggregates_table_name,
                    :tracker_table_name,
                    :callback_interval_if_no_new_events,
                    :auto_create_projector_tracker,
                    :event_tracker,
                    :projections_database,
                    :event_store,
                    :event_source,
                    :event_sink

      def initialize
        @lock_table_to_guarantee_linear_sequence_id_growth = true
        @write_events_function_name = 'writeEvents'
        @events_table_name = :events
        @aggregates_table_name = :aggregates
        @tracker_table_name = :projector_tracker
        @callback_interval_if_no_new_events = 10
        @event_store_database = nil
        @auto_create_projector_tracker = true
      end

      def event_store
        @event_store ||= EventStore.new(event_store_database)
      end

      def event_source
        @event_source ||= ::EventSourcery::EventStore::EventSource.new(event_store)
      end

      def event_sink
        @event_sink ||= ::EventSourcery::EventStore::EventSink.new(event_store)
      end

      def event_store_database=(db_connection)
        setup_connection(db_connection)

        @event_store_database = db_connection
      end

      def projections_database=(db_connection)
        setup_connection(db_connection)

        @projections_database = db_connection
        @event_tracker = Postgres::Tracker.new(db_connection)
      end

      private

      def setup_connection(db_connection)
        return unless db_connection

        db_connection.extension :pg_json
      end
    end
  end
end
<commit_msg>Resolve warning: method redefined; discarding old event_store<commit_after>module EventSourcery
  module Postgres
    class Config
      attr_accessor :lock_table_to_guarantee_linear_sequence_id_growth,
                    :write_events_function_name,
                    :events_table_name,
                    :aggregates_table_name,
                    :tracker_table_name,
                    :callback_interval_if_no_new_events,
                    :auto_create_projector_tracker,
                    :event_tracker

      attr_writer :event_store,
                  :event_source,
                  :event_sink

      attr_reader :event_store_database,
                  :projections_database

      def initialize
        @lock_table_to_guarantee_linear_sequence_id_growth = true
        @write_events_function_name = 'writeEvents'
        @events_table_name = :events
        @aggregates_table_name = :aggregates
        @tracker_table_name = :projector_tracker
        @callback_interval_if_no_new_events = 10
        @event_store_database = nil
        @auto_create_projector_tracker = true
      end

      def event_store
        @event_store ||= EventStore.new(event_store_database)
      end

      def event_source
        @event_source ||= ::EventSourcery::EventStore::EventSource.new(event_store)
      end

      def event_sink
        @event_sink ||= ::EventSourcery::EventStore::EventSink.new(event_store)
      end

      def event_store_database=(db_connection)
        setup_connection(db_connection)

        @event_store_database = db_connection
      end

      def projections_database=(db_connection)
        setup_connection(db_connection)

        @projections_database = db_connection
        @event_tracker = Postgres::Tracker.new(db_connection)
      end

      private

      def setup_connection(db_connection)
        return unless db_connection

        db_connection.extension :pg_json
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.0553543714433523, 'fraction_numerical': 0.0010346611484738748, 'mean_word_length': 2.2743437764606265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2217010', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1061, 'n_words': 168}