dm-riak-adapter 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -14,12 +14,12 @@ Install the **dm-riak-adapter** gem:
14
14
 
15
15
  ## Synopsis
16
16
 
17
- Require **dm-core** and **dm-riak-adapter**. Tell DataMapper to use the Riak adapter and set a namespace for your app. This namespace will prefix each bucket like `myapp:projects` `myapp:tasks`. Skip setting a namespace and the buckets will have no prefix.
17
+ Require **dm-core** and **dm-riak-adapter**. Tell DataMapper to use the Riak adapter and set a namespace for your app. This namespace will prefix each bucket like `todo:projects` `todo:tasks`. Skip setting a namespace and the buckets will have no prefix.
18
18
 
19
19
  require 'dm-core'
20
20
  require 'dm-riak-adapter'
21
21
 
22
- DataMapper.setup :default, :adapter => 'riak', :namespace => 'myapp'
22
+ DataMapper.setup :default, :adapter => 'riak', :namespace => 'todo'
23
23
 
24
24
  Continue defining your models and properties as you normally would. Set a property as type `Key` to use Riak's server-assigned UUIDs.
25
25
 
@@ -105,12 +105,18 @@ module DataMapper::Adapters
105
105
 
106
106
  private
107
107
 
108
+ def bucket_name(model)
109
+ @namespace + model.storage_name
110
+ end
111
+
108
112
  def bucket(model)
109
- @riak.bucket @namespace + model.storage_name
113
+ @riak.bucket bucket_name(model)
110
114
  end
111
115
 
112
116
  def objects_for(model)
113
- bucket(model).keys.map {|key| bucket(model)[key].data}
117
+ Riak::MapReduce.new(@riak).
118
+ add(bucket_name(model)).
119
+ map('Riak.mapValuesJson', :keep => true).run
114
120
  end
115
121
 
116
122
  def create_objects(resources)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-riak-adapter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 5
10
- version: 0.0.5
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mike Richards
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-07 00:00:00 -07:00
18
+ date: 2010-11-21 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency