evt-message_store 0.2.0.2 → 0.2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f33351e27677d9a50d8ec6058d981f41d5bd3b9
4
- data.tar.gz: d315f851c88cd819f38356bd4cd5014f671573b7
3
+ metadata.gz: 11e754758768557d2db78e145537ef7348004140
4
+ data.tar.gz: cd0e096ffc6920ec9c3a96f8570c38ac5c7a11ab
5
5
  SHA512:
6
- metadata.gz: f5e692282084b2175429d10f06ef365f8b1e9ee7b8c767d573987e2266ad0324271d32f47f5f1e38759e4b43dc9aef28e0daf636e9f0e76bddbf2734d21330c4
7
- data.tar.gz: 8f03f0020f211d79f512bd08fce09c2c6627421fa2b33895e43526f8825110a380d82bbb196489d1378a89fb4d51e0a6249b6f2fca5fc5c15e7ba5a7ed9685a6
6
+ metadata.gz: a5deca0e0fcd7c920228a52b1221755d62fab66f1dd76e4370a226257844b53862d5cb5edb2cae09fe146f603d690de34ec21d28de3b834cdcdaf1b59de990a1
7
+ data.tar.gz: 4bb5a744bbde299dc5de601d7eefdaafbce5ae1eefc6e6e1e156cd4fb54f08802bc4297dfdfdf9a778ac15b6dd6d0a93f7b6a8ac1d580db6b8f59f5b13c87e24
@@ -20,6 +20,8 @@ require 'message_store/stream_name'
20
20
  require 'message_store/log'
21
21
 
22
22
  require 'message_store/get'
23
+ require 'message_store/get/last'
24
+ require 'message_store/get/last/substitute'
23
25
  require 'message_store/read/iterator'
24
26
  require 'message_store/read'
25
27
  require 'message_store/write'
@@ -15,4 +15,5 @@ require 'message_store/controls/message_data/write'
15
15
  require 'message_store/controls/message_data/read'
16
16
  require 'message_store/controls/write'
17
17
  require 'message_store/controls/get'
18
+ require 'message_store/controls/get_last'
18
19
  require 'message_store/controls/iterator'
@@ -0,0 +1,33 @@
1
+ module MessageStore
2
+ module Controls
3
+ module GetLast
4
+ def self.example
5
+ Example.build
6
+ end
7
+
8
+ def self.default_session
9
+ :default_session
10
+ end
11
+
12
+ class Example
13
+ include MessageStore::Get::Last
14
+
15
+ attr_writer :session
16
+ def session
17
+ @session ||= GetLast.default_session
18
+ end
19
+
20
+ def call(stream_name)
21
+ end
22
+
23
+ def configure(session: nil)
24
+ self.session = session
25
+ end
26
+
27
+ def session?(session)
28
+ self.session.equal?(session)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1 @@
1
+ lib/message_store/home/ntl/projects/eventide-project/message-store-event-store/lib/message_store/eve
@@ -0,0 +1 @@
1
+ lib/message_store/home/ntl/projects/eventide-project/message-store-event-store/lib/message_store/eve
@@ -0,0 +1,58 @@
1
+ module MessageStore
2
+ module Get
3
+ module Last
4
+ def self.included(cls)
5
+ cls.class_exec do
6
+ include Log::Dependency
7
+
8
+ extend Build
9
+ extend Call
10
+ extend Configure
11
+
12
+ prepend InstanceActuator
13
+
14
+ virtual :configure
15
+ abstract :call
16
+ end
17
+ end
18
+
19
+ module InstanceActuator
20
+ def call(stream_name)
21
+ logger.trace { "Getting last message data (Stream Name: #{stream_name})" }
22
+
23
+ message_data = super
24
+
25
+ logger.info { "Finished getting message data (Stream Name: #{stream_name})" }
26
+ logger.info(tags: [:data, :message_data]) { message_data.pretty_inspect }
27
+
28
+ message_data
29
+ end
30
+ end
31
+
32
+ module Build
33
+ def build(session: nil)
34
+ instance = new
35
+ instance.configure(session: session)
36
+ instance
37
+ end
38
+ end
39
+
40
+ module Configure
41
+ def configure(receiver, session: nil, attr_name: nil)
42
+ attr_name ||= :get_last
43
+
44
+ instance = build(session: session)
45
+ receiver.public_send("#{attr_name}=", instance)
46
+ instance
47
+ end
48
+ end
49
+
50
+ module Call
51
+ def call(stream_name, session: nil)
52
+ instance = build(session: session)
53
+ instance.(stream_name)
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,27 @@
1
+ module MessageStore
2
+ module Get
3
+ module Last
4
+ module Substitute
5
+ def self.build
6
+ GetLast.new
7
+ end
8
+
9
+ class GetLast
10
+ include Get::Last
11
+
12
+ def call(stream_name)
13
+ streams[stream_name]
14
+ end
15
+
16
+ def set(stream_name, message_data)
17
+ streams[stream_name] = message_data
18
+ end
19
+
20
+ def streams
21
+ @streams ||= {}
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-message_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.2
4
+ version: 0.2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-01 00:00:00.000000000 Z
11
+ date: 2017-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-casing
@@ -132,6 +132,7 @@ files:
132
132
  - lib/message_store/controls.rb
133
133
  - lib/message_store/controls/category.rb
134
134
  - lib/message_store/controls/get.rb
135
+ - lib/message_store/controls/get_last.rb
135
136
  - lib/message_store/controls/id.rb
136
137
  - lib/message_store/controls/iterator.rb
137
138
  - lib/message_store/controls/message_data.rb
@@ -144,8 +145,12 @@ files:
144
145
  - lib/message_store/controls/stream_name.rb
145
146
  - lib/message_store/controls/time.rb
146
147
  - lib/message_store/controls/write.rb
148
+ - lib/message_store/event_store
149
+ - lib/message_store/event_store.rb
147
150
  - lib/message_store/expected_version.rb
148
151
  - lib/message_store/get.rb
152
+ - lib/message_store/get/last.rb
153
+ - lib/message_store/get/last/substitute.rb
149
154
  - lib/message_store/log.rb
150
155
  - lib/message_store/message_data.rb
151
156
  - lib/message_store/message_data/hash.rb