euston-eventstore 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. data/Rakefile +118 -0
  2. data/euston-eventstore.gemspec +66 -0
  3. data/lib/euston-eventstore.rb +7 -0
  4. data/lib/euston-eventstore/commit.rb +77 -0
  5. data/lib/euston-eventstore/constants.rb +5 -0
  6. data/lib/euston-eventstore/dispatcher/asynchronous_dispatcher.rb +37 -0
  7. data/lib/euston-eventstore/dispatcher/null_dispatcher.rb +11 -0
  8. data/lib/euston-eventstore/dispatcher/synchronous_dispatcher.rb +21 -0
  9. data/lib/euston-eventstore/errors.rb +21 -0
  10. data/lib/euston-eventstore/event_message.rb +26 -0
  11. data/lib/euston-eventstore/optimistic_event_store.rb +68 -0
  12. data/lib/euston-eventstore/optimistic_event_stream.rb +106 -0
  13. data/lib/euston-eventstore/persistence/mongodb/mongo_commit.rb +82 -0
  14. data/lib/euston-eventstore/persistence/mongodb/mongo_commit_id.rb +16 -0
  15. data/lib/euston-eventstore/persistence/mongodb/mongo_config.rb +28 -0
  16. data/lib/euston-eventstore/persistence/mongodb/mongo_event_message.rb +31 -0
  17. data/lib/euston-eventstore/persistence/mongodb/mongo_persistence_engine.rb +167 -0
  18. data/lib/euston-eventstore/persistence/mongodb/mongo_persistence_factory.rb +31 -0
  19. data/lib/euston-eventstore/persistence/mongodb/mongo_snapshot.rb +32 -0
  20. data/lib/euston-eventstore/persistence/mongodb/mongo_stream_head.rb +29 -0
  21. data/lib/euston-eventstore/persistence/stream_head.rb +23 -0
  22. data/lib/euston-eventstore/snapshot.rb +21 -0
  23. data/lib/euston-eventstore/version.rb +5 -0
  24. data/spec/event_store/dispatcher/asynchronous_dispatcher_spec.rb +75 -0
  25. data/spec/event_store/dispatcher/synchronous_dispatcher_spec.rb +39 -0
  26. data/spec/event_store/optimistic_event_store_spec.rb +292 -0
  27. data/spec/event_store/optimistic_event_stream_spec.rb +318 -0
  28. data/spec/event_store/persistence/mongodb_spec.rb +301 -0
  29. data/spec/event_store/serialization/simple_message.rb +12 -0
  30. data/spec/spec_helper.rb +39 -0
  31. data/spec/support/array_enumeration_counter.rb +20 -0
  32. metadata +189 -0
@@ -0,0 +1,12 @@
1
+ module Euston
2
+ module EventStore
3
+ class SimpleMessage
4
+ def initialize
5
+ @contents = []
6
+ end
7
+
8
+ attr_accessor :id, :created, :value, :count
9
+ attr_reader :contents
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,39 @@
1
+ require 'ap'
2
+ require 'euston-eventstore'
3
+
4
+ if RUBY_PLATFORM.to_s == 'java'
5
+ require 'jmongo'
6
+ else
7
+ require 'mongo'
8
+ end
9
+
10
+ if RUBY_PLATFORM.to_s == 'java'
11
+ module Uuid
12
+ def self.generate
13
+ Java::JavaUtil::UUID.randomUUID().toString()
14
+ end
15
+ end
16
+ else
17
+ require 'uuid'
18
+ Uuid = UUID.new
19
+ end
20
+
21
+ require 'rspec/core'
22
+ require 'rspec/core/rake_task'
23
+ require 'rspec/expectations'
24
+ require 'rspec/mocks'
25
+
26
+ require 'support/array_enumeration_counter'
27
+
28
+ mongo_config = Euston::EventStore::Persistence::Mongodb::Config.instance
29
+ mongo_config.database = 'event_store_tests'
30
+
31
+ RSpec.configure do |config|
32
+ config.fail_fast = true
33
+
34
+ config.before :each do
35
+ connection = Mongo::Connection.new(mongo_config.host, mongo_config.port, mongo_config.options)
36
+ db = connection.db(mongo_config.database)
37
+ db.collections.select { |c| c.name !~ /system/ }.each { |c| db.drop_collection c.name }
38
+ end
39
+ end
@@ -0,0 +1,20 @@
1
+ require 'delegate'
2
+
3
+ module Euston
4
+ module EventStore
5
+ class ArrayEnumerationCounter < DelegateClass(Array)
6
+ def initialize(obj)
7
+ super(obj)
8
+
9
+ @invocations = 0
10
+ end
11
+
12
+ def each
13
+ @invocations += 1
14
+ super
15
+ end
16
+
17
+ attr_reader :invocations
18
+ end
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,189 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: euston-eventstore
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Lee Henson
9
+ - Guy Boertje
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2011-09-15 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bson_ext
17
+ requirement: &73777250 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '1.1'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *73777250
26
+ - !ruby/object:Gem::Dependency
27
+ name: json
28
+ requirement: &73776920 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *73776920
37
+ - !ruby/object:Gem::Dependency
38
+ name: mongo
39
+ requirement: &73776520 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 1.3.1
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *73776520
48
+ - !ruby/object:Gem::Dependency
49
+ name: uuid
50
+ requirement: &73776210 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: '2.3'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *73776210
59
+ - !ruby/object:Gem::Dependency
60
+ name: activesupport
61
+ requirement: &73775920 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ version: '3.0'
67
+ type: :runtime
68
+ prerelease: false
69
+ version_requirements: *73775920
70
+ - !ruby/object:Gem::Dependency
71
+ name: hash-keys
72
+ requirement: &73775630 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1'
78
+ type: :runtime
79
+ prerelease: false
80
+ version_requirements: *73775630
81
+ - !ruby/object:Gem::Dependency
82
+ name: require_all
83
+ requirement: &73775350 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: '1.2'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: *73775350
92
+ - !ruby/object:Gem::Dependency
93
+ name: awesome_print
94
+ requirement: &73775060 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ version: '0.4'
100
+ type: :development
101
+ prerelease: false
102
+ version_requirements: *73775060
103
+ - !ruby/object:Gem::Dependency
104
+ name: fuubar
105
+ requirement: &73774790 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '0.0'
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: *73774790
114
+ - !ruby/object:Gem::Dependency
115
+ name: rspec
116
+ requirement: &73774480 !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ~>
120
+ - !ruby/object:Gem::Version
121
+ version: '2.6'
122
+ type: :development
123
+ prerelease: false
124
+ version_requirements: *73774480
125
+ description: Ruby port for Jonathan Oliver's EventStore. See https://github.com/joliver/EventStore
126
+ for details.
127
+ email:
128
+ - lee.m.henson@gmail.com
129
+ - guyboertje@gmail.com
130
+ executables: []
131
+ extensions: []
132
+ extra_rdoc_files: []
133
+ files:
134
+ - Rakefile
135
+ - euston-eventstore.gemspec
136
+ - lib/euston-eventstore.rb
137
+ - lib/euston-eventstore/commit.rb
138
+ - lib/euston-eventstore/constants.rb
139
+ - lib/euston-eventstore/dispatcher/asynchronous_dispatcher.rb
140
+ - lib/euston-eventstore/dispatcher/null_dispatcher.rb
141
+ - lib/euston-eventstore/dispatcher/synchronous_dispatcher.rb
142
+ - lib/euston-eventstore/errors.rb
143
+ - lib/euston-eventstore/event_message.rb
144
+ - lib/euston-eventstore/optimistic_event_store.rb
145
+ - lib/euston-eventstore/optimistic_event_stream.rb
146
+ - lib/euston-eventstore/persistence/mongodb/mongo_commit.rb
147
+ - lib/euston-eventstore/persistence/mongodb/mongo_commit_id.rb
148
+ - lib/euston-eventstore/persistence/mongodb/mongo_config.rb
149
+ - lib/euston-eventstore/persistence/mongodb/mongo_event_message.rb
150
+ - lib/euston-eventstore/persistence/mongodb/mongo_persistence_engine.rb
151
+ - lib/euston-eventstore/persistence/mongodb/mongo_persistence_factory.rb
152
+ - lib/euston-eventstore/persistence/mongodb/mongo_snapshot.rb
153
+ - lib/euston-eventstore/persistence/mongodb/mongo_stream_head.rb
154
+ - lib/euston-eventstore/persistence/stream_head.rb
155
+ - lib/euston-eventstore/snapshot.rb
156
+ - lib/euston-eventstore/version.rb
157
+ - spec/event_store/dispatcher/asynchronous_dispatcher_spec.rb
158
+ - spec/event_store/dispatcher/synchronous_dispatcher_spec.rb
159
+ - spec/event_store/optimistic_event_store_spec.rb
160
+ - spec/event_store/optimistic_event_stream_spec.rb
161
+ - spec/event_store/persistence/mongodb_spec.rb
162
+ - spec/event_store/serialization/simple_message.rb
163
+ - spec/spec_helper.rb
164
+ - spec/support/array_enumeration_counter.rb
165
+ homepage: http://github.com/leemhenson/euston-eventstore
166
+ licenses: []
167
+ post_install_message:
168
+ rdoc_options: []
169
+ require_paths:
170
+ - lib
171
+ required_ruby_version: !ruby/object:Gem::Requirement
172
+ none: false
173
+ requirements:
174
+ - - ! '>='
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ none: false
179
+ requirements:
180
+ - - ! '>='
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ requirements: []
184
+ rubyforge_project:
185
+ rubygems_version: 1.8.10
186
+ signing_key:
187
+ specification_version: 3
188
+ summary: Event store for use with Euston.
189
+ test_files: []