ocean-dynamo 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +1 -1
- data/lib/ocean-dynamo/persistence.rb +4 -1
- data/lib/ocean-dynamo/queries.rb +2 -1
- data/lib/ocean-dynamo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: baf6230e55ce06186347e89a96f2bc47731ba535
|
4
|
+
data.tar.gz: 76b2653fa0a7b0fb0531686bd00e734b7539a49a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b47dc35c9f162d1aedfba10b9d622a0b32cf1bf0d2d238d23803492ad0520c0a8ee168de46ed1ac28b316149d5a2df075d4d9293bf95fa9e32c65b108a96910
|
7
|
+
data.tar.gz: d3b48140bc2053deabc9d9ccbb7b01c1624cf8dbf640e374dc971aa9911d844d37fa9e94210520349c52d580c51142d9902e47860c15cf0746d643b2d4f427d8
|
data/README.rdoc
CHANGED
@@ -144,7 +144,7 @@ relation in a very efficient and massively scalable way.
|
|
144
144
|
|
145
145
|
+belongs_to+ claims the range key and uses it to store its own id, which normally
|
146
146
|
would be stored in the hash key attribute. Instead, the hash key attribute holds the
|
147
|
-
|
147
|
+
id of the parent. We have thus reversed the roles of these two fields. As a result,
|
148
148
|
all children store their parent id in the hash key, and their own id in the
|
149
149
|
range key.
|
150
150
|
|
@@ -49,9 +49,12 @@ module OceanDynamo
|
|
49
49
|
# Deletes all records without instantiating them first.
|
50
50
|
#
|
51
51
|
def delete_all
|
52
|
+
ean = { "#H" => table_hash_key.to_s }
|
53
|
+
ean["#R"] = table_range_key.to_s if table_range_key
|
52
54
|
options = {
|
53
55
|
consistent_read: true,
|
54
|
-
projection_expression:
|
56
|
+
projection_expression: "#H" + (table_range_key ? ", #R" : ""),
|
57
|
+
expression_attribute_names: ean
|
55
58
|
}
|
56
59
|
in_batches :scan, options do |attrs|
|
57
60
|
if table_range_key
|
data/lib/ocean-dynamo/queries.rb
CHANGED
@@ -57,7 +57,7 @@ module OceanDynamo
|
|
57
57
|
#
|
58
58
|
# This method takes a block and yields it to every record in a table.
|
59
59
|
# +message+ must be either :scan or :query.
|
60
|
-
# +options+ is the hash of options to
|
60
|
+
# +options+ is the hash of options to pass to the scan or query operation.
|
61
61
|
#
|
62
62
|
def in_batches(message, options, &block)
|
63
63
|
loop do
|
@@ -80,6 +80,7 @@ module OceanDynamo
|
|
80
80
|
#
|
81
81
|
def find_each(limit: nil, batch_size: 1000, consistent: false)
|
82
82
|
options = { consistent_read: consistent }
|
83
|
+
batch_size = limit if limit && limit < batch_size
|
83
84
|
options[:limit] = batch_size if batch_size
|
84
85
|
in_batches :scan, options do |attrs|
|
85
86
|
if limit
|
data/lib/ocean-dynamo/version.rb
CHANGED