lock-smith 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/locksmith/dynamodb.rb +7 -3
  2. data/readme.md +2 -0
  3. metadata +1 -1
@@ -45,12 +45,16 @@ module Locksmith
45
45
  end
46
46
 
47
47
  def release_lock(name, rev)
48
- locks.put({Name: app_name, Locked: 0},
48
+ locks.put({Name: name, Locked: 0},
49
49
  :if => {:Locked => rev})
50
50
  end
51
51
 
52
52
  def fetch_lock(name)
53
- locks[name].attributes
53
+ if locks.at(name).exists?(consistent_read: true)
54
+ locks[name].attributes.to_h(consistent_read: true)
55
+ else
56
+ locks.put(Name: name, Locked: 0).attributes.to_h(consistent_read: true)
57
+ end
54
58
  end
55
59
 
56
60
  def locks
@@ -75,7 +79,7 @@ module Locksmith
75
79
  end
76
80
 
77
81
  def log(data, &blk)
78
- Log.log({ns: "app-lock"}.merge(data), &blk)
82
+ Log.log({ns: "dynamo-lock"}.merge(data), &blk)
79
83
  end
80
84
 
81
85
  end
data/readme.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Locksmith
2
2
 
3
+ **This software is beta quality. Check back later to hear battle testing results**
4
+
3
5
  A library of locking algorithms for a variety of data stores. Supported Data Stores:
4
6
 
5
7
  * DynamoDB
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lock-smith
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: