em-riak 0.2.0 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,7 +4,7 @@ It is a Riak ruby client design for eventmachine.
4
4
  ### Concept
5
5
  I tried to implement em-riak with goals : Easy to use, ORM, Fast, Flexible, Hybrid.
6
6
 
7
- ###### Easy To use
7
+ ###### Easy To use (ToDo)
8
8
  I tried to use the same behaviors as active-record or sequel.
9
9
  So when you use em-riak, you don't tackling the "Key Design".
10
10
  Instead, just add an extension into your model, and everygthings goes fine.
@@ -36,32 +36,66 @@ With Deferrable-aware, you don't block & wait for your I/O.
36
36
  member_three.add_tag(:interests,"backpacker","delicious","cocktail","movie")
37
37
  member_three.remove_tag(:interest,"delicious")
38
38
 
39
- EmRiak.search(:interests, "delicious") #=> {}
40
- EmRiak.search(:interests, "movie") #=> {:member=>["member3"]}
41
- EmRiak.search(:secondary_index, :interests, "backpacker") #=> same above
42
- EmRiak.search(:interests, "backpacker","movie") #=> {:member=>["member2","member3"]}
39
+ EmRiak.search(:secondary_index, {:bin=>:interests}, "delicious") #=> {}
40
+ EmRiak.search(:secondary_index, {:bin=>:interests}, "movie") #=> {:member=>["member3"]}
41
+ EmRiak.search(:secondary_index, {:bin=>:interests}, "backpacker") #=> same above
42
+ EmRiak.search(:secondary_index, {:bin=>:interests}, "backpacker","movie") #=> {:member=>["member2","member3"]}
43
43
 
44
44
  EmRiak::Util.clean_bucket("member") #=> Clean all the data inside bucket
45
45
 
46
46
  <br/>
47
- How to work with **Asynchornize** ?
48
- With asynchornize, you just set following at anywhere :
47
+ ####Work with Async
48
+ With asynchornize, you just set following at anywhere :
49
49
 
50
50
  EmRiak.async=true
51
51
 
52
52
  And the code behind will become asynchornize.
53
- Because callback still under development, so get object, and search will still reamin direct http.
53
+
54
+
55
+ You can also do dependent async call like following :
56
+
57
+ EmRiak.find("xxx",values){ callback_proc_here }
58
+ EmRiak.create("xxx",values){ callback_proc_here }
59
+ EmRiak.delete("xxx",values){ callback_proc_here }
54
60
 
61
+ EmRiak.search(:search_mode,{:callback=>callback_proc_here},search_conditions)
62
+ # or
63
+ EmRiak.search(:search_mode,{options},search_conditions){ your_call_back }
64
+
65
+ Hybrid is also possible :
66
+
67
+ EmRiak.create("member5",{:name=>"5",:created_at=>Time.now}){|result| # Async req
68
+ EmRiak.find("member5"){|member| # Async req
69
+ EmRiak.destroy(member.riak_key){|result| # Async req
70
+ EmRiak.create("member5",{:name=>"5",:created_at=>Time.now,:new=>true}) # Direct req
71
+ member=EmRiak.find("member5") # Direct req
72
+ }
73
+ }
74
+ }
55
75
 
56
76
  ### Write some map-reduce
57
- You can call **EmRiak::MapReduce.submit()** directly.
58
- Since I just started to work on it, better interface & docs will coming soon…
77
+ Use it directly as following :
78
+
79
+ EmRiak::MapReduce.submit({
80
+ "inputs" => {"bucket"=> "member","index"=> "123", "key"=>["member1","member2","member3"]},
81
+ "query" => [{"map"=> {"language"=> "erlang", "module"=>"riak_kv_mapreduce", "function"=>""} },
82
+ {"reduce"=> {"language"=> "erlang", "module"=>"riak_kv_mapreduce", "function"=>"reduce_identity", "keep"=>true} }
83
+ ]})
84
+
85
+
86
+ Deployment the some js & erlang source :
87
+
88
+ rake deploy:source:all
89
+ # or
90
+ rake deploy:source:js
91
+ # or
92
+ rake deploy:source:erl
93
+
59
94
 
60
95
 
61
96
  ### TO-DO
62
- Async with callback block support
63
- Map/Reduce
64
97
  Full Text Seacrh
65
98
  Deployment & Management
66
99
  Protocal Buffer Interface
67
- ORM with Model
100
+ ORM with Model
101
+ Hadoop MapReduce Support
data/Rakefile CHANGED
@@ -0,0 +1,34 @@
1
+ require 'rake'
2
+
3
+ task :default => [:test]
4
+
5
+ namespace :deploy do
6
+ namespace :source do
7
+ desc "Deploy both javascript and erlang map/reduce soure into riak map/reduce folder"
8
+ task :all do
9
+
10
+ end
11
+
12
+ desc "Deploy javascript source into riak js_source folder"
13
+ task :js do
14
+
15
+ end
16
+
17
+ desc "Deploy erlang source into riak erl_source folder"
18
+ task :erl do
19
+
20
+ end
21
+ end
22
+ end
23
+
24
+ namespace :install do
25
+ namespace :riak do
26
+ desc "Install riak build from source"
27
+ task :source do
28
+ end
29
+
30
+ desc "Install riak build from source & as development mode"
31
+ task :dev do
32
+ end
33
+ end
34
+ end
data/em-riak.gemspec CHANGED
@@ -1,47 +1,47 @@
1
1
  Gem::Specification.new do |s|
2
- s.name = 'em-riak'
3
- s.version = '0.2.0'
4
- s.date = '2012-12-01'
5
- s.summary = "Riak client for eventmachine"
6
- s.description = "An extremely fast and convenient riak client for eventmachine."
7
- s.authors = ["Von"]
8
- s.email = 'von@vonstark.co'
9
- s.files = ["lib/em-riak.rb"]
10
- s.homepage = 'http://tech.vonstark.co'
2
+ s.name = 'em-riak'
3
+ s.version = '0.2.5'
4
+ s.date = '2012-12-27'
5
+ s.summary = "Riak client for eventmachine"
6
+ s.description = "An extremely fast and convenient riak client for eventmachine."
7
+ s.authors = ["Von"]
8
+ s.email = 'von@vonstark.co'
9
+ s.files = ["lib/em-riak.rb"]
10
+ s.homepage = 'http://tech.vonstark.co'
11
11
 
12
- includes = %W{
13
- lib/**/*
14
- spec/**/*
15
- Gemfile
16
- Rakefile
17
- LICENSE*
18
- RELEASE_NOTES*
19
- README*
20
- .gitignore
21
- .document
22
- .rspec
23
- em-riak.gemspec
24
- }
12
+ includes = %W{
13
+ lib/**/*
14
+ spec/**/*
15
+ Gemfile
16
+ Rakefile
17
+ LICENSE*
18
+ RELEASE_NOTES*
19
+ README*
20
+ .gitignore
21
+ .document
22
+ .rspec
23
+ em-riak.gemspec
24
+ }
25
25
 
26
- excludes = %W{
27
- **/*.swp
28
- **/#*
29
- **/.#*
30
- **/*~
31
- **/*.rbc
32
- **/.DS_Store
33
- spec/support/test_server.yml
34
- }
26
+ excludes = %W{
27
+ **/*.swp
28
+ **/#*
29
+ **/.#*
30
+ **/*~
31
+ **/*.rbc
32
+ **/.DS_Store
33
+ spec/support/test_server.yml
34
+ }
35
35
 
36
- s.add_runtime_dependency "escape_utils"
37
- s.add_runtime_dependency "yajl-ruby", "~>1.1.0"
38
- s.add_runtime_dependency "httpi", "~>1.1.1"
39
- s.add_runtime_dependency "eventmachine", "~>1.0.0.beta.4"
40
- s.add_runtime_dependency "em-http-request", "~>1.0.2"
36
+ s.add_runtime_dependency "escape_utils"
37
+ s.add_runtime_dependency "yajl-ruby"
38
+ s.add_runtime_dependency "httpi"
39
+ s.add_runtime_dependency "eventmachine"
40
+ s.add_runtime_dependency "em-http-request"
41
41
 
42
- files = includes.map {|glob| Dir[glob] }.flatten.select {|f| File.file?(f) }.sort
43
- files.reject! {|f| excludes.any? {|e| File.fnmatch?(e, f) } }
42
+ files = includes.map {|glob| Dir[glob] }.flatten.select {|f| File.file?(f) }.sort
43
+ files.reject! {|f| excludes.any? {|e| File.fnmatch?(e, f) } }
44
44
 
45
- s.files = files
46
- s.require_paths = ['lib']
45
+ s.files = files
46
+ s.require_paths = ['lib']
47
47
  end