mongoid-locking 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +3 -3
- data/README.md +5 -4
- data/gemfiles/{mongoid7.gemfile → mongoid7_2.gemfile} +1 -1
- data/gemfiles/mongoid7_3.gemfile +6 -0
- data/lib/mongoid/locking/association/embedded/batchable.rb +29 -0
- data/lib/mongoid/locking/version.rb +1 -1
- data/lib/mongoid/locking.rb +4 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7295a06524fd71fe15ceb6891b452cbd698459e7ebd9105dcad9b36fd438952
|
4
|
+
data.tar.gz: 241baea11c9c0bd16525f94d72d3358ea5eeae2cd1f24d9a715bdc5cb085b5dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c109c5fcbe7110c1b2c7507e3bf651f72659639b5b39b1e91acdf07997ffc772661ac627ab3a9c46ebeb4cdd4b119440724d9de6ab8f0507ee8e2d20b59e248
|
7
|
+
data.tar.gz: eed71b3a4074bbdd5a9753317d12f39a0bbc56879f523a71d209547e1270e0a29d7fe4007b8e1b18831d1d6f66ee9a9c38f74964a0ddc49a3cff1b86a8136993
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mongoid-locking (1.
|
5
|
-
mongoid (~> 7.2
|
4
|
+
mongoid-locking (1.1.1)
|
5
|
+
mongoid (~> 7.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -77,7 +77,7 @@ PLATFORMS
|
|
77
77
|
|
78
78
|
DEPENDENCIES
|
79
79
|
byebug
|
80
|
-
mongoid (~> 7.2
|
80
|
+
mongoid (~> 7.2)
|
81
81
|
mongoid-locking!
|
82
82
|
rake (~> 13.0)
|
83
83
|
rspec
|
data/README.md
CHANGED
@@ -58,7 +58,8 @@ Everyone interacting in the Mongoid::Locking project's codebases, issue trackers
|
|
58
58
|
|
59
59
|
## Version Compability
|
60
60
|
|
61
|
-
| Gem version | Mongoid version |
|
62
|
-
| -------- | ------- |
|
63
|
-
| 0.1.2 | >= 6.0, < 7.2 |
|
64
|
-
| 1.0.0 | ~> 7.2
|
61
|
+
| Gem version | Mongoid version |
|
62
|
+
| -------- | ------- |
|
63
|
+
| 0.1.2 | >= 6.0, < 7.2 |
|
64
|
+
| 1.0.0 | ~> 7.2.0 |
|
65
|
+
| ~> 1.1.0 | ~> 7.2 |
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Mongoid
|
2
|
+
module Locking
|
3
|
+
module Association
|
4
|
+
module Embedded
|
5
|
+
module Batchable # :nodoc:
|
6
|
+
# Get the selector for executing atomic operations on the collection.
|
7
|
+
#
|
8
|
+
# @api private
|
9
|
+
#
|
10
|
+
# @example Get the selector.
|
11
|
+
# batchable.selector
|
12
|
+
#
|
13
|
+
# @return [ Hash ] The atomic selector.
|
14
|
+
#
|
15
|
+
# @since 3.0.0
|
16
|
+
#
|
17
|
+
# ---
|
18
|
+
#
|
19
|
+
# Mongoid memoizes the atomic selector, which is not compatible with
|
20
|
+
# Mongoid::Locking. For subsequent saves, the lock_version needs to be
|
21
|
+
# updated, so the atomic selector needs to be regenerated.
|
22
|
+
def selector
|
23
|
+
_base.atomic_selector
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/mongoid/locking.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "mongoid"
|
2
2
|
require_relative "locking/version"
|
3
3
|
require_relative "stale_object_error"
|
4
|
+
require_relative "locking/association/embedded/batchable"
|
4
5
|
require_relative "locking/contextual/atomic"
|
5
6
|
require_relative "locking/contextual/mongo"
|
6
7
|
require_relative "locking/selectable"
|
@@ -30,5 +31,8 @@ end
|
|
30
31
|
Mongoid::Contextual::Mongo.prepend Mongoid::Locking::Contextual::Mongo
|
31
32
|
Mongoid::Contextual::Mongo.prepend Mongoid::Locking::Contextual::Atomic
|
32
33
|
|
34
|
+
# monkey patching for embedded documents
|
35
|
+
Mongoid::Association::Embedded::Batchable.prepend Mongoid::Locking::Association::Embedded::Batchable
|
36
|
+
|
33
37
|
# monkey patching for document updates
|
34
38
|
Mongoid::Persistable.prepend Mongoid::Locking::Persistable
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-locking
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo RA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.2
|
19
|
+
version: '7.2'
|
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: 7.2
|
26
|
+
version: '7.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: byebug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,8 +111,10 @@ files:
|
|
111
111
|
- LICENSE.txt
|
112
112
|
- README.md
|
113
113
|
- Rakefile
|
114
|
-
- gemfiles/
|
114
|
+
- gemfiles/mongoid7_2.gemfile
|
115
|
+
- gemfiles/mongoid7_3.gemfile
|
115
116
|
- lib/mongoid/locking.rb
|
117
|
+
- lib/mongoid/locking/association/embedded/batchable.rb
|
116
118
|
- lib/mongoid/locking/contextual/atomic.rb
|
117
119
|
- lib/mongoid/locking/contextual/mongo.rb
|
118
120
|
- lib/mongoid/locking/persistable.rb
|