ocean-dynamo 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e5d649565fd30bee32f1b8d80c7f6117009229e
4
- data.tar.gz: e281cb72d49607d53e9ddd7053462f50c29b0604
3
+ metadata.gz: 2fb7536da67529e55053f4d69555c8da40c90caf
4
+ data.tar.gz: 05bd66e0d69782c47bdcc8f7c9dff93ee2ddcd64
5
5
  SHA512:
6
- metadata.gz: cf608c59e414e273d9e13cf30070e3e2c3ba6ef79e343900b66d7fc1dbc08dd903332fe9297310fbebb5dbc1c9050957130178fe864dafc316ced76e397c629c
7
- data.tar.gz: 708e7170927244786d84e20bc2b7ffc99206263d210f3fe4e73ee4306be3bb659b1383b01cb9631b91ef85c4d378a03947a28b3a4cb60f3f5dbbf896c99c34cf
6
+ metadata.gz: 24cef1a99d5517f5ef77f93502b355e012faa1bff8b8fa1f04368e362e0c55fb849cee1db90119b4badace1497f17aaa9a0ca23f74e7e06f30c5ac04dc9f0263
7
+ data.tar.gz: ccf031cc32f7807a6a1231f6e83b816e813657e3352a4b0b302b7b458fe60457367f674d2567cfdca64841c785e11628239de370402225098ff6eb7657e3502b
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2016 Peter Bengtson
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -30,6 +30,8 @@ OceanDynamo is fully usable as an ActiveModel and can be used by Rails
30
30
  controllers. Thanks to its structural similarity to ActiveRecord, OceanDynamo works
31
31
  with FactoryGirl.
32
32
 
33
+ OceanDynamo supports optimistic record locking via a combination of DynamoDB conditional
34
+ writes and atomic updates. This is activated by default.
33
35
 
34
36
  === Current State
35
37
 
@@ -48,14 +50,11 @@ with FactoryGirl.
48
50
 
49
51
  === Current use
50
52
 
51
- OceanDynamo is used as a central component in Ocean, a Rails framework and development
52
- pipeline for creating massively scalable HATEOAS microservice SOAs in the cloud.
53
+ OceanDynamo is used as a central component in Ocean, a Rails framework and development,
54
+ testing, and production pipeline for creating massively scalable HATEOAS microservice
55
+ SOAs in the cloud.
53
56
  * http://wiki.oceanframework.net
54
57
 
55
- Ocean uses OceanDynamo to implement highly scalable job queues and authentication.
56
- It will be used increasingly as features are added to OceanDynamo and will eventually
57
- replace all ActiveRecord tables in Ocean.
58
-
59
58
  However, OceanDynamo can of course also be used stand-alone.
60
59
 
61
60
 
@@ -139,6 +138,15 @@ value will return the empty string, <tt>""</tt>.
139
138
  ...
140
139
  ...
141
140
  end
141
+
142
+ Tip: you might want to use the following idiom when declaring a +dynamo_schema+. It is used everywhere in Ocean:
143
+
144
+ dynamo_schema(:id, table_name_suffix: Api.basename_suffix,
145
+ create: Rails.env != "production") do
146
+ ...
147
+ end
148
+
149
+ This will auto-create the DynamoDB table in all environments except production, and it will also add a suffix to the table name in order to prevent tests from colliding. Cf +Api.basename_suffix+ in the +ocean-rails+ gem for more information.
142
150
 
143
151
  == +has_many+ and +belongs_to+
144
152
 
@@ -176,6 +184,7 @@ is required as the Topic class itself has a +belongs_to+ relation and thus has
176
184
  a composite key. This must be declared in the child class as it needs to know
177
185
  how to retrieve its parent.
178
186
 
187
+
179
188
  === Restrictions
180
189
 
181
190
  Restrictions for +belongs_to+ tables:
@@ -190,6 +199,7 @@ Restrictions for +has_many+ tables:
190
199
  These restrictions allow OceanDynamo to implement the +has_many+ / +belongs_to+
191
200
  relation in a very efficient and massively scalable way.
192
201
 
202
+
193
203
  === Implementation
194
204
 
195
205
  +belongs_to+ claims the range key and uses it to store its own id, which normally
@@ -358,36 +368,6 @@ With DynamoDB Local running, you should now be able to do
358
368
 
359
369
  All tests should pass.
360
370
 
361
-
362
- === Cleaning up the DB
363
-
364
- You might want to add the following to your spec_helper.rb file, before the +RSpec.configure+
365
- block:
366
-
367
- # DynamoDB table cleaner
368
- CHEF_ENV = "master" unless defined?(CHEF_ENV)
369
- regexp = Regexp.new("^.+_#{CHEF_ENV}_[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}_test$")
370
- cleaner = lambda {
371
- c = Aws::DynamoDB::Client.new
372
- c.list_tables.table_names.each do |t|
373
- begin
374
- c.delete_table({table_name: t}) if t =~ regexp
375
- rescue Aws::DynamoDB::Errors::LimitExceededException
376
- sleep 1
377
- retry
378
- end
379
- end
380
- }
381
-
382
- Then, inside the +RSpec.configure+ block:
383
-
384
- config.before(:suite) { cleaner.call }
385
- config.after(:suite) { cleaner.call }
386
-
387
- This will remove only those test tables created by the specs on this particular machine and
388
- environment. This is safe even on AWS and in parallel with other machines.
389
-
390
-
391
371
  == Rails console
392
372
 
393
373
  The Rails console is available from the built-in dummy application:
@@ -124,7 +124,7 @@ module OceanDynamo
124
124
  if fields.has_key?(attr_name)
125
125
  @attributes[attr_name]
126
126
  else
127
- raise ActiveModel::MissingAttributeError, "can't read unknown attribute '#{attr_ name}"
127
+ raise ActiveModel::MissingAttributeError, "can't read unknown attribute '#{attr_name}"
128
128
  end
129
129
  end
130
130
 
@@ -1,3 +1,3 @@
1
1
  module OceanDynamo
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-dynamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-09 00:00:00.000000000 Z
11
+ date: 2017-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -158,7 +158,7 @@ executables: []
158
158
  extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
- - MIT-LICENSE
161
+ - LICENSE
162
162
  - README.rdoc
163
163
  - Rakefile
164
164
  - config/routes.rb
@@ -189,7 +189,7 @@ files:
189
189
  - lib/ocean-dynamo/version.rb
190
190
  homepage: https://github.com/OceanDev/ocean-dynamo
191
191
  licenses:
192
- - MIT
192
+ - Apache-2.0
193
193
  metadata: {}
194
194
  post_install_message:
195
195
  rdoc_options: []
@@ -1,20 +0,0 @@
1
- Copyright 2013 Peter Bengtson
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.