lowang-rubberband 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,81 @@
1
+ namespace java org.elasticsearch.thrift
2
+ namespace csharp ElasticSearch.Thrift
3
+ namespace cpp elasticsearch.thrift
4
+ namespace rb ElasticSearch.Thrift
5
+ namespace py elasticsearch
6
+ namespace perl Elasticsearch
7
+
8
+ enum Method {
9
+ GET = 0,
10
+ PUT = 1,
11
+ POST = 2,
12
+ DELETE = 3,
13
+ HEAD = 4,
14
+ OPTIONS = 5
15
+ }
16
+
17
+ struct RestRequest {
18
+ 1: required Method method,
19
+ 2: required string uri
20
+ 3: optional map<string, string> params
21
+ 4: optional map<string, string> headers
22
+ 5: optional binary body
23
+ }
24
+
25
+ enum Status {
26
+ CONTINUE = 100,
27
+ SWITCHING_PROTOCOLS = 101,
28
+ OK = 200,
29
+ CREATED = 201,
30
+ ACCEPTED = 202,
31
+ NON_AUTHORITATIVE_INFORMATION = 203,
32
+ NO_CONTENT = 204,
33
+ RESET_CONTENT = 205,
34
+ PARTIAL_CONTENT = 206,
35
+ MULTI_STATUS = 207,
36
+ MULTIPLE_CHOICES = 300,
37
+ MOVED_PERMANENTLY = 301,
38
+ FOUND = 302,
39
+ SEE_OTHER = 303,
40
+ NOT_MODIFIED = 304,
41
+ USE_PROXY = 305,
42
+ TEMPORARY_REDIRECT = 307,
43
+ BAD_REQUEST = 400,
44
+ UNAUTHORIZED = 401,
45
+ PAYMENT_REQUIRED = 402,
46
+ FORBIDDEN = 403,
47
+ NOT_FOUND = 404,
48
+ METHOD_NOT_ALLOWED = 405,
49
+ NOT_ACCEPTABLE = 406,
50
+ PROXY_AUTHENTICATION = 407,
51
+ REQUEST_TIMEOUT = 408,
52
+ CONFLICT = 409,
53
+ GONE = 410,
54
+ LENGTH_REQUIRED = 411,
55
+ PRECONDITION_FAILED = 412,
56
+ REQUEST_ENTITY_TOO_LARGE = 413,
57
+ REQUEST_URI_TOO_LONG = 414,
58
+ UNSUPPORTED_MEDIA_TYPE = 415,
59
+ REQUESTED_RANGE_NOT_SATISFIED = 416,
60
+ EXPECTATION_FAILED = 417,
61
+ UNPROCESSABLE_ENTITY = 422,
62
+ LOCKED = 423,
63
+ FAILED_DEPENDENCY = 424,
64
+ INTERNAL_SERVER_ERROR = 500,
65
+ NOT_IMPLEMENTED = 501,
66
+ BAD_GATEWAY = 502,
67
+ SERVICE_UNAVAILABLE = 503,
68
+ GATEWAY_TIMEOUT = 504,
69
+ INSUFFICIENT_STORAGE = 506
70
+ }
71
+
72
+ struct RestResponse {
73
+ 1: required Status status,
74
+ 2: optional map<string, string> headers,
75
+ 3: optional binary body
76
+ }
77
+
78
+ service Rest {
79
+ RestResponse execute(1:required RestRequest request)
80
+ }
81
+
@@ -0,0 +1,12 @@
1
+ #
2
+ # Autogenerated by Thrift
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'elasticsearch_types'
8
+
9
+ module ElasticSearch
10
+ module Thrift
11
+ end
12
+ end
@@ -0,0 +1,124 @@
1
+ #
2
+ # Autogenerated by Thrift
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+
8
+ module ElasticSearch
9
+ module Thrift
10
+ module Method
11
+ GET = 0
12
+ PUT = 1
13
+ POST = 2
14
+ DELETE = 3
15
+ HEAD = 4
16
+ OPTIONS = 5
17
+ VALUE_MAP = {0 => "GET", 1 => "PUT", 2 => "POST", 3 => "DELETE", 4 => "HEAD", 5 => "OPTIONS"}
18
+ VALID_VALUES = Set.new([GET, PUT, POST, DELETE, HEAD, OPTIONS]).freeze
19
+ end
20
+
21
+ module Status
22
+ CONTINUE = 100
23
+ SWITCHING_PROTOCOLS = 101
24
+ OK = 200
25
+ CREATED = 201
26
+ ACCEPTED = 202
27
+ NON_AUTHORITATIVE_INFORMATION = 203
28
+ NO_CONTENT = 204
29
+ RESET_CONTENT = 205
30
+ PARTIAL_CONTENT = 206
31
+ MULTI_STATUS = 207
32
+ MULTIPLE_CHOICES = 300
33
+ MOVED_PERMANENTLY = 301
34
+ FOUND = 302
35
+ SEE_OTHER = 303
36
+ NOT_MODIFIED = 304
37
+ USE_PROXY = 305
38
+ TEMPORARY_REDIRECT = 307
39
+ BAD_REQUEST = 400
40
+ UNAUTHORIZED = 401
41
+ PAYMENT_REQUIRED = 402
42
+ FORBIDDEN = 403
43
+ NOT_FOUND = 404
44
+ METHOD_NOT_ALLOWED = 405
45
+ NOT_ACCEPTABLE = 406
46
+ PROXY_AUTHENTICATION = 407
47
+ REQUEST_TIMEOUT = 408
48
+ CONFLICT = 409
49
+ GONE = 410
50
+ LENGTH_REQUIRED = 411
51
+ PRECONDITION_FAILED = 412
52
+ REQUEST_ENTITY_TOO_LARGE = 413
53
+ REQUEST_URI_TOO_LONG = 414
54
+ UNSUPPORTED_MEDIA_TYPE = 415
55
+ REQUESTED_RANGE_NOT_SATISFIED = 416
56
+ EXPECTATION_FAILED = 417
57
+ UNPROCESSABLE_ENTITY = 422
58
+ LOCKED = 423
59
+ FAILED_DEPENDENCY = 424
60
+ INTERNAL_SERVER_ERROR = 500
61
+ NOT_IMPLEMENTED = 501
62
+ BAD_GATEWAY = 502
63
+ SERVICE_UNAVAILABLE = 503
64
+ GATEWAY_TIMEOUT = 504
65
+ INSUFFICIENT_STORAGE = 506
66
+ VALUE_MAP = {100 => "CONTINUE", 101 => "SWITCHING_PROTOCOLS", 200 => "OK", 201 => "CREATED", 202 => "ACCEPTED", 203 => "NON_AUTHORITATIVE_INFORMATION", 204 => "NO_CONTENT", 205 => "RESET_CONTENT", 206 => "PARTIAL_CONTENT", 207 => "MULTI_STATUS", 300 => "MULTIPLE_CHOICES", 301 => "MOVED_PERMANENTLY", 302 => "FOUND", 303 => "SEE_OTHER", 304 => "NOT_MODIFIED", 305 => "USE_PROXY", 307 => "TEMPORARY_REDIRECT", 400 => "BAD_REQUEST", 401 => "UNAUTHORIZED", 402 => "PAYMENT_REQUIRED", 403 => "FORBIDDEN", 404 => "NOT_FOUND", 405 => "METHOD_NOT_ALLOWED", 406 => "NOT_ACCEPTABLE", 407 => "PROXY_AUTHENTICATION", 408 => "REQUEST_TIMEOUT", 409 => "CONFLICT", 410 => "GONE", 411 => "LENGTH_REQUIRED", 412 => "PRECONDITION_FAILED", 413 => "REQUEST_ENTITY_TOO_LARGE", 414 => "REQUEST_URI_TOO_LONG", 415 => "UNSUPPORTED_MEDIA_TYPE", 416 => "REQUESTED_RANGE_NOT_SATISFIED", 417 => "EXPECTATION_FAILED", 422 => "UNPROCESSABLE_ENTITY", 423 => "LOCKED", 424 => "FAILED_DEPENDENCY", 500 => "INTERNAL_SERVER_ERROR", 501 => "NOT_IMPLEMENTED", 502 => "BAD_GATEWAY", 503 => "SERVICE_UNAVAILABLE", 504 => "GATEWAY_TIMEOUT", 506 => "INSUFFICIENT_STORAGE"}
67
+ VALID_VALUES = Set.new([CONTINUE, SWITCHING_PROTOCOLS, OK, CREATED, ACCEPTED, NON_AUTHORITATIVE_INFORMATION, NO_CONTENT, RESET_CONTENT, PARTIAL_CONTENT, MULTI_STATUS, MULTIPLE_CHOICES, MOVED_PERMANENTLY, FOUND, SEE_OTHER, NOT_MODIFIED, USE_PROXY, TEMPORARY_REDIRECT, BAD_REQUEST, UNAUTHORIZED, PAYMENT_REQUIRED, FORBIDDEN, NOT_FOUND, METHOD_NOT_ALLOWED, NOT_ACCEPTABLE, PROXY_AUTHENTICATION, REQUEST_TIMEOUT, CONFLICT, GONE, LENGTH_REQUIRED, PRECONDITION_FAILED, REQUEST_ENTITY_TOO_LARGE, REQUEST_URI_TOO_LONG, UNSUPPORTED_MEDIA_TYPE, REQUESTED_RANGE_NOT_SATISFIED, EXPECTATION_FAILED, UNPROCESSABLE_ENTITY, LOCKED, FAILED_DEPENDENCY, INTERNAL_SERVER_ERROR, NOT_IMPLEMENTED, BAD_GATEWAY, SERVICE_UNAVAILABLE, GATEWAY_TIMEOUT, INSUFFICIENT_STORAGE]).freeze
68
+ end
69
+
70
+ class RestRequest
71
+ include ::Thrift::Struct, ::Thrift::Struct_Union
72
+ METHOD = 1
73
+ URI = 2
74
+ PARAMS = 3
75
+ HEADERS = 4
76
+ BODY = 5
77
+
78
+ FIELDS = {
79
+ METHOD => {:type => ::Thrift::Types::I32, :name => 'method', :enum_class => ElasticSearch::Thrift::Method},
80
+ URI => {:type => ::Thrift::Types::STRING, :name => 'uri'},
81
+ PARAMS => {:type => ::Thrift::Types::MAP, :name => 'params', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true},
82
+ HEADERS => {:type => ::Thrift::Types::MAP, :name => 'headers', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true},
83
+ BODY => {:type => ::Thrift::Types::STRING, :name => 'body', :binary => true, :optional => true}
84
+ }
85
+
86
+ def struct_fields; FIELDS; end
87
+
88
+ def validate
89
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field method is unset!') unless @method
90
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field uri is unset!') unless @uri
91
+ unless @method.nil? || ElasticSearch::Thrift::Method::VALID_VALUES.include?(@method)
92
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field method!')
93
+ end
94
+ end
95
+
96
+ ::Thrift::Struct.generate_accessors self
97
+ end
98
+
99
+ class RestResponse
100
+ include ::Thrift::Struct, ::Thrift::Struct_Union
101
+ STATUS = 1
102
+ HEADERS = 2
103
+ BODY = 3
104
+
105
+ FIELDS = {
106
+ STATUS => {:type => ::Thrift::Types::I32, :name => 'status', :enum_class => ElasticSearch::Thrift::Status},
107
+ HEADERS => {:type => ::Thrift::Types::MAP, :name => 'headers', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true},
108
+ BODY => {:type => ::Thrift::Types::STRING, :name => 'body', :binary => true, :optional => true}
109
+ }
110
+
111
+ def struct_fields; FIELDS; end
112
+
113
+ def validate
114
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field status is unset!') unless @status
115
+ unless @status.nil? || ElasticSearch::Thrift::Status::VALID_VALUES.include?(@status)
116
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field status!')
117
+ end
118
+ end
119
+
120
+ ::Thrift::Struct.generate_accessors self
121
+ end
122
+
123
+ end
124
+ end
@@ -0,0 +1,83 @@
1
+ #
2
+ # Autogenerated by Thrift
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'elasticsearch_types'
9
+
10
+ module ElasticSearch
11
+ module Thrift
12
+ module Rest
13
+ class Client
14
+ include ::Thrift::Client
15
+
16
+ def execute(request)
17
+ send_execute(request)
18
+ return recv_execute()
19
+ end
20
+
21
+ def send_execute(request)
22
+ send_message('execute', Execute_args, :request => request)
23
+ end
24
+
25
+ def recv_execute()
26
+ result = receive_message(Execute_result)
27
+ return result.success unless result.success.nil?
28
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'execute failed: unknown result')
29
+ end
30
+
31
+ end
32
+
33
+ class Processor
34
+ include ::Thrift::Processor
35
+
36
+ def process_execute(seqid, iprot, oprot)
37
+ args = read_args(iprot, Execute_args)
38
+ result = Execute_result.new()
39
+ result.success = @handler.execute(args.request)
40
+ write_result(result, oprot, 'execute', seqid)
41
+ end
42
+
43
+ end
44
+
45
+ # HELPER FUNCTIONS AND STRUCTURES
46
+
47
+ class Execute_args
48
+ include ::Thrift::Struct, ::Thrift::Struct_Union
49
+ REQUEST = 1
50
+
51
+ FIELDS = {
52
+ REQUEST => {:type => ::Thrift::Types::STRUCT, :name => 'request', :class => ElasticSearch::Thrift::RestRequest}
53
+ }
54
+
55
+ def struct_fields; FIELDS; end
56
+
57
+ def validate
58
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field request is unset!') unless @request
59
+ end
60
+
61
+ ::Thrift::Struct.generate_accessors self
62
+ end
63
+
64
+ class Execute_result
65
+ include ::Thrift::Struct, ::Thrift::Struct_Union
66
+ SUCCESS = 0
67
+
68
+ FIELDS = {
69
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ElasticSearch::Thrift::RestResponse}
70
+ }
71
+
72
+ def struct_fields; FIELDS; end
73
+
74
+ def validate
75
+ end
76
+
77
+ ::Thrift::Struct.generate_accessors self
78
+ end
79
+
80
+ end
81
+
82
+ end
83
+ end
@@ -0,0 +1,81 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{lowang-rubberband}
8
+ s.version = "0.0.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["grantr"]
12
+ s.date = %q{2010-11-26}
13
+ s.description = %q{An ElasticSearch Client with ThriftClient-like failover handling.}
14
+ s.email = %q{grantr@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc",
18
+ "TODO"
19
+ ]
20
+ s.files = [
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "TODO",
25
+ "VERSION",
26
+ "lib/elasticsearch.rb",
27
+ "lib/elasticsearch/client.rb",
28
+ "lib/elasticsearch/client/abstract_client.rb",
29
+ "lib/elasticsearch/client/admin_cluster.rb",
30
+ "lib/elasticsearch/client/admin_index.rb",
31
+ "lib/elasticsearch/client/auto_discovering_client.rb",
32
+ "lib/elasticsearch/client/default_scope.rb",
33
+ "lib/elasticsearch/client/hits.rb",
34
+ "lib/elasticsearch/client/index.rb",
35
+ "lib/elasticsearch/client/retrying_client.rb",
36
+ "lib/elasticsearch/encoding.rb",
37
+ "lib/elasticsearch/encoding/base.rb",
38
+ "lib/elasticsearch/encoding/json.rb",
39
+ "lib/elasticsearch/transport.rb",
40
+ "lib/elasticsearch/transport/base.rb",
41
+ "lib/elasticsearch/transport/base_protocol.rb",
42
+ "lib/elasticsearch/transport/http.rb",
43
+ "lib/elasticsearch/transport/thrift.rb",
44
+ "lib/elasticsearch/transport/thrift/elasticsearch.thrift",
45
+ "lib/elasticsearch/transport/thrift/elasticsearch_constants.rb",
46
+ "lib/elasticsearch/transport/thrift/elasticsearch_types.rb",
47
+ "lib/elasticsearch/transport/thrift/rest.rb",
48
+ "lowang-rubberband.gemspec",
49
+ "rubberband.gemspec",
50
+ "test/elasticsearch_test.rb",
51
+ "test/test_helper.rb"
52
+ ]
53
+ s.homepage = %q{http://github.com/grantr/rubberband}
54
+ s.require_paths = ["lib"]
55
+ s.rubygems_version = %q{1.3.7}
56
+ s.summary = %q{An ElasticSearch client.}
57
+ s.test_files = [
58
+ "test/elasticsearch_test.rb",
59
+ "test/test_helper.rb"
60
+ ]
61
+
62
+ if s.respond_to? :specification_version then
63
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
64
+ s.specification_version = 3
65
+
66
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
67
+ s.add_runtime_dependency(%q<patron>, [">= 0"])
68
+ s.add_runtime_dependency(%q<yajl-ruby>, [">= 0"])
69
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
70
+ else
71
+ s.add_dependency(%q<patron>, [">= 0"])
72
+ s.add_dependency(%q<yajl-ruby>, [">= 0"])
73
+ s.add_dependency(%q<shoulda>, [">= 0"])
74
+ end
75
+ else
76
+ s.add_dependency(%q<patron>, [">= 0"])
77
+ s.add_dependency(%q<yajl-ruby>, [">= 0"])
78
+ s.add_dependency(%q<shoulda>, [">= 0"])
79
+ end
80
+ end
81
+
@@ -0,0 +1,80 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{rubberband}
8
+ s.version = "0.0.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["grantr"]
12
+ s.date = %q{2010-09-30}
13
+ s.description = %q{An ElasticSearch Client with ThriftClient-like failover handling.}
14
+ s.email = %q{grantr@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "TODO",
25
+ "VERSION",
26
+ "lib/elasticsearch.rb",
27
+ "lib/elasticsearch/client.rb",
28
+ "lib/elasticsearch/client/abstract_client.rb",
29
+ "lib/elasticsearch/client/admin_cluster.rb",
30
+ "lib/elasticsearch/client/admin_index.rb",
31
+ "lib/elasticsearch/client/auto_discovering_client.rb",
32
+ "lib/elasticsearch/client/default_scope.rb",
33
+ "lib/elasticsearch/client/hits.rb",
34
+ "lib/elasticsearch/client/index.rb",
35
+ "lib/elasticsearch/client/retrying_client.rb",
36
+ "lib/elasticsearch/encoding.rb",
37
+ "lib/elasticsearch/encoding/base.rb",
38
+ "lib/elasticsearch/encoding/json.rb",
39
+ "lib/elasticsearch/transport.rb",
40
+ "lib/elasticsearch/transport/base.rb",
41
+ "lib/elasticsearch/transport/base_protocol.rb",
42
+ "lib/elasticsearch/transport/http.rb",
43
+ "lib/elasticsearch/transport/thrift.rb",
44
+ "lib/elasticsearch/transport/thrift/elasticsearch.thrift",
45
+ "lib/elasticsearch/transport/thrift/elasticsearch_constants.rb",
46
+ "lib/elasticsearch/transport/thrift/elasticsearch_types.rb",
47
+ "lib/elasticsearch/transport/thrift/rest.rb",
48
+ "rubberband.gemspec",
49
+ "test/elasticsearch_test.rb",
50
+ "test/test_helper.rb"
51
+ ]
52
+ s.homepage = %q{http://github.com/grantr/rubberband}
53
+ s.rdoc_options = ["--charset=UTF-8"]
54
+ s.require_paths = ["lib"]
55
+ s.rubygems_version = %q{1.3.7}
56
+ s.summary = %q{An ElasticSearch client.}
57
+ s.test_files = [
58
+ "test/elasticsearch_test.rb",
59
+ "test/test_helper.rb"
60
+ ]
61
+
62
+ if s.respond_to? :specification_version then
63
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
64
+ s.specification_version = 3
65
+
66
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
67
+ s.add_runtime_dependency(%q<patron>, [">= 0"])
68
+ s.add_runtime_dependency(%q<yajl-ruby>, [">= 0"])
69
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
70
+ else
71
+ s.add_dependency(%q<patron>, [">= 0"])
72
+ s.add_dependency(%q<yajl-ruby>, [">= 0"])
73
+ s.add_dependency(%q<shoulda>, [">= 0"])
74
+ end
75
+ else
76
+ s.add_dependency(%q<patron>, [">= 0"])
77
+ s.add_dependency(%q<yajl-ruby>, [">= 0"])
78
+ s.add_dependency(%q<shoulda>, [">= 0"])
79
+ end
80
+ end