Class: Sequent::Configuration
- Inherits:
-
Object
- Object
- Sequent::Configuration
- Defined in:
- lib/sequent/configuration.rb
Constant Summary collapse
- DEFAULT_VERSIONS_TABLE_NAME =
'sequent_versions'
- DEFAULT_MIGRATION_SQL_FILES_DIRECTORY =
'db/tables'
- DEFAULT_DATABASE_CONFIG_DIRECTORY =
'db'
- DEFAULT_DATABASE_SCHEMA_DIRECTORY =
'db'
- DEFAULT_VIEW_SCHEMA_NAME =
'view_schema'
- DEFAULT_EVENT_STORE_SCHEMA_NAME =
'sequent_schema'
- MIGRATIONS_CLASS_NAME =
'Sequent::Migrations::Projectors'
- DEFAULT_NUMBER_OF_REPLAY_PROCESSES =
4
- DEFAULT_REPLAY_GROUP_TARGET_SIZE =
250_000
- DEFAULT_OFFLINE_REPLAY_PERSISTOR_CLASS =
Sequent::Core::Persistors::ActiveRecordPersistor
- DEFAULT_ONLINE_REPLAY_PERSISTOR_CLASS =
Sequent::Core::Persistors::ActiveRecordPersistor
- DEFAULT_EVENT_RECORD_HOOKS_CLASS =
Sequent::Core::EventRecordHooks
- DEFAULT_STRICT_CHECK_ATTRIBUTES_ON_APPLY_EVENTS =
false
- DEFAULT_ERROR_LOCALE_RESOLVER =
-> { I18n.locale || :en }
- DEFAULT_TIME_PRECISION =
ActiveSupport::JSON::Encoding.time_precision
Instance Attribute Summary collapse
-
#aggregate_repository ⇒ Object
Returns the value of attribute aggregate_repository.
-
#command_filters ⇒ Object
Returns the value of attribute command_filters.
-
#command_handlers ⇒ Object
Returns the value of attribute command_handlers.
-
#command_middleware ⇒ Object
Returns the value of attribute command_middleware.
-
#command_service ⇒ Object
Returns the value of attribute command_service.
-
#database_config_directory ⇒ Object
Returns the value of attribute database_config_directory.
-
#database_schema_directory ⇒ Object
Returns the value of attribute database_schema_directory.
-
#disable_event_handlers ⇒ Object
Returns the value of attribute disable_event_handlers.
-
#enable_autoregistration ⇒ Object
Returns the value of attribute enable_autoregistration.
-
#enable_multiple_database_support ⇒ Object
Returns the value of attribute enable_multiple_database_support.
-
#error_locale_resolver ⇒ Object
Returns the value of attribute error_locale_resolver.
-
#event_handlers ⇒ Object
Returns the value of attribute event_handlers.
-
#event_publisher ⇒ Object
Returns the value of attribute event_publisher.
-
#event_record_class ⇒ Object
Returns the value of attribute event_record_class.
-
#event_record_hooks_class ⇒ Object
Returns the value of attribute event_record_hooks_class.
-
#event_store ⇒ Object
Returns the value of attribute event_store.
-
#event_store_schema_name ⇒ Object
Returns the value of attribute event_store_schema_name.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#migration_sql_files_directory ⇒ Object
Returns the value of attribute migration_sql_files_directory.
-
#migrations_class_name ⇒ Object
Returns the value of attribute migrations_class_name.
-
#number_of_replay_processes ⇒ Object
Returns the value of attribute number_of_replay_processes.
-
#offline_replay_persistor_class ⇒ Object
Returns the value of attribute offline_replay_persistor_class.
-
#online_replay_persistor_class ⇒ Object
Returns the value of attribute online_replay_persistor_class.
-
#primary_database_key ⇒ Object
Returns the value of attribute primary_database_key.
-
#primary_database_role ⇒ Object
Returns the value of attribute primary_database_role.
-
#replay_group_target_size ⇒ Object
Returns the value of attribute replay_group_target_size.
-
#snapshot_record_class ⇒ Object
Returns the value of attribute snapshot_record_class.
-
#stream_record_class ⇒ Object
Returns the value of attribute stream_record_class.
-
#strict_check_attributes_on_apply_events ⇒ Object
Returns the value of attribute strict_check_attributes_on_apply_events.
-
#time_precision ⇒ Object
Returns the value of attribute time_precision.
-
#transaction_provider ⇒ Object
Returns the value of attribute transaction_provider.
-
#uuid_generator ⇒ Object
Returns the value of attribute uuid_generator.
-
#versions_table_name ⇒ Object
Returns the value of attribute versions_table_name.
-
#view_schema_name ⇒ Object
Returns the value of attribute view_schema_name.
Class Method Summary collapse
- .instance ⇒ Object
-
.reset ⇒ Object
Create a new instance of Configuration.
-
.restore(configuration) ⇒ Object
Restore the given Configuration.
Instance Method Summary collapse
- #can_use_multiple_databases? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/sequent/configuration.rb', line 88 def initialize self.command_handlers = [] self.command_filters = [] self.event_handlers = [] self.command_middleware = Sequent::Core::Middleware::Chain.new self.aggregate_repository = Sequent::Core::AggregateRepository.new self.event_store = Sequent::Core::EventStore.new self.command_service = Sequent::Core::CommandService.new self.event_record_class = Sequent::Core::EventRecord self.snapshot_record_class = Sequent::Core::SnapshotRecord self.stream_record_class = Sequent::Core::StreamRecord self.transaction_provider = Sequent::Core::Transactions::ActiveRecordTransactionProvider.new self.uuid_generator = Sequent::Core::RandomUuidGenerator self.event_publisher = Sequent::Core::EventPublisher.new self.disable_event_handlers = false self.versions_table_name = DEFAULT_VERSIONS_TABLE_NAME self.migration_sql_files_directory = DEFAULT_MIGRATION_SQL_FILES_DIRECTORY self.view_schema_name = DEFAULT_VIEW_SCHEMA_NAME self.event_store_schema_name = DEFAULT_EVENT_STORE_SCHEMA_NAME self.migrations_class_name = MIGRATIONS_CLASS_NAME self.number_of_replay_processes = DEFAULT_NUMBER_OF_REPLAY_PROCESSES self.replay_group_target_size = DEFAULT_REPLAY_GROUP_TARGET_SIZE self.event_record_hooks_class = DEFAULT_EVENT_RECORD_HOOKS_CLASS self.offline_replay_persistor_class = DEFAULT_OFFLINE_REPLAY_PERSISTOR_CLASS self.online_replay_persistor_class = DEFAULT_ONLINE_REPLAY_PERSISTOR_CLASS self.database_config_directory = DEFAULT_DATABASE_CONFIG_DIRECTORY self.database_schema_directory = DEFAULT_DATABASE_SCHEMA_DIRECTORY self.strict_check_attributes_on_apply_events = DEFAULT_STRICT_CHECK_ATTRIBUTES_ON_APPLY_EVENTS self.logger = Logger.new(STDOUT).tap { |l| l.level = Logger::INFO } self.error_locale_resolver = DEFAULT_ERROR_LOCALE_RESOLVER self.enable_multiple_database_support = false self.primary_database_role = :writing self.primary_database_key = :primary self.time_precision = DEFAULT_TIME_PRECISION self.enable_autoregistration = false end |
Instance Attribute Details
#aggregate_repository ⇒ Object
Returns the value of attribute aggregate_repository.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def aggregate_repository @aggregate_repository end |
#command_filters ⇒ Object
Returns the value of attribute command_filters.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def command_filters @command_filters end |
#command_handlers ⇒ Object
Returns the value of attribute command_handlers.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def command_handlers @command_handlers end |
#command_middleware ⇒ Object
Returns the value of attribute command_middleware.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def command_middleware @command_middleware end |
#command_service ⇒ Object
Returns the value of attribute command_service.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def command_service @command_service end |
#database_config_directory ⇒ Object
Returns the value of attribute database_config_directory.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def database_config_directory @database_config_directory end |
#database_schema_directory ⇒ Object
Returns the value of attribute database_schema_directory.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def database_schema_directory @database_schema_directory end |
#disable_event_handlers ⇒ Object
Returns the value of attribute disable_event_handlers.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def disable_event_handlers @disable_event_handlers end |
#enable_autoregistration ⇒ Object
Returns the value of attribute enable_autoregistration.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def enable_autoregistration @enable_autoregistration end |
#enable_multiple_database_support ⇒ Object
Returns the value of attribute enable_multiple_database_support.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def enable_multiple_database_support @enable_multiple_database_support end |
#error_locale_resolver ⇒ Object
Returns the value of attribute error_locale_resolver.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def error_locale_resolver @error_locale_resolver end |
#event_handlers ⇒ Object
Returns the value of attribute event_handlers.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def event_handlers @event_handlers end |
#event_publisher ⇒ Object
Returns the value of attribute event_publisher.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def event_publisher @event_publisher end |
#event_record_class ⇒ Object
Returns the value of attribute event_record_class.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def event_record_class @event_record_class end |
#event_record_hooks_class ⇒ Object
Returns the value of attribute event_record_hooks_class.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def event_record_hooks_class @event_record_hooks_class end |
#event_store ⇒ Object
Returns the value of attribute event_store.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def event_store @event_store end |
#event_store_schema_name ⇒ Object
Returns the value of attribute event_store_schema_name.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def event_store_schema_name @event_store_schema_name end |
#logger ⇒ Object
Returns the value of attribute logger.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def logger @logger end |
#migration_sql_files_directory ⇒ Object
Returns the value of attribute migration_sql_files_directory.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def migration_sql_files_directory @migration_sql_files_directory end |
#migrations_class_name ⇒ Object
Returns the value of attribute migrations_class_name.
70 71 72 |
# File 'lib/sequent/configuration.rb', line 70 def migrations_class_name @migrations_class_name end |
#number_of_replay_processes ⇒ Object
Returns the value of attribute number_of_replay_processes.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def number_of_replay_processes @number_of_replay_processes end |
#offline_replay_persistor_class ⇒ Object
Returns the value of attribute offline_replay_persistor_class.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def offline_replay_persistor_class @offline_replay_persistor_class end |
#online_replay_persistor_class ⇒ Object
Returns the value of attribute online_replay_persistor_class.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def online_replay_persistor_class @online_replay_persistor_class end |
#primary_database_key ⇒ Object
Returns the value of attribute primary_database_key.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def primary_database_key @primary_database_key end |
#primary_database_role ⇒ Object
Returns the value of attribute primary_database_role.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def primary_database_role @primary_database_role end |
#replay_group_target_size ⇒ Object
Returns the value of attribute replay_group_target_size.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def replay_group_target_size @replay_group_target_size end |
#snapshot_record_class ⇒ Object
Returns the value of attribute snapshot_record_class.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def snapshot_record_class @snapshot_record_class end |
#stream_record_class ⇒ Object
Returns the value of attribute stream_record_class.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def stream_record_class @stream_record_class end |
#strict_check_attributes_on_apply_events ⇒ Object
Returns the value of attribute strict_check_attributes_on_apply_events.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def strict_check_attributes_on_apply_events @strict_check_attributes_on_apply_events end |
#time_precision ⇒ Object
Returns the value of attribute time_precision.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def time_precision @time_precision end |
#transaction_provider ⇒ Object
Returns the value of attribute transaction_provider.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def transaction_provider @transaction_provider end |
#uuid_generator ⇒ Object
Returns the value of attribute uuid_generator.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def uuid_generator @uuid_generator end |
#versions_table_name ⇒ Object
Returns the value of attribute versions_table_name.
70 71 72 |
# File 'lib/sequent/configuration.rb', line 70 def versions_table_name @versions_table_name end |
#view_schema_name ⇒ Object
Returns the value of attribute view_schema_name.
37 38 39 |
# File 'lib/sequent/configuration.rb', line 37 def view_schema_name @view_schema_name end |
Class Method Details
.instance ⇒ Object
73 74 75 |
# File 'lib/sequent/configuration.rb', line 73 def self.instance @instance ||= new end |
.reset ⇒ Object
Create a new instance of Configuration
78 79 80 |
# File 'lib/sequent/configuration.rb', line 78 def self.reset @instance = new end |
.restore(configuration) ⇒ Object
Restore the given Configuration
84 85 86 |
# File 'lib/sequent/configuration.rb', line 84 def self.restore(configuration) @instance = configuration end |
Instance Method Details
#can_use_multiple_databases? ⇒ Boolean
132 133 134 |
# File 'lib/sequent/configuration.rb', line 132 def can_use_multiple_databases? enable_multiple_database_support end |