mongo_mapper_parallel 1.0.8 → 1.0.9
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 +8 -8
- data/lib/mongo_mapper_parallel.rb +9 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGI5YTdhNzg5N2YwNzhiMzRlZDdkMzEzZmZjMzZiNGYxZGRlY2U0Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2RjZDU0NDY0M2ZhNWM4MmIxMWRiZjY4ODJhYjk1M2VmZWE0OWFjYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODA2NmJkOWI4MTY3ZTkwNzkyZDY1OTM3ODExNWEyNjE1MjUzODc0YWFhY2M0
|
10
|
+
ZmE0NGZmNTlmNWNlNTU2MDBkZDlhYzFkMTM3ZGJlZDQzNGFkMmYxODQ2Mzgw
|
11
|
+
NGRhZmM2OTg5OWVlNzFhM2VlMmJhMzZhMTU1OTM4ZDIyZDliNGY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTQwZmJkODk3MjI2MThiYjJiZGQ1OGIxYzExOTNlNDEyZTRjZmZlN2Y0YTA4
|
14
|
+
YTc4MDQxNmVkMGUwNzljNGRlYTNjMTkyYzEwNWEzYmRkMmVmNjAyN2U4Njhh
|
15
|
+
MDY2MTQ5MzAxZDIyNmQ1YzFhYmI3ODIwNGQ5NjZiZWEzNDQzYzI=
|
@@ -71,12 +71,18 @@ class MongoMapperParallel
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
+
# Obtains the first key
|
75
|
+
# @return [Object] the first split key.
|
76
|
+
def get_first_split_key
|
77
|
+
@command_class.where().order(@split.to_sym).fields(@split.to_sym).first.send(@split.to_sym)
|
78
|
+
end
|
79
|
+
|
74
80
|
# Obtains the splitVectors keys to find chunks to parallelize via the MongoDB `splitVector` command.
|
75
81
|
#
|
76
82
|
# @return [Array<MongoMapperParallel::Key>] the list of the keys that will be used for parallel operation
|
77
|
-
#
|
78
83
|
def get_split_keys
|
79
84
|
@split_keys, splits = [], @command_class.database.command({splitVector: "#{@command_class.database.name}.#{@command_class.collection.name}", keyPattern: {@split.to_sym => 1}, maxChunkSizeBytes: @splitSize })["splitKeys"]
|
85
|
+
splits.unshift({@split.to_s => get_first_split_key})
|
80
86
|
splits.each_with_index do |split_key,k|
|
81
87
|
@split_keys << MongoMapperParallel::Key.new(:position => k, :compiler => self, :key => split_key[@split.to_s], :future_key => (splits[k+1] ? splits[k+1][@split.to_s] : nil),:debug => @debug)
|
82
88
|
end
|
@@ -87,8 +93,8 @@ class MongoMapperParallel
|
|
87
93
|
#
|
88
94
|
# @return [Array<MongoMapperParallel::Key>] the list of the keys that will be used for parallel operation
|
89
95
|
def get_extreme_split_keys
|
90
|
-
|
91
|
-
@split_keys << MongoMapperParallel::Key.new(:position => 0, :compiler => self, :key =>
|
96
|
+
first_split_key = get_first_split_key
|
97
|
+
@split_keys << MongoMapperParallel::Key.new(:position => 0, :compiler => self, :key => first_split_key, :future_key => nil, :debug => @debug)
|
92
98
|
end
|
93
99
|
|
94
100
|
# Instantiates the parallel operation object with the right class, javascript function, and field
|