marloss 0.2.0 → 0.5.2
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +130 -0
- data/.travis.yml +7 -2
- data/CHANGELOG.md +31 -0
- data/Gemfile +2 -0
- data/README.md +13 -16
- data/Rakefile +3 -1
- data/lib/marloss.rb +14 -26
- data/lib/marloss/error.rb +7 -9
- data/lib/marloss/locker.rb +6 -21
- data/lib/marloss/store.rb +55 -22
- data/lib/marloss/version.rb +2 -4
- data/marloss.gemspec +18 -10
- metadata +48 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e4551d19620ac54dab98243f0c7cff6b0fd60e6dbc93d69a85d86c9b22ac2bc
|
4
|
+
data.tar.gz: 5c3c13ca93eb5ec41946be009a3bb1cbc4cec93aafd53573753841f15cdbd199
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1b6c0bbdc40d80566ce5fedff3d96180e88eac10cd946c2d6e0fd94fc8cd63d17c6982e02d7e57aa83162846d718ce25dd8d971d959892110c5d02a2cee82fa
|
7
|
+
data.tar.gz: 9ca7d34daa20a435ddc28a36509ed3390116b58ab3c46c0f07639a352f0f256a9803804cc7f63f774c9f949858c2c0bc7564832df4c2be3e582c0b282bbc6600
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
Metrics/LineLength:
|
2
|
+
Max: 100
|
3
|
+
|
4
|
+
Style/StringLiterals:
|
5
|
+
EnforcedStyle: double_quotes
|
6
|
+
|
7
|
+
Layout/MultilineMethodCallIndentation:
|
8
|
+
EnforcedStyle: indented
|
9
|
+
|
10
|
+
Style/AccessModifierDeclarations:
|
11
|
+
EnforcedStyle: inline
|
12
|
+
|
13
|
+
Style/Documentation:
|
14
|
+
Enabled: false # disable for now
|
15
|
+
|
16
|
+
Metrics/BlockLength:
|
17
|
+
Exclude:
|
18
|
+
- "spec/**/*"
|
19
|
+
- "marloss.gemspec"
|
20
|
+
|
21
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
Layout/SpaceAroundMethodCallOperator:
|
25
|
+
Enabled: true
|
26
|
+
|
27
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
28
|
+
Enabled: true
|
29
|
+
|
30
|
+
Lint/DeprecatedOpenSSLConstant:
|
31
|
+
Enabled: true
|
32
|
+
|
33
|
+
Lint/DuplicateElsifCondition:
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
Lint/DuplicateRescueException:
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
Lint/EmptyConditionalBody:
|
40
|
+
Enabled: true
|
41
|
+
|
42
|
+
Lint/FloatComparison:
|
43
|
+
Enabled: true
|
44
|
+
|
45
|
+
Lint/MissingSuper:
|
46
|
+
Enabled: true
|
47
|
+
|
48
|
+
Lint/MixedRegexpCaptureTypes:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
Lint/OutOfRangeRegexpRef:
|
52
|
+
Enabled: true
|
53
|
+
|
54
|
+
Lint/RaiseException:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
Lint/SelfAssignment:
|
58
|
+
Enabled: true
|
59
|
+
|
60
|
+
Lint/StructNewOverride:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
Lint/TopLevelReturnWithArgument:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Lint/UnreachableLoop:
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
Style/AccessorGrouping:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Style/ArrayCoercion:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
Style/BisectedAttrAccessor:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Style/CaseLikeIf:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
Style/ExplicitBlockArgument:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
Style/ExponentialNotation:
|
85
|
+
Enabled: true
|
86
|
+
|
87
|
+
Style/GlobalStdStream:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
Style/HashAsLastArrayItem:
|
91
|
+
Enabled: true
|
92
|
+
|
93
|
+
Style/HashEachMethods:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
Style/HashLikeCase:
|
97
|
+
Enabled: true
|
98
|
+
|
99
|
+
Style/HashTransformKeys:
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
Style/HashTransformValues:
|
103
|
+
Enabled: true
|
104
|
+
|
105
|
+
Style/OptionalBooleanParameter:
|
106
|
+
Enabled: true
|
107
|
+
|
108
|
+
Style/RedundantAssignment:
|
109
|
+
Enabled: true
|
110
|
+
|
111
|
+
Style/RedundantFetchBlock:
|
112
|
+
Enabled: true
|
113
|
+
|
114
|
+
Style/RedundantFileExtensionInRequire:
|
115
|
+
Enabled: true
|
116
|
+
|
117
|
+
Style/RedundantRegexpCharacterClass:
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
Style/RedundantRegexpEscape:
|
121
|
+
Enabled: true
|
122
|
+
|
123
|
+
Style/SingleArgumentDig:
|
124
|
+
Enabled: true
|
125
|
+
|
126
|
+
Style/SlicingWithRange:
|
127
|
+
Enabled: true
|
128
|
+
|
129
|
+
Style/StringConcatenation:
|
130
|
+
Enabled: true
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,34 @@
|
|
1
|
+
## 0.5.0 11/02/2019
|
2
|
+
|
3
|
+
IMPROVEMENTS:
|
4
|
+
|
5
|
+
* Add the option to specify a `custom_process_id` [#15](https://github.com/eredi93/marloss/pull/15)
|
6
|
+
|
7
|
+
## 0.4.0 01/09/2018
|
8
|
+
|
9
|
+
IMPROVEMENTS:
|
10
|
+
|
11
|
+
* Custom ttl attribute name instead of hardcoding `Expires` [#12](https://github.com/eredi93/marloss/pull/12)
|
12
|
+
* Add possiblity to pass retries to `wait_until_lock_obtained` preventing spin lock [#11](https://github.com/eredi93/marloss/pull/11)
|
13
|
+
|
14
|
+
## 0.3.1 01/09/2018
|
15
|
+
|
16
|
+
IMPROVEMENTS:
|
17
|
+
|
18
|
+
* Make `create_table` wait for table [#8](https://github.com/eredi93/marloss/pull/8)
|
19
|
+
|
20
|
+
## 0.3.0 29/11/2017
|
21
|
+
|
22
|
+
IMPROVEMENTS:
|
23
|
+
|
24
|
+
* remove `with_refreshed_lock` as is not safe [#4](https://github.com/eredi93/marloss/pull/4)
|
25
|
+
|
26
|
+
## 0.2.1 29/11/2017
|
27
|
+
|
28
|
+
IMPROVEMENTS:
|
29
|
+
|
30
|
+
* Log when deleting the lock
|
31
|
+
|
1
32
|
## 0.2.0 29/11/2017
|
2
33
|
|
3
34
|
IMPROVEMENTS:
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -7,6 +7,8 @@ Marloss is a general DynamoDB-based lock implementation.
|
|
7
7
|
|
8
8
|

|
9
9
|
|
10
|
+
This Gem is tested using Ruby 2.6, 2.5, 2.4, 2.3
|
11
|
+
|
10
12
|
### Installation
|
11
13
|
|
12
14
|
Add this line to your application's Gemfile:
|
@@ -48,16 +50,11 @@ end
|
|
48
50
|
now you can simply wrap the code that needs to be locked
|
49
51
|
|
50
52
|
```ruby
|
51
|
-
with_marloss_locker("my_lock")
|
52
|
-
# execute code
|
53
|
-
end
|
54
|
-
```
|
55
|
-
|
56
|
-
if you have a long running task and you need to make sure you don't lose the lock
|
57
|
-
|
58
|
-
```ruby
|
59
|
-
with_refreshed_marloss_locker("my_lock")
|
53
|
+
with_marloss_locker("my_lock") do |locker|
|
60
54
|
# execute code
|
55
|
+
# ...
|
56
|
+
# refresh lock if needed
|
57
|
+
locker.refresh
|
61
58
|
end
|
62
59
|
```
|
63
60
|
|
@@ -69,6 +66,11 @@ Firstly, we need to initialize a lock store:
|
|
69
66
|
store = Marloss::Store.new("lock_table_name", "LockHashKeyName")
|
70
67
|
```
|
71
68
|
|
69
|
+
Create table if it does not exist:
|
70
|
+
```ruby
|
71
|
+
store.create_table
|
72
|
+
```
|
73
|
+
|
72
74
|
We can use this store to create a single lock
|
73
75
|
|
74
76
|
```ruby
|
@@ -81,12 +83,7 @@ locker.obtain_lock
|
|
81
83
|
locker.wait_until_lock_obtained
|
82
84
|
|
83
85
|
# refresh the lock once
|
84
|
-
locker.
|
85
|
-
|
86
|
-
# or execute block with lock being refreshed
|
87
|
-
locker.with_refreshed_lock do
|
88
|
-
# execute long running code
|
89
|
-
end
|
86
|
+
locker.refresh_lock
|
90
87
|
|
91
88
|
# delete the lock
|
92
89
|
locker.release_lock
|
@@ -110,4 +107,4 @@ Marloss.logger = Logger.new("my_app.log")
|
|
110
107
|
|
111
108
|
### Contributing
|
112
109
|
|
113
|
-
This repository is [open to contributions](
|
110
|
+
This repository is [open to contributions](CONTRIBUTING.md).
|
data/Rakefile
CHANGED
data/lib/marloss.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
3
|
require "aws-sdk-dynamodb"
|
4
4
|
|
5
5
|
require "marloss/version"
|
@@ -8,9 +8,8 @@ require "marloss/store"
|
|
8
8
|
require "marloss/locker"
|
9
9
|
|
10
10
|
module Marloss
|
11
|
-
|
12
11
|
def self.logger
|
13
|
-
@logger ||= ::Logger.new(
|
12
|
+
@logger ||= ::Logger.new($stdout)
|
14
13
|
end
|
15
14
|
|
16
15
|
def self.logger=(logger)
|
@@ -19,10 +18,10 @@ module Marloss
|
|
19
18
|
|
20
19
|
def self.included(base)
|
21
20
|
base.define_singleton_method(:marloss_options) do |opts|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
raise(MissingParameterError, "DynamoDB
|
21
|
+
%i[table hash_key].each do |key|
|
22
|
+
next unless opts[key].nil?
|
23
|
+
|
24
|
+
raise(MissingParameterError, "DynamoDB #{key.to_s.capitalize.tr('_', ' ')} not set")
|
26
25
|
end
|
27
26
|
|
28
27
|
define_method(:marloss_options_hash) { opts }
|
@@ -34,13 +33,12 @@ module Marloss
|
|
34
33
|
end
|
35
34
|
|
36
35
|
module InstanceMethods
|
37
|
-
|
38
36
|
def marloss_store
|
39
|
-
@marloss_store ||=begin
|
37
|
+
@marloss_store ||= begin
|
40
38
|
table = marloss_options_hash[:table]
|
41
39
|
hash_key = marloss_options_hash[:hash_key]
|
42
|
-
options = marloss_options_hash.reject do |k,
|
43
|
-
|
40
|
+
options = marloss_options_hash.reject do |k, _|
|
41
|
+
%i[table hash_key].include?(k)
|
44
42
|
end
|
45
43
|
|
46
44
|
Store.new(table, hash_key, options)
|
@@ -52,25 +50,15 @@ module Marloss
|
|
52
50
|
end
|
53
51
|
|
54
52
|
def with_marloss_locker(name, opts = {})
|
53
|
+
has_lock = false
|
55
54
|
locker = marloss_locker(name)
|
56
55
|
|
57
56
|
locker.wait_until_lock_obtained(opts)
|
57
|
+
has_lock = true
|
58
58
|
|
59
|
-
yield
|
60
|
-
|
61
|
-
locker.release_lock
|
62
|
-
end
|
63
|
-
|
64
|
-
def with_refreshed_marloss_locker(name, opts = {})
|
65
|
-
locker = marloss_locker(name)
|
66
|
-
|
67
|
-
locker.wait_until_lock_obtained(opts)
|
68
|
-
|
69
|
-
locker.with_refreshed_lock { yield }
|
70
|
-
|
71
|
-
locker.release_lock
|
59
|
+
yield(locker)
|
60
|
+
ensure
|
61
|
+
locker.release_lock if has_lock
|
72
62
|
end
|
73
|
-
|
74
63
|
end
|
75
|
-
|
76
64
|
end
|
data/lib/marloss/error.rb
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
3
|
module Marloss
|
4
|
+
class Error < StandardError; end
|
4
5
|
|
5
|
-
class
|
6
|
-
end
|
6
|
+
class CreateTableError < Error; end
|
7
7
|
|
8
|
-
class
|
9
|
-
end
|
8
|
+
class SetTableTtlError < Error; end
|
10
9
|
|
11
|
-
class
|
12
|
-
end
|
10
|
+
class LockNotObtainedError < Error; end
|
13
11
|
|
14
|
-
class
|
15
|
-
end
|
12
|
+
class LockNotRefreshedError < Error; end
|
16
13
|
|
14
|
+
class MissingParameterError < Error; end
|
17
15
|
end
|
data/lib/marloss/locker.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
3
|
module Marloss
|
4
4
|
class Locker
|
5
|
-
|
6
5
|
attr_reader :store, :name
|
7
6
|
|
8
7
|
def initialize(store, name)
|
@@ -22,31 +21,17 @@ module Marloss
|
|
22
21
|
store.delete_lock(name)
|
23
22
|
end
|
24
23
|
|
25
|
-
def wait_until_lock_obtained(sleep_seconds: 3)
|
24
|
+
def wait_until_lock_obtained(sleep_seconds: 3, retries: nil)
|
26
25
|
store.create_lock(name)
|
27
26
|
rescue LockNotObtainedError
|
28
27
|
sleep(sleep_seconds)
|
29
|
-
retry
|
30
|
-
end
|
31
28
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
begin
|
36
|
-
store.refresh_lock(name)
|
37
|
-
rescue Exception => e
|
38
|
-
Thread.main.raise(e)
|
39
|
-
end
|
40
|
-
|
41
|
-
sleep(store.ttl / 3.0)
|
42
|
-
end
|
29
|
+
unless retries.nil?
|
30
|
+
retries -= 1
|
31
|
+
raise if retries.zero?
|
43
32
|
end
|
44
33
|
|
45
|
-
|
46
|
-
|
47
|
-
ensure
|
48
|
-
thr.kill
|
34
|
+
retry
|
49
35
|
end
|
50
|
-
|
51
36
|
end
|
52
37
|
end
|
data/lib/marloss/store.rb
CHANGED
@@ -1,49 +1,83 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
#
|
3
|
-
module Marloss
|
4
|
-
class Store
|
5
2
|
|
6
|
-
|
3
|
+
module Marloss
|
4
|
+
class Store # rubocop:disable Metrics/ClassLength
|
5
|
+
attr_reader :client, :table, :hash_key, :expires_key, :ttl, :process_id
|
7
6
|
|
8
|
-
def initialize(table, hash_key,
|
7
|
+
def initialize(table, hash_key, **options)
|
8
|
+
client_options = options.fetch(:client_options, {})
|
9
9
|
@client = Aws::DynamoDB::Client.new(client_options)
|
10
10
|
@table = table
|
11
11
|
@hash_key = hash_key
|
12
|
-
@
|
12
|
+
@expires_key = options.fetch(:expires_key, "Expires")
|
13
|
+
@ttl = options.fetch(:ttl, 30)
|
14
|
+
@process_id = options[:custom_process_id] || host_process_id
|
13
15
|
end
|
14
16
|
|
15
17
|
def create_table
|
18
|
+
create_ddb_table
|
19
|
+
wait_until_ddb_table_exists
|
20
|
+
set_ddb_table_ttl
|
21
|
+
end
|
22
|
+
|
23
|
+
private def create_ddb_table # rubocop:disable Metrics/MethodLength
|
16
24
|
client.create_table(
|
17
25
|
attribute_definitions: [
|
18
26
|
{
|
19
27
|
attribute_name: hash_key,
|
20
|
-
attribute_type: "S"
|
28
|
+
attribute_type: "S"
|
21
29
|
}
|
22
30
|
],
|
23
31
|
key_schema: [
|
24
32
|
{
|
25
33
|
attribute_name: hash_key,
|
26
|
-
key_type: "HASH"
|
34
|
+
key_type: "HASH"
|
27
35
|
}
|
28
36
|
],
|
29
37
|
provisioned_throughput: {
|
30
38
|
read_capacity_units: 5,
|
31
|
-
write_capacity_units: 5
|
39
|
+
write_capacity_units: 5
|
32
40
|
},
|
33
41
|
table_name: table
|
34
42
|
)
|
35
43
|
|
36
44
|
Marloss.logger.info("DynamoDB table created successfully")
|
45
|
+
rescue Aws::DynamoDB::Errors::ResourceInUseException => e
|
46
|
+
case e.message
|
47
|
+
when "Table already exists: #{table}"
|
48
|
+
Marloss.logger.warn("DynamoDB table #{table} already exists")
|
49
|
+
else
|
50
|
+
raise(CreateTableError, e.message)
|
51
|
+
end
|
52
|
+
end
|
37
53
|
|
54
|
+
private def wait_until_ddb_table_exists
|
55
|
+
client.wait_until(:table_exists, table_name: table) do |w|
|
56
|
+
w.max_attempts = 10
|
57
|
+
w.delay = 1
|
58
|
+
end
|
59
|
+
rescue Aws::Waiters::Errors::WaiterFailed => e
|
60
|
+
Marloss.logger.error("Failed waiting for initialization of table #{table}")
|
61
|
+
raise(CreateTableError, e.message)
|
62
|
+
end
|
63
|
+
|
64
|
+
private def set_ddb_table_ttl # rubocop:disable Metrics/MethodLength
|
38
65
|
client.update_time_to_live(
|
39
66
|
table_name: table,
|
40
67
|
time_to_live_specification: {
|
41
68
|
enabled: true,
|
42
|
-
attribute_name:
|
69
|
+
attribute_name: expires_key
|
43
70
|
}
|
44
71
|
)
|
45
72
|
|
46
73
|
Marloss.logger.info("DynamoDB table TTL configured successfully")
|
74
|
+
rescue Aws::DynamoDB::Errors::ValidationException => e
|
75
|
+
case e.message
|
76
|
+
when "TimeToLive is already enabled"
|
77
|
+
Marloss.logger.warn("TTL attribute is already configured for table #{table}")
|
78
|
+
else
|
79
|
+
raise(SetTableTtlError, e.message)
|
80
|
+
end
|
47
81
|
end
|
48
82
|
|
49
83
|
def delete_table
|
@@ -52,53 +86,51 @@ module Marloss
|
|
52
86
|
Marloss.logger.info("DynamoDB table deleted successfully")
|
53
87
|
end
|
54
88
|
|
55
|
-
def create_lock(name)
|
89
|
+
def create_lock(name) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
56
90
|
client.put_item(
|
57
91
|
table_name: table,
|
58
92
|
item: {
|
59
93
|
hash_key => name,
|
60
94
|
"ProcessID" => process_id,
|
61
|
-
|
95
|
+
expires_key => (Time.now + ttl).to_i
|
62
96
|
},
|
63
97
|
expression_attribute_names: {
|
64
|
-
"#E" =>
|
98
|
+
"#E" => expires_key,
|
65
99
|
"#P" => "ProcessID"
|
66
100
|
},
|
67
101
|
expression_attribute_values: {
|
68
102
|
":now" => Time.now.to_i,
|
69
|
-
":process_id" => process_id
|
103
|
+
":process_id" => process_id
|
70
104
|
},
|
71
105
|
condition_expression: "attribute_not_exists(#{hash_key}) OR #E < :now OR #P = :process_id"
|
72
106
|
)
|
73
107
|
|
74
108
|
Marloss.logger.info("Lock for #{name} created successfully, will expire in #{ttl} seconds")
|
75
109
|
rescue Aws::DynamoDB::Errors::ConditionalCheckFailedException => e
|
76
|
-
|
77
110
|
Marloss.logger.error("Failed to create lock for #{name}")
|
78
111
|
|
79
112
|
raise(LockNotObtainedError, e.message)
|
80
113
|
end
|
81
114
|
|
82
|
-
def refresh_lock(name)
|
115
|
+
def refresh_lock(name) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
83
116
|
client.update_item(
|
84
117
|
table_name: table,
|
85
118
|
key: { hash_key => name },
|
86
119
|
expression_attribute_names: {
|
87
|
-
"#E" =>
|
120
|
+
"#E" => expires_key,
|
88
121
|
"#P" => "ProcessID"
|
89
122
|
},
|
90
123
|
expression_attribute_values: {
|
91
124
|
":expires" => (Time.now + ttl).to_i,
|
92
125
|
":now" => Time.now.to_i,
|
93
|
-
":process_id" => process_id
|
126
|
+
":process_id" => process_id
|
94
127
|
},
|
95
|
-
update_expression: "SET #E = :expires",
|
128
|
+
update_expression: "SET #E = :expires",
|
96
129
|
condition_expression: "attribute_exists(#{hash_key}) AND (#E < :now OR #P = :process_id)"
|
97
130
|
)
|
98
131
|
|
99
132
|
Marloss.logger.info("Lock for #{name} refreshed successfully, will expire in #{ttl} seconds")
|
100
133
|
rescue Aws::DynamoDB::Errors::ConditionalCheckFailedException => e
|
101
|
-
|
102
134
|
Marloss.logger.error("Failed to refresh lock for #{name}")
|
103
135
|
|
104
136
|
raise(LockNotRefreshedError, e.message)
|
@@ -106,14 +138,15 @@ module Marloss
|
|
106
138
|
|
107
139
|
def delete_lock(name)
|
108
140
|
client.delete_item(key: { hash_key => name }, table_name: table)
|
141
|
+
|
142
|
+
Marloss.logger.info("Lock for #{name} deleted successfully")
|
109
143
|
end
|
110
144
|
|
111
|
-
private def
|
145
|
+
private def host_process_id
|
112
146
|
hostname = `hostname`.chomp
|
113
147
|
pid = Process.pid
|
114
148
|
|
115
149
|
"#{hostname}:#{pid}"
|
116
150
|
end
|
117
|
-
|
118
151
|
end
|
119
152
|
end
|
data/lib/marloss/version.rb
CHANGED
data/marloss.gemspec
CHANGED
@@ -1,25 +1,33 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require "marloss/version"
|
5
6
|
|
7
|
+
files = `git ls-files -z`.split("\x0")
|
8
|
+
.reject { |f| f.match(%r{^(script|spec)/}) }
|
9
|
+
|
6
10
|
Gem::Specification.new do |spec|
|
11
|
+
spec.required_ruby_version = ">= 2.4.0"
|
12
|
+
|
7
13
|
spec.name = "marloss"
|
8
14
|
spec.version = Marloss::VERSION
|
9
15
|
spec.authors = ["Jacopo Scrinzi"]
|
10
16
|
spec.email = "scrinzi.jcopo@gmail.com"
|
11
17
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
18
|
+
spec.summary = "AWS DynamoDB based Locking"
|
19
|
+
spec.description = "Distributed locking using AWS DynamoDB"
|
14
20
|
spec.homepage = "https://github.com/eredi93/marloss"
|
15
21
|
spec.license = "MIT"
|
16
22
|
|
17
|
-
spec.files =
|
18
|
-
spec.require_paths = %w
|
23
|
+
spec.files = files
|
24
|
+
spec.require_paths = %w[lib]
|
19
25
|
|
20
|
-
spec.add_dependency "aws-sdk-dynamodb", "~> 1
|
26
|
+
spec.add_dependency "aws-sdk-dynamodb", "~> 1"
|
21
27
|
|
22
|
-
spec.add_development_dependency "bundler"
|
23
|
-
spec.add_development_dependency "
|
24
|
-
spec.add_development_dependency "
|
28
|
+
spec.add_development_dependency "bundler", ">= 1"
|
29
|
+
spec.add_development_dependency "gem-release", "~> 2.1"
|
30
|
+
spec.add_development_dependency "rake", "~> 12.3"
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.9"
|
32
|
+
spec.add_development_dependency "rubocop", "= 0.89.1"
|
25
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marloss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacopo Scrinzi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-dynamodb
|
@@ -16,56 +16,84 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
26
|
+
version: '1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '1'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gem-release
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '12.3'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '12.3'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '3.9'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.9'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
67
88
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
89
|
+
version: 0.89.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.89.1
|
69
97
|
description: Distributed locking using AWS DynamoDB
|
70
98
|
email: scrinzi.jcopo@gmail.com
|
71
99
|
executables: []
|
@@ -73,6 +101,7 @@ extensions: []
|
|
73
101
|
extra_rdoc_files: []
|
74
102
|
files:
|
75
103
|
- ".gitignore"
|
104
|
+
- ".rubocop.yml"
|
76
105
|
- ".travis.yml"
|
77
106
|
- CHANGELOG.md
|
78
107
|
- CONTRIBUTING.md
|
@@ -90,7 +119,7 @@ homepage: https://github.com/eredi93/marloss
|
|
90
119
|
licenses:
|
91
120
|
- MIT
|
92
121
|
metadata: {}
|
93
|
-
post_install_message:
|
122
|
+
post_install_message:
|
94
123
|
rdoc_options: []
|
95
124
|
require_paths:
|
96
125
|
- lib
|
@@ -98,16 +127,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
127
|
requirements:
|
99
128
|
- - ">="
|
100
129
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
130
|
+
version: 2.4.0
|
102
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
132
|
requirements:
|
104
133
|
- - ">="
|
105
134
|
- !ruby/object:Gem::Version
|
106
135
|
version: '0'
|
107
136
|
requirements: []
|
108
|
-
|
109
|
-
|
110
|
-
signing_key:
|
137
|
+
rubygems_version: 3.0.3
|
138
|
+
signing_key:
|
111
139
|
specification_version: 4
|
112
140
|
summary: AWS DynamoDB based Locking
|
113
141
|
test_files: []
|