mongoid-locking 1.1.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.lock +3 -3
- data/README.md +1 -1
- 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 +3 -2
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.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
@@ -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.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
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- gemfiles/mongoid7_2.gemfile
|
115
115
|
- gemfiles/mongoid7_3.gemfile
|
116
116
|
- lib/mongoid/locking.rb
|
117
|
+
- lib/mongoid/locking/association/embedded/batchable.rb
|
117
118
|
- lib/mongoid/locking/contextual/atomic.rb
|
118
119
|
- lib/mongoid/locking/contextual/mongo.rb
|
119
120
|
- lib/mongoid/locking/persistable.rb
|