toy-dynamo 0.0.4 → 0.0.5

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: 342640e00f6ef382f4ad50e46015753ca5ac034f
4
- data.tar.gz: 27ae95e381c9ca143507c0969edde91f9c9b51ee
3
+ metadata.gz: 6531d75a60cddac48bf7a08e651e992173ff8d6b
4
+ data.tar.gz: d232e86af63d1ebb1fd96b64f5c0e7f94862c751
5
5
  SHA512:
6
- metadata.gz: 5b7857e1165a65db0c8e0b61e12539eac7106cc9acdb34637b558abd652f1632161b8c1e676f6234e090d659b7d4ba3eeecede3d82ea286260ff868a32b86b70
7
- data.tar.gz: 372cb2202e35588fad3aa8ed830dce5a12b654880f27e143d3cf782816b4e321a6cb77db960b571be54eb82640d23c4a42b2c0e3581c2807c0aa2b539faa4e2d
6
+ metadata.gz: 572df43d197d7882c53f726b92e9235c8b8746111582698248ac8610bba044ae21e1285e29ec4ef7ec324d8a5717c314cabc7b5c709e74e7a70a603fcad6afe0
7
+ data.tar.gz: 9d9bdc14bbef5779f473a5add745214282508f309a794d6b5d6d411faa51c275e3da66b279733b5f0a7dad3e8b0640ef0c8a1fe05370e7be19e0553db32cbe5e
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ## Overview
2
- toy-dynamo is an ORM for AWS DynamoDB. It is an extension to [toystore](https://github.com/jnunemaker/toystore) that provides an ActiveModel based ORM for schema-less type data stores.
2
+ toy-dynamo is an ORM for AWS DynamoDB. It is an extension to [toystore](https://github.com/jnunemaker/toystore) that provides an ActiveModel based ORM for schema-less data stores.
3
3
 
4
4
  > **Toy::Object** comes with all the goods you need for plain old ruby objects -- attributes, dirty attribute tracking, equality, inheritance, serialization, cloning, logging and pretty inspecting.
5
5
 
@@ -21,13 +21,13 @@ class Comment
21
21
 
22
22
  adapter :dynamo, Toy::Dynamo::Adapter.default_client, {:model => self}
23
23
 
24
- dynamo_table do
25
- hash_key :thread_guid
26
- range_key :comment_guid
27
- local_secondary_index :posted_by
28
- read_provision 50
24
+ dynamo_table do
25
+ hash_key :thread_guid
26
+ range_key :comment_guid
27
+ local_secondary_index :posted_by
28
+ read_provision 50
29
29
  write_provision 10
30
- end
30
+ end
31
31
 
32
32
  attribute :thread_guid, String
33
33
  attribute :comment_guid, String, :default => lambda { SimpleUUID::UUID.new.to_guid }
@@ -90,10 +90,10 @@ end
90
90
  * **Init a UUID value**
91
91
  * attribute :user_guid, String, :default => lambda { SimpleUUID::UUID.new.to_guid }
92
92
  * **Use with fake_dynamo**
93
- * adapter :dynamo, AWS::DynamoDB::ClientV2.new({
93
+ * adapter :dynamo, Toy::Dynamo::Adapter.default_client({
94
94
  :use_ssl => false,
95
- :dynamo_db_endpoint => 'localhost',
96
- :dynamo_db_port => 4567
95
+ :endpoint => 'localhost',
96
+ :port => 4567
97
97
  }), {:model => self}
98
98
  * **Create table**
99
99
  * rake ddb:create CLASS=User
@@ -112,7 +112,10 @@ end
112
112
 
113
113
  ## TODO
114
114
  * raise error if trying to use an attribute that wasn't 'select'ed (defaulting to selecting all attributes which loads everything with an extra read)
115
- * lambdas for table_name (for dynamic table names)
116
115
  * string and number sets (mostly for scans)
117
116
  * use MAX_ITEM_SIZE (64kb)
117
+ * fix binary data storage support
118
+ * add compression (gzip/lzo) => binary
119
+ * support some sort of rolling tables (for time series type tables)
120
+ * cross table range queries
118
121
 
@@ -162,15 +162,19 @@ module Toy
162
162
  end
163
163
 
164
164
  def validate_key_schema
165
- if (@dynamo_table.schema_loaded_from_dynamo[:table][:key_schema].sort_by { |k| k[:key_type] } != table_schema[:key_schema].sort_by { |k| k[:key_type] })
165
+ if @dynamo_table.schema_loaded_from_dynamo[:table][:key_schema].sort_by { |k| k[:key_type] } != table_schema[:key_schema].sort_by { |k| k[:key_type] })
166
166
  raise ArgumentError, "It appears your key schema (Hash Key/Range Key) have changed from the table definition. Rebuilding the table is necessary."
167
167
  end
168
168
 
169
- if (@dynamo_table.schema_loaded_from_dynamo[:table][:attribute_definitions].sort_by { |k| k[:attribute_name] } != table_schema[:attribute_definitions].sort_by { |k| k[:attribute_name] })
169
+ if @dynamo_table.schema_loaded_from_dynamo[:table][:attribute_definitions].sort_by { |k| k[:attribute_name] } != table_schema[:attribute_definitions].sort_by { |k| k[:attribute_name] }
170
170
  raise ArgumentError, "It appears your attribute definition (types?) have changed from the table definition. Rebuilding the table is necessary."
171
171
  end
172
+
173
+ if @dynamo_table.schema_loaded_from_dynamo[:table][:local_secondary_indexes].blank? != table_schema[:local_secondary_indexes].blank?
174
+ raise ArgumentError, "It appears your local secondary indexes have changed from the table definition. Rebuilding the table is necessary."
175
+ end
172
176
 
173
- if (@dynamo_table.schema_loaded_from_dynamo[:table][:local_secondary_indexes].dup.collect {|i| i.delete_if{|k, v| [:index_size_bytes, :item_count].include?(k) }; i }.sort_by { |lsi| lsi[:index_name] } != table_schema[:local_secondary_indexes].sort_by { |lsi| lsi[:index_name] })
177
+ if @dynamo_table.schema_loaded_from_dynamo[:table][:local_secondary_indexes] && (@dynamo_table.schema_loaded_from_dynamo[:table][:local_secondary_indexes].dup.collect {|i| i.delete_if{|k, v| [:index_size_bytes, :item_count].include?(k) }; i }.sort_by { |lsi| lsi[:index_name] } != table_schema[:local_secondary_indexes].sort_by { |lsi| lsi[:index_name] })
174
178
  raise ArgumentError, "It appears your local secondary indexes have changed from the table definition. Rebuilding the table is necessary."
175
179
  end
176
180
 
@@ -1,5 +1,5 @@
1
1
  module Toy
2
2
  module Dynamo
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
data/toy-dynamo.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Toy::Dynamo::VERSION
9
9
  spec.authors = ["Cary Dunn"]
10
10
  spec.email = ["cary.dunn@gmail.com"]
11
- spec.description = %q{DynamoDB ORM - extension to toystore}
12
- spec.summary = %q{DynamoDB ORM - extension to toystore}
11
+ spec.description = %q{DynamoDB extension to toystore. Provides an ActiveModel based ORM for AWS DynamoDB.}
12
+ spec.summary = %q{ActiveModel based DynamoDB ORM - extension to toystore}
13
13
  spec.homepage = "https://github.com/cdunn/toy-dynamo"
14
14
  spec.license = "MIT"
15
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toy-dynamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cary Dunn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-18 00:00:00.000000000 Z
11
+ date: 2013-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,7 +66,8 @@ dependencies:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.9'
69
- description: DynamoDB ORM - extension to toystore
69
+ description: DynamoDB extension to toystore. Provides an ActiveModel based ORM for
70
+ AWS DynamoDB.
70
71
  email:
71
72
  - cary.dunn@gmail.com
72
73
  executables: []
@@ -121,5 +122,5 @@ rubyforge_project:
121
122
  rubygems_version: 2.0.0
122
123
  signing_key:
123
124
  specification_version: 4
124
- summary: DynamoDB ORM - extension to toystore
125
+ summary: ActiveModel based DynamoDB ORM - extension to toystore
125
126
  test_files: []