alephant-sequencer 3.0.3 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +2 -1
- data/alephant-sequencer.gemspec +2 -2
- data/lib/alephant/sequencer/sequence_table.rb +10 -16
- data/lib/alephant/sequencer/version.rb +1 -1
- metadata +80 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 828631b0eec1400b6adbb9910b9a19e1659e018a
|
4
|
+
data.tar.gz: fdc535ef2eaecd2d7b62754877bfb90e19539a21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5f00a88470c386b18f7c9e70a3a64420151118eea6519a39735375e897c933b1847f3ee5977e364c1f282c2bd925c959b5bf77765e76c09d0fa3c36698f0ef0
|
7
|
+
data.tar.gz: 126c68d4bac4a810677c84876908b779022f88a7f86940d35f82fa17c260d0de4703c0221b042c40b2658d176b71d63e749fb87a7057e584c882f5dcddfb0bd8
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.3
|
data/.travis.yml
CHANGED
data/alephant-sequencer.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "alephant-sequencer"
|
8
8
|
spec.version = Alephant::Sequencer::VERSION
|
9
9
|
spec.authors = ["BBC News"]
|
10
|
-
spec.email = ["
|
10
|
+
spec.email = ["D&ENewsFrameworksTeam@bbc.co.uk"]
|
11
11
|
spec.summary = %q{Adds sequencing functionality to Alephant.}
|
12
12
|
spec.homepage = ""
|
13
13
|
spec.license = "MIT"
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency "pry-remote"
|
32
32
|
spec.add_development_dependency "pry-nav"
|
33
33
|
|
34
|
-
spec.add_runtime_dependency "aws-sdk"
|
34
|
+
spec.add_runtime_dependency "aws-sdk-dynamodb"
|
35
35
|
spec.add_runtime_dependency "alephant-logger"
|
36
36
|
spec.add_runtime_dependency "alephant-support"
|
37
37
|
spec.add_runtime_dependency "jsonpath"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "aws-sdk-dynamodb"
|
2
2
|
require 'thread'
|
3
3
|
require 'timeout'
|
4
4
|
|
@@ -12,8 +12,10 @@ module Alephant
|
|
12
12
|
attr_reader :table_name, :client
|
13
13
|
|
14
14
|
def initialize(table_name)
|
15
|
+
options = {}
|
16
|
+
options[:endpoint] = ENV['AWS_DYNAMO_DB_ENDPOINT'] if ENV['AWS_DYNAMO_DB_ENDPOINT']
|
15
17
|
@mutex = Mutex.new
|
16
|
-
@client =
|
18
|
+
@client = Aws::DynamoDB::Client.new(options)
|
17
19
|
@table_name = table_name
|
18
20
|
end
|
19
21
|
|
@@ -30,7 +32,7 @@ module Alephant
|
|
30
32
|
item_payload(ident)
|
31
33
|
)
|
32
34
|
|
33
|
-
!data.empty? ? data
|
35
|
+
!data.empty? ? data.item['value'].to_i : 0
|
34
36
|
end
|
35
37
|
|
36
38
|
def update_sequence_id(ident, value, last_seen_check = nil)
|
@@ -39,12 +41,8 @@ module Alephant
|
|
39
41
|
dynamo_response = @mutex.synchronize do
|
40
42
|
client.put_item(table_name: table_name,
|
41
43
|
item: {
|
42
|
-
'key' =>
|
43
|
-
|
44
|
-
},
|
45
|
-
'value' => {
|
46
|
-
'N' => value.to_s
|
47
|
-
}
|
44
|
+
'key' => ident,
|
45
|
+
'value' => value.to_s
|
48
46
|
},
|
49
47
|
expected: {
|
50
48
|
'key' => {
|
@@ -52,9 +50,7 @@ module Alephant
|
|
52
50
|
},
|
53
51
|
'value' => {
|
54
52
|
comparison_operator: 'GE',
|
55
|
-
attribute_value_list: [
|
56
|
-
{ 'N' => current_sequence.to_s }
|
57
|
-
]
|
53
|
+
attribute_value_list: [current_sequence.to_s]
|
58
54
|
}
|
59
55
|
},
|
60
56
|
conditional_operator: 'OR')
|
@@ -70,7 +66,7 @@ module Alephant
|
|
70
66
|
|
71
67
|
dynamo_response
|
72
68
|
|
73
|
-
rescue
|
69
|
+
rescue Aws::DynamoDB::Errors::ConditionalCheckFailedException => e
|
74
70
|
logger.metric 'SequencerFailedConditionalChecks'
|
75
71
|
logger.error(
|
76
72
|
'event' => 'DynamoDBConditionalCheckFailed',
|
@@ -96,9 +92,7 @@ module Alephant
|
|
96
92
|
{
|
97
93
|
table_name: table_name,
|
98
94
|
key: {
|
99
|
-
'key' =>
|
100
|
-
'S' => ident.to_s
|
101
|
-
}
|
95
|
+
'key' => ident.to_s
|
102
96
|
}
|
103
97
|
}
|
104
98
|
end
|
metadata
CHANGED
@@ -1,249 +1,249 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alephant-sequencer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BBC News
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
|
-
- - ~>
|
17
|
+
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
19
|
version: '1.5'
|
19
|
-
name: bundler
|
20
|
-
prerelease: false
|
21
20
|
type: :development
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
|
-
name: rake
|
34
|
-
prerelease: false
|
35
34
|
type: :development
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
|
-
- -
|
45
|
+
- - ">="
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '0'
|
47
|
-
name: rspec
|
48
|
-
prerelease: false
|
49
48
|
type: :development
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake-rspec
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
|
-
- -
|
59
|
+
- - ">="
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '0'
|
61
|
-
name: rake-rspec
|
62
|
-
prerelease: false
|
63
62
|
type: :development
|
63
|
+
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-nc
|
70
71
|
requirement: !ruby/object:Gem::Requirement
|
71
72
|
requirements:
|
72
|
-
- -
|
73
|
+
- - ">="
|
73
74
|
- !ruby/object:Gem::Version
|
74
75
|
version: '0'
|
75
|
-
name: rspec-nc
|
76
|
-
prerelease: false
|
77
76
|
type: :development
|
77
|
+
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard
|
84
85
|
requirement: !ruby/object:Gem::Requirement
|
85
86
|
requirements:
|
86
|
-
- -
|
87
|
+
- - ">="
|
87
88
|
- !ruby/object:Gem::Version
|
88
89
|
version: '0'
|
89
|
-
name: guard
|
90
|
-
prerelease: false
|
91
90
|
type: :development
|
91
|
+
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rspec
|
98
99
|
requirement: !ruby/object:Gem::Requirement
|
99
100
|
requirements:
|
100
|
-
- -
|
101
|
+
- - ">="
|
101
102
|
- !ruby/object:Gem::Version
|
102
103
|
version: '0'
|
103
|
-
name: guard-rspec
|
104
|
-
prerelease: false
|
105
104
|
type: :development
|
105
|
+
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
+
name: listen
|
112
113
|
requirement: !ruby/object:Gem::Requirement
|
113
114
|
requirements:
|
114
|
-
- - <
|
115
|
+
- - "<"
|
115
116
|
- !ruby/object:Gem::Version
|
116
117
|
version: 3.1.0
|
117
|
-
name: listen
|
118
|
-
prerelease: false
|
119
118
|
type: :development
|
119
|
+
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - <
|
122
|
+
- - "<"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 3.1.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
126
127
|
requirement: !ruby/object:Gem::Requirement
|
127
128
|
requirements:
|
128
|
-
- -
|
129
|
+
- - ">="
|
129
130
|
- !ruby/object:Gem::Version
|
130
131
|
version: '0'
|
131
|
-
name: pry
|
132
|
-
prerelease: false
|
133
132
|
type: :development
|
133
|
+
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry-remote
|
140
141
|
requirement: !ruby/object:Gem::Requirement
|
141
142
|
requirements:
|
142
|
-
- -
|
143
|
+
- - ">="
|
143
144
|
- !ruby/object:Gem::Version
|
144
145
|
version: '0'
|
145
|
-
name: pry-remote
|
146
|
-
prerelease: false
|
147
146
|
type: :development
|
147
|
+
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
+
name: pry-nav
|
154
155
|
requirement: !ruby/object:Gem::Requirement
|
155
156
|
requirements:
|
156
|
-
- -
|
157
|
+
- - ">="
|
157
158
|
- !ruby/object:Gem::Version
|
158
159
|
version: '0'
|
159
|
-
name: pry-nav
|
160
|
-
prerelease: false
|
161
160
|
type: :development
|
161
|
+
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
|
+
name: aws-sdk-dynamodb
|
168
169
|
requirement: !ruby/object:Gem::Requirement
|
169
170
|
requirements:
|
170
|
-
- -
|
171
|
+
- - ">="
|
171
172
|
- !ruby/object:Gem::Version
|
172
|
-
version: '
|
173
|
-
name: aws-sdk
|
174
|
-
prerelease: false
|
173
|
+
version: '0'
|
175
174
|
type: :runtime
|
175
|
+
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
180
|
+
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
+
name: alephant-logger
|
182
183
|
requirement: !ruby/object:Gem::Requirement
|
183
184
|
requirements:
|
184
|
-
- -
|
185
|
+
- - ">="
|
185
186
|
- !ruby/object:Gem::Version
|
186
187
|
version: '0'
|
187
|
-
name: alephant-logger
|
188
|
-
prerelease: false
|
189
188
|
type: :runtime
|
189
|
+
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
|
+
name: alephant-support
|
196
197
|
requirement: !ruby/object:Gem::Requirement
|
197
198
|
requirements:
|
198
|
-
- -
|
199
|
+
- - ">="
|
199
200
|
- !ruby/object:Gem::Version
|
200
201
|
version: '0'
|
201
|
-
name: alephant-support
|
202
|
-
prerelease: false
|
203
202
|
type: :runtime
|
203
|
+
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
|
+
name: jsonpath
|
210
211
|
requirement: !ruby/object:Gem::Requirement
|
211
212
|
requirements:
|
212
|
-
- -
|
213
|
+
- - ">="
|
213
214
|
- !ruby/object:Gem::Version
|
214
215
|
version: '0'
|
215
|
-
name: jsonpath
|
216
|
-
prerelease: false
|
217
216
|
type: :runtime
|
217
|
+
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- -
|
220
|
+
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
|
+
name: dalli-elasticache
|
224
225
|
requirement: !ruby/object:Gem::Requirement
|
225
226
|
requirements:
|
226
|
-
- -
|
227
|
+
- - ">="
|
227
228
|
- !ruby/object:Gem::Version
|
228
229
|
version: '0'
|
229
|
-
name: dalli-elasticache
|
230
|
-
prerelease: false
|
231
230
|
type: :runtime
|
231
|
+
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- -
|
234
|
+
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0'
|
237
|
-
description:
|
237
|
+
description:
|
238
238
|
email:
|
239
|
-
-
|
239
|
+
- D&ENewsFrameworksTeam@bbc.co.uk
|
240
240
|
executables: []
|
241
241
|
extensions: []
|
242
242
|
extra_rdoc_files: []
|
243
243
|
files:
|
244
|
-
- .gitignore
|
245
|
-
- .ruby-version
|
246
|
-
- .travis.yml
|
244
|
+
- ".gitignore"
|
245
|
+
- ".ruby-version"
|
246
|
+
- ".travis.yml"
|
247
247
|
- Gemfile
|
248
248
|
- Guardfile
|
249
249
|
- LICENSE.txt
|
@@ -261,24 +261,24 @@ homepage: ''
|
|
261
261
|
licenses:
|
262
262
|
- MIT
|
263
263
|
metadata: {}
|
264
|
-
post_install_message:
|
264
|
+
post_install_message:
|
265
265
|
rdoc_options: []
|
266
266
|
require_paths:
|
267
267
|
- lib
|
268
268
|
required_ruby_version: !ruby/object:Gem::Requirement
|
269
269
|
requirements:
|
270
|
-
- -
|
270
|
+
- - ">="
|
271
271
|
- !ruby/object:Gem::Version
|
272
272
|
version: '0'
|
273
273
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
274
274
|
requirements:
|
275
|
-
- -
|
275
|
+
- - ">="
|
276
276
|
- !ruby/object:Gem::Version
|
277
277
|
version: '0'
|
278
278
|
requirements: []
|
279
|
-
rubyforge_project:
|
280
|
-
rubygems_version: 2.
|
281
|
-
signing_key:
|
279
|
+
rubyforge_project:
|
280
|
+
rubygems_version: 2.6.12
|
281
|
+
signing_key:
|
282
282
|
specification_version: 4
|
283
283
|
summary: Adds sequencing functionality to Alephant.
|
284
284
|
test_files:
|