Sha256: ae888b943a6f731e34d744e8e0ace984ad998a8efe906b62a66bf68c12b909ab

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

require "sequel"
require "sandthorn_event_filter"
require "simple_migrator"
require "sandthorn"

require "sandthorn_sequel_projection/errors"
require "sandthorn_sequel_projection/version"
require "sandthorn_sequel_projection/utilities"
require "sandthorn_sequel_projection/event_store"
require "sandthorn_sequel_projection/cursor"
require "sandthorn_sequel_projection/event_handler"
require "sandthorn_sequel_projection/event_handler_collection"
require "sandthorn_sequel_projection/projection"
require "sandthorn_sequel_projection/lock"
require "sandthorn_sequel_projection/processed_events_tracker"
require "sandthorn_sequel_projection/manifest"
require "sandthorn_sequel_projection/runner"

module SandthornSequelProjection

  class << self
    require 'delegate'
    extend Forwardable

    def_delegators :configuration, :batch_size, :event_stores

    attr_accessor :configuration

    def configure
      @configuration ||= Configuration.default
      yield(configuration) if block_given?
      start
    end

    def start
      ProcessedEventsTracker.migrate!(configuration.db_connection)
    end

    def find_event_store(name)
      EventStore.new(name)
    end
  end

  class Configuration

    attr_accessor :db_connection, :event_stores, :projections_folder, :batch_size

    def initialize
      yield(self) if block_given?
    end

    def self.default
      self.new do |c|
        c.batch_size = 40
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sandthorn_sequel_projection-0.0.4 lib/sandthorn_sequel_projection.rb
sandthorn_sequel_projection-0.0.3 lib/sandthorn_sequel_projection.rb