ruby_event_store 0.27.1 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,76 @@
1
+ module RubyEventStore
2
+ class Specification
3
+ NO_LIMIT = Object.new.freeze
4
+
5
+ class Result < Struct.new(:direction, :start, :count, :stream)
6
+ def limit?
7
+ !count.equal?(NO_LIMIT)
8
+ end
9
+
10
+ def global_stream?
11
+ stream.global?
12
+ end
13
+
14
+ def stream_name
15
+ stream.name
16
+ end
17
+
18
+ def head?
19
+ start.equal?(:head)
20
+ end
21
+
22
+ def forward?
23
+ direction.equal?(:forward)
24
+ end
25
+
26
+ def backward?
27
+ !forward?
28
+ end
29
+ end
30
+ private_constant :Result
31
+
32
+ attr_reader :result
33
+
34
+ def initialize(repository)
35
+ @repository = repository
36
+ @result = Result.new(:forward, :head, NO_LIMIT, Stream.new(GLOBAL_STREAM))
37
+ end
38
+
39
+ def stream(stream_name)
40
+ result.stream = Stream.new(stream_name)
41
+ self
42
+ end
43
+
44
+ def from(start)
45
+ case start
46
+ when Symbol
47
+ raise InvalidPageStart unless [:head].include?(start)
48
+ else
49
+ raise InvalidPageStart if start.nil? || start.empty?
50
+ raise EventNotFound.new(start) unless @repository.has_event?(start)
51
+ end
52
+ result.start = start
53
+ self
54
+ end
55
+
56
+ def forward
57
+ result.direction = :forward
58
+ self
59
+ end
60
+
61
+ def backward
62
+ result.direction = :backward
63
+ self
64
+ end
65
+
66
+ def limit(count)
67
+ raise InvalidPageSize unless count && count > 0
68
+ result.count = count
69
+ self
70
+ end
71
+
72
+ def each
73
+ @repository.read(result)
74
+ end
75
+ end
76
+ end
@@ -1,3 +1,31 @@
1
1
  module RubyEventStore
2
- Stream = Struct.new(:name)
2
+ class Stream
3
+ def initialize(name)
4
+ raise IncorrectStreamData if !name.equal?(GLOBAL_STREAM) && (name.nil? || name.empty?)
5
+ @name = name
6
+ end
7
+
8
+ def global?
9
+ name.equal?(GLOBAL_STREAM)
10
+ end
11
+
12
+ attr_reader :name
13
+
14
+ BIG_VALUE = 0b111111100100000010010010110011101011000101010101001100100110011
15
+ def hash
16
+ [
17
+ self.class,
18
+ name
19
+ ].hash ^ BIG_VALUE
20
+ end
21
+
22
+ def ==(other_stream)
23
+ other_stream.instance_of?(self.class) &&
24
+ other_stream.name.eql?(name)
25
+ end
26
+
27
+ alias_method :eql?, :==
28
+
29
+ private_constant :BIG_VALUE
30
+ end
3
31
  end
@@ -1,3 +1,3 @@
1
1
  module RubyEventStore
2
- VERSION = "0.27.1"
2
+ VERSION = "0.28.0"
3
3
  end
@@ -5,10 +5,14 @@ require 'ruby_event_store/projection'
5
5
  require 'ruby_event_store/errors'
6
6
  require 'ruby_event_store/constants'
7
7
  require 'ruby_event_store/client'
8
+ require 'ruby_event_store/metadata'
9
+ require 'ruby_event_store/specification'
8
10
  require 'ruby_event_store/event'
9
11
  require 'ruby_event_store/stream'
12
+ require 'ruby_event_store/expected_version'
10
13
  require 'ruby_event_store/deprecations'
11
14
  require 'ruby_event_store/serialized_record'
12
15
  require 'ruby_event_store/mappers/default'
13
16
  require 'ruby_event_store/mappers/protobuf'
17
+ require 'ruby_event_store/mappers/null_mapper'
14
18
  require 'ruby_event_store/version'
@@ -12,7 +12,13 @@ Gem::Specification.new do |spec|
12
12
 
13
13
  spec.summary = %q{Event Store in Ruby}
14
14
  spec.description = %q{Implementation of Event Store in Ruby}
15
- spec.homepage = 'https://github.com/RailsEventStore/ruby_event_store'
15
+ spec.homepage = 'https://railseventstore.org'
16
+ spec.metadata = {
17
+ "homepage_uri" => "https://railseventstore.org/",
18
+ "changelog_uri" => "https://github.com/RailsEventStore/rails_event_store/releases",
19
+ "source_code_uri" => "https://github.com/RailsEventStore/rails_event_store",
20
+ "bug_tracker_uri" => "https://github.com/RailsEventStore/rails_event_store/issues",
21
+ }
16
22
 
17
23
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
24
  spec.bindir = 'exe'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_event_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.1
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkency
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-26 00:00:00.000000000 Z
11
+ date: 2018-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -111,9 +111,12 @@ files:
111
111
  - lib/ruby_event_store/deprecations.rb
112
112
  - lib/ruby_event_store/errors.rb
113
113
  - lib/ruby_event_store/event.rb
114
+ - lib/ruby_event_store/expected_version.rb
114
115
  - lib/ruby_event_store/in_memory_repository.rb
115
116
  - lib/ruby_event_store/mappers/default.rb
117
+ - lib/ruby_event_store/mappers/null_mapper.rb
116
118
  - lib/ruby_event_store/mappers/protobuf.rb
119
+ - lib/ruby_event_store/metadata.rb
117
120
  - lib/ruby_event_store/projection.rb
118
121
  - lib/ruby_event_store/pub_sub/broker.rb
119
122
  - lib/ruby_event_store/pub_sub/dispatcher.rb
@@ -121,13 +124,18 @@ files:
121
124
  - lib/ruby_event_store/spec/dispatcher_lint.rb
122
125
  - lib/ruby_event_store/spec/event_broker_lint.rb
123
126
  - lib/ruby_event_store/spec/event_repository_lint.rb
127
+ - lib/ruby_event_store/specification.rb
124
128
  - lib/ruby_event_store/stream.rb
125
129
  - lib/ruby_event_store/version.rb
126
130
  - ruby_event_store.gemspec
127
- homepage: https://github.com/RailsEventStore/ruby_event_store
131
+ homepage: https://railseventstore.org
128
132
  licenses:
129
133
  - MIT
130
- metadata: {}
134
+ metadata:
135
+ homepage_uri: https://railseventstore.org/
136
+ changelog_uri: https://github.com/RailsEventStore/rails_event_store/releases
137
+ source_code_uri: https://github.com/RailsEventStore/rails_event_store
138
+ bug_tracker_uri: https://github.com/RailsEventStore/rails_event_store/issues
131
139
  post_install_message:
132
140
  rdoc_options: []
133
141
  require_paths:
@@ -144,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
152
  version: '0'
145
153
  requirements: []
146
154
  rubyforge_project:
147
- rubygems_version: 2.6.14
155
+ rubygems_version: 2.7.6
148
156
  signing_key:
149
157
  specification_version: 4
150
158
  summary: Event Store in Ruby