cassandra-driver 0.1.0.alpha1 → 1.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +4 -0
- data/README.md +117 -0
- data/lib/cassandra.rb +320 -0
- data/lib/cassandra/auth.rb +97 -0
- data/lib/cassandra/auth/providers.rb +16 -0
- data/lib/cassandra/auth/providers/password.rb +73 -0
- data/lib/cassandra/client.rb +144 -0
- data/lib/cassandra/client/batch.rb +212 -0
- data/lib/cassandra/client/client.rb +591 -0
- data/lib/cassandra/client/column_metadata.rb +54 -0
- data/lib/cassandra/client/connection_manager.rb +72 -0
- data/lib/cassandra/client/connector.rb +272 -0
- data/lib/cassandra/client/execute_options_decoder.rb +59 -0
- data/lib/cassandra/client/null_logger.rb +37 -0
- data/lib/cassandra/client/peer_discovery.rb +50 -0
- data/lib/cassandra/client/prepared_statement.rb +314 -0
- data/lib/cassandra/client/query_result.rb +230 -0
- data/lib/cassandra/client/request_runner.rb +71 -0
- data/lib/cassandra/client/result_metadata.rb +48 -0
- data/lib/cassandra/client/void_result.rb +78 -0
- data/lib/cassandra/cluster.rb +191 -0
- data/lib/cassandra/cluster/client.rb +767 -0
- data/lib/cassandra/cluster/connector.rb +231 -0
- data/lib/cassandra/cluster/control_connection.rb +420 -0
- data/lib/cassandra/cluster/options.rb +40 -0
- data/lib/cassandra/cluster/registry.rb +181 -0
- data/lib/cassandra/cluster/schema.rb +321 -0
- data/lib/cassandra/cluster/schema/type_parser.rb +138 -0
- data/lib/cassandra/column.rb +92 -0
- data/lib/cassandra/compression.rb +66 -0
- data/lib/cassandra/compression/compressors/lz4.rb +72 -0
- data/lib/cassandra/compression/compressors/snappy.rb +66 -0
- data/lib/cassandra/driver.rb +86 -0
- data/lib/cassandra/errors.rb +79 -0
- data/lib/cassandra/execution/info.rb +51 -0
- data/lib/cassandra/execution/options.rb +77 -0
- data/lib/cassandra/execution/trace.rb +152 -0
- data/lib/cassandra/future.rb +675 -0
- data/lib/cassandra/host.rb +75 -0
- data/lib/cassandra/keyspace.rb +120 -0
- data/lib/cassandra/listener.rb +87 -0
- data/lib/cassandra/load_balancing.rb +112 -0
- data/lib/cassandra/load_balancing/policies.rb +18 -0
- data/lib/cassandra/load_balancing/policies/dc_aware_round_robin.rb +149 -0
- data/lib/cassandra/load_balancing/policies/round_robin.rb +95 -0
- data/lib/cassandra/load_balancing/policies/white_list.rb +90 -0
- data/lib/cassandra/protocol.rb +93 -0
- data/lib/cassandra/protocol/cql_byte_buffer.rb +307 -0
- data/lib/cassandra/protocol/cql_protocol_handler.rb +323 -0
- data/lib/cassandra/protocol/frame_decoder.rb +128 -0
- data/lib/cassandra/protocol/frame_encoder.rb +48 -0
- data/lib/cassandra/protocol/request.rb +38 -0
- data/lib/cassandra/protocol/requests/auth_response_request.rb +47 -0
- data/lib/cassandra/protocol/requests/batch_request.rb +76 -0
- data/lib/cassandra/protocol/requests/credentials_request.rb +47 -0
- data/lib/cassandra/protocol/requests/execute_request.rb +103 -0
- data/lib/cassandra/protocol/requests/options_request.rb +39 -0
- data/lib/cassandra/protocol/requests/prepare_request.rb +50 -0
- data/lib/cassandra/protocol/requests/query_request.rb +153 -0
- data/lib/cassandra/protocol/requests/register_request.rb +38 -0
- data/lib/cassandra/protocol/requests/startup_request.rb +49 -0
- data/lib/cassandra/protocol/requests/void_query_request.rb +24 -0
- data/lib/cassandra/protocol/response.rb +38 -0
- data/lib/cassandra/protocol/responses/auth_challenge_response.rb +41 -0
- data/lib/cassandra/protocol/responses/auth_success_response.rb +41 -0
- data/lib/cassandra/protocol/responses/authenticate_response.rb +41 -0
- data/lib/cassandra/protocol/responses/detailed_error_response.rb +60 -0
- data/lib/cassandra/protocol/responses/error_response.rb +50 -0
- data/lib/cassandra/protocol/responses/event_response.rb +39 -0
- data/lib/cassandra/protocol/responses/prepared_result_response.rb +64 -0
- data/lib/cassandra/protocol/responses/raw_rows_result_response.rb +43 -0
- data/lib/cassandra/protocol/responses/ready_response.rb +44 -0
- data/lib/cassandra/protocol/responses/result_response.rb +48 -0
- data/lib/cassandra/protocol/responses/rows_result_response.rb +139 -0
- data/lib/cassandra/protocol/responses/schema_change_event_response.rb +60 -0
- data/lib/cassandra/protocol/responses/schema_change_result_response.rb +57 -0
- data/lib/cassandra/protocol/responses/set_keyspace_result_response.rb +42 -0
- data/lib/cassandra/protocol/responses/status_change_event_response.rb +44 -0
- data/lib/cassandra/protocol/responses/supported_response.rb +41 -0
- data/lib/cassandra/protocol/responses/topology_change_event_response.rb +34 -0
- data/lib/cassandra/protocol/responses/void_result_response.rb +39 -0
- data/lib/cassandra/protocol/type_converter.rb +384 -0
- data/lib/cassandra/reconnection.rb +49 -0
- data/lib/cassandra/reconnection/policies.rb +20 -0
- data/lib/cassandra/reconnection/policies/constant.rb +48 -0
- data/lib/cassandra/reconnection/policies/exponential.rb +79 -0
- data/lib/cassandra/result.rb +215 -0
- data/lib/cassandra/retry.rb +142 -0
- data/lib/cassandra/retry/policies.rb +21 -0
- data/lib/cassandra/retry/policies/default.rb +47 -0
- data/lib/cassandra/retry/policies/downgrading_consistency.rb +71 -0
- data/lib/cassandra/retry/policies/fallthrough.rb +39 -0
- data/lib/cassandra/session.rb +195 -0
- data/lib/cassandra/statement.rb +22 -0
- data/lib/cassandra/statements.rb +23 -0
- data/lib/cassandra/statements/batch.rb +95 -0
- data/lib/cassandra/statements/bound.rb +46 -0
- data/lib/cassandra/statements/prepared.rb +59 -0
- data/lib/cassandra/statements/simple.rb +58 -0
- data/lib/cassandra/statements/void.rb +33 -0
- data/lib/cassandra/table.rb +254 -0
- data/lib/cassandra/time_uuid.rb +141 -0
- data/lib/cassandra/util.rb +169 -0
- data/lib/cassandra/uuid.rb +104 -0
- data/lib/cassandra/version.rb +17 -1
- metadata +134 -8
@@ -0,0 +1,141 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
#--
|
4
|
+
# Copyright 2013-2014 DataStax, Inc.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#++
|
18
|
+
|
19
|
+
module Cassandra
|
20
|
+
# A variant of UUID which can extract its time component.
|
21
|
+
#
|
22
|
+
class TimeUuid < Uuid
|
23
|
+
include Comparable
|
24
|
+
|
25
|
+
# Returns the time component from this UUID as a Time.
|
26
|
+
#
|
27
|
+
# @return [Time]
|
28
|
+
def to_time
|
29
|
+
t = time_bits - GREGORIAN_OFFSET
|
30
|
+
seconds = t/10_000_000
|
31
|
+
microseconds = (t - seconds * 10_000_000)/10.0
|
32
|
+
Time.at(seconds, microseconds).utc
|
33
|
+
end
|
34
|
+
|
35
|
+
def <=>(other)
|
36
|
+
c = self.value <=> other.value
|
37
|
+
return c if c == 0
|
38
|
+
self.time_bits <=> other.time_bits
|
39
|
+
end
|
40
|
+
|
41
|
+
protected
|
42
|
+
|
43
|
+
def time_bits
|
44
|
+
n = (value >> 64)
|
45
|
+
t = 0
|
46
|
+
t |= (n & 0x0000000000000fff) << 48
|
47
|
+
t |= (n & 0x00000000ffff0000) << 16
|
48
|
+
t |= (n & 0xffffffff00000000) >> 32
|
49
|
+
t
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
# @private
|
55
|
+
LOWER_HALF_MASK = 0xffffffff_ffffffff
|
56
|
+
|
57
|
+
public
|
58
|
+
|
59
|
+
# A UUID version 1, variant 1 generator. It can generate a sequence of UUIDs
|
60
|
+
# with reasonable uniqueness guarantees:
|
61
|
+
#
|
62
|
+
# * The clock ID and node ID components are set to random numbers when the
|
63
|
+
# generator is created.
|
64
|
+
# * If two calls to {#next} happen within the time afforded by the system
|
65
|
+
# clock resolution a counter is incremented and added to the time
|
66
|
+
# component.
|
67
|
+
# * If the clock moves backwards the clock ID is reset to a new random
|
68
|
+
# number.
|
69
|
+
#
|
70
|
+
# Instances of this class are absolutely not threadsafe. You should
|
71
|
+
# never share instances between threads.
|
72
|
+
#
|
73
|
+
class Generator
|
74
|
+
# Create a new UUID generator.
|
75
|
+
#
|
76
|
+
# @param [Integer] node_id an alternate node ID (defaults to a random number)
|
77
|
+
# @param [Integer] clock_id an alternate clock ID (defaults to a random number)
|
78
|
+
#
|
79
|
+
def initialize(node_id=nil, clock_id=nil, clock=Time)
|
80
|
+
@node_id = node_id || (rand(2**47) | 0x010000000000)
|
81
|
+
@clock_id = clock_id || rand(2**16)
|
82
|
+
@clock = clock
|
83
|
+
end
|
84
|
+
|
85
|
+
# Returns a new UUID with a time component that is the current time.
|
86
|
+
#
|
87
|
+
# @return [Cassandra::TimeUuid] a new UUID
|
88
|
+
#
|
89
|
+
def next
|
90
|
+
now = @clock.now
|
91
|
+
usecs = now.to_i * 1_000_000 + now.usec
|
92
|
+
if @last_usecs && @last_usecs - @sequence <= usecs && usecs <= @last_usecs
|
93
|
+
@sequence += 1
|
94
|
+
elsif @last_usecs && @last_usecs > usecs
|
95
|
+
@sequence = 0
|
96
|
+
@clock_id = rand(2**16)
|
97
|
+
else
|
98
|
+
@sequence = 0
|
99
|
+
end
|
100
|
+
@last_usecs = usecs + @sequence
|
101
|
+
from_usecs(@last_usecs)
|
102
|
+
end
|
103
|
+
|
104
|
+
# Returns a new UUID with a time component based on the specified Time.
|
105
|
+
# A piece of jitter is added to ensure that multiple calls with the same
|
106
|
+
# time do not generate the same UUID (if you want determinism you can set
|
107
|
+
# the second parameter to zero).
|
108
|
+
#
|
109
|
+
# @param [Time] time the time to encode into the UUID
|
110
|
+
# @param [Integer] jitter a number of microseconds to add to the time to make it unique
|
111
|
+
# @return [Cassandra::TimeUuid] a new UUID
|
112
|
+
#
|
113
|
+
def from_time(time, jitter=rand(2**16))
|
114
|
+
usecs = time.to_i * 1_000_000 + time.usec + jitter
|
115
|
+
from_usecs(usecs)
|
116
|
+
end
|
117
|
+
|
118
|
+
# @private
|
119
|
+
def from_usecs(usecs)
|
120
|
+
t = GREGORIAN_OFFSET + usecs * 10
|
121
|
+
time_hi = t & 0x0fff000000000000
|
122
|
+
time_mid = t & 0x0000ffff00000000
|
123
|
+
time_low = t & 0x00000000ffffffff
|
124
|
+
version = 1
|
125
|
+
clock_id = @clock_id & 0x3fff
|
126
|
+
node_id = @node_id & 0xffffffffffff
|
127
|
+
variant = 0x8000
|
128
|
+
n = (time_low << 96) | (time_mid << 48) | (time_hi << 16)
|
129
|
+
n |= version << 76
|
130
|
+
n |= (clock_id | variant) << 48
|
131
|
+
n |= node_id
|
132
|
+
TimeUuid.new(n)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
private
|
137
|
+
|
138
|
+
# @private
|
139
|
+
GREGORIAN_OFFSET = 122192928000000000
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
#--
|
4
|
+
# Copyright 2013-2014 DataStax, Inc.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#++
|
18
|
+
|
19
|
+
require 'stringio'
|
20
|
+
|
21
|
+
module Cassandra
|
22
|
+
# @private
|
23
|
+
module Util extend self
|
24
|
+
def encode_hash(hash, io = StringIO.new)
|
25
|
+
first = true
|
26
|
+
|
27
|
+
io.putc(CRL_OPN)
|
28
|
+
hash.each do |k, v|
|
29
|
+
if first
|
30
|
+
first = false
|
31
|
+
else
|
32
|
+
io.print(COMMA)
|
33
|
+
end
|
34
|
+
|
35
|
+
encode_object(k, io)
|
36
|
+
io.print(COLON)
|
37
|
+
encode_object(v, io)
|
38
|
+
end
|
39
|
+
io.putc(CRL_CLS)
|
40
|
+
|
41
|
+
io.string
|
42
|
+
end
|
43
|
+
|
44
|
+
def encode_set(set, io = StringIO.new)
|
45
|
+
first = true
|
46
|
+
|
47
|
+
io.putc(CRL_OPN)
|
48
|
+
set.each do |object|
|
49
|
+
if first
|
50
|
+
first = false
|
51
|
+
else
|
52
|
+
io.print(COMMA)
|
53
|
+
end
|
54
|
+
|
55
|
+
encode_object(object, io)
|
56
|
+
end
|
57
|
+
io.putc(CRL_CLS)
|
58
|
+
|
59
|
+
io.string
|
60
|
+
end
|
61
|
+
|
62
|
+
def encode_array(array, io = StringIO.new)
|
63
|
+
first = true
|
64
|
+
|
65
|
+
io.putc(SQR_OPN)
|
66
|
+
array.each do |object|
|
67
|
+
if first
|
68
|
+
first = false
|
69
|
+
else
|
70
|
+
io.print(COMMA)
|
71
|
+
end
|
72
|
+
|
73
|
+
encode_object(object, io)
|
74
|
+
end
|
75
|
+
io.putc(SQR_CLS)
|
76
|
+
|
77
|
+
io.string
|
78
|
+
end
|
79
|
+
|
80
|
+
def encode_string(string, io = StringIO.new)
|
81
|
+
io.putc(QUOT)
|
82
|
+
string.chars do |c|
|
83
|
+
case c
|
84
|
+
when QUOT then io.print(ESC_QUOT)
|
85
|
+
else
|
86
|
+
io.putc(c)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
io.putc(QUOT)
|
90
|
+
|
91
|
+
io.string
|
92
|
+
end
|
93
|
+
|
94
|
+
def encode_object(object, io = StringIO.new)
|
95
|
+
case object
|
96
|
+
when ::Hash then encode_hash(object, io)
|
97
|
+
when ::Array then encode_array(object, io)
|
98
|
+
when ::Set then encode_set(object, io)
|
99
|
+
when ::String then encode_string(object, io)
|
100
|
+
when ::Time then encode_timestamp(object, io)
|
101
|
+
when ::Numeric then encode_number(object, io)
|
102
|
+
when ::IPAddr then encode_inet(object, io)
|
103
|
+
when Uuid then encode_uuid(object, io)
|
104
|
+
when nil then io.print(NULL_STR)
|
105
|
+
when false then io.print(FALSE_STR)
|
106
|
+
when true then io.print(TRUE_STR)
|
107
|
+
else
|
108
|
+
raise "unsupported type: #{object.inspect}"
|
109
|
+
end
|
110
|
+
|
111
|
+
io.string
|
112
|
+
end
|
113
|
+
alias :encode :encode_object
|
114
|
+
|
115
|
+
def encode_timestamp(time, io = StringIO.new)
|
116
|
+
io.print(time.to_i)
|
117
|
+
io.string
|
118
|
+
end
|
119
|
+
|
120
|
+
def encode_number(number, io = StringIO.new)
|
121
|
+
io.print(number)
|
122
|
+
io.string
|
123
|
+
end
|
124
|
+
|
125
|
+
def encode_uuid(uuid, io = StringIO.new)
|
126
|
+
io.print(uuid)
|
127
|
+
io.string
|
128
|
+
end
|
129
|
+
|
130
|
+
def encode_inet(inet, io = StringIO.new)
|
131
|
+
io.putc(QUOT)
|
132
|
+
io.print(inet)
|
133
|
+
io.putc(QUOT)
|
134
|
+
io.string
|
135
|
+
end
|
136
|
+
|
137
|
+
def escape_name(name)
|
138
|
+
return name if name[LOWERCASE_REGEXP] == name
|
139
|
+
DBL_QUOT + name + DBL_QUOT
|
140
|
+
end
|
141
|
+
|
142
|
+
# @private
|
143
|
+
LOWERCASE_REGEXP = /[[:lower:]\_]*/
|
144
|
+
# @private
|
145
|
+
NULL_STR = 'null'.freeze
|
146
|
+
# @private
|
147
|
+
FALSE_STR = 'false'.freeze
|
148
|
+
# @private
|
149
|
+
TRUE_STR = 'true'.freeze
|
150
|
+
# @private
|
151
|
+
CRL_OPN = '{'.freeze
|
152
|
+
# @private
|
153
|
+
CRL_CLS = '}'.freeze
|
154
|
+
# @private
|
155
|
+
SQR_OPN = '['.freeze
|
156
|
+
# @private
|
157
|
+
SQR_CLS = ']'.freeze
|
158
|
+
# @private
|
159
|
+
COMMA = ', '.freeze
|
160
|
+
# @private
|
161
|
+
COLON = ' : '.freeze
|
162
|
+
# @private
|
163
|
+
QUOT = ?'.freeze
|
164
|
+
# @private
|
165
|
+
ESC_QUOT = "''".freeze
|
166
|
+
# @private
|
167
|
+
DBL_QUOT = ?".freeze
|
168
|
+
end
|
169
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
#--
|
4
|
+
# Copyright 2013-2014 DataStax, Inc.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#++
|
18
|
+
|
19
|
+
module Cassandra
|
20
|
+
# Represents a UUID value.
|
21
|
+
#
|
22
|
+
# This is a very basic implementation of UUIDs and exists more or less just
|
23
|
+
# to encode and decode UUIDs from and to Cassandra.
|
24
|
+
#
|
25
|
+
# If you want to generate UUIDs see {Cassandra::TimeUuid::Generator}.
|
26
|
+
#
|
27
|
+
class Uuid
|
28
|
+
# Creates a new UUID either from a string (expected to be on the standard 8-4-4-4-12 form, or just 32 characters without hyphens), or from a 128 bit number.
|
29
|
+
#
|
30
|
+
# @param uuid [String] a 32 char uuid
|
31
|
+
#
|
32
|
+
# @raise [ArgumentError] if the string does not conform to the expected format
|
33
|
+
#
|
34
|
+
def initialize(uuid)
|
35
|
+
case uuid
|
36
|
+
when String
|
37
|
+
@n = from_s(uuid)
|
38
|
+
else
|
39
|
+
@n = uuid
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Returns a string representation of this UUID in the standard 8-4-4-4-12 form.
|
44
|
+
#
|
45
|
+
def to_s
|
46
|
+
@s ||= begin
|
47
|
+
s = RAW_FORMAT % @n
|
48
|
+
s.insert(20, HYPHEN)
|
49
|
+
s.insert(16, HYPHEN)
|
50
|
+
s.insert(12, HYPHEN)
|
51
|
+
s.insert( 8, HYPHEN)
|
52
|
+
s
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def hash
|
57
|
+
@n.hash
|
58
|
+
end
|
59
|
+
|
60
|
+
# Returns the numerical representation of this UUID
|
61
|
+
#
|
62
|
+
# @return [Bignum] the 128 bit numerical representation
|
63
|
+
#
|
64
|
+
def value
|
65
|
+
@n
|
66
|
+
end
|
67
|
+
alias_method :to_i, :value
|
68
|
+
|
69
|
+
# @private
|
70
|
+
def eql?(other)
|
71
|
+
other.respond_to?(:value) && self.value == other.value
|
72
|
+
end
|
73
|
+
alias_method :==, :eql?
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
# @private
|
78
|
+
RAW_FORMAT = '%032x'.force_encoding(Encoding::ASCII).freeze
|
79
|
+
# @private
|
80
|
+
HYPHEN = '-'.force_encoding(Encoding::ASCII).freeze
|
81
|
+
# @private
|
82
|
+
EMPTY_STRING = ''.freeze
|
83
|
+
|
84
|
+
if RUBY_ENGINE == 'jruby'
|
85
|
+
# @private
|
86
|
+
HEX_RE = /^[A-Fa-f0-9]+$/
|
87
|
+
# See https://github.com/jruby/jruby/issues/1608
|
88
|
+
# @private
|
89
|
+
def from_s(str)
|
90
|
+
str = str.gsub(HYPHEN, EMPTY_STRING)
|
91
|
+
raise ArgumentError, "Expected 32 hexadecimal digits but got #{str.length}" unless str.length == 32
|
92
|
+
raise ArgumentError, "invalid value for Integer(): \"#{str}\"" unless str =~ HEX_RE
|
93
|
+
Integer(str, 16)
|
94
|
+
end
|
95
|
+
else
|
96
|
+
# @private
|
97
|
+
def from_s(str)
|
98
|
+
str = str.gsub(HYPHEN, EMPTY_STRING)
|
99
|
+
raise ArgumentError, "Expected 32 hexadecimal digits but got #{str.length}" unless str.length == 32
|
100
|
+
Integer(str, 16)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
data/lib/cassandra/version.rb
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
#--
|
4
|
+
# Copyright 2013-2014 DataStax, Inc.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#++
|
18
|
+
|
3
19
|
module Cassandra
|
4
|
-
VERSION = '
|
20
|
+
VERSION = '1.0.0.beta.1'.freeze
|
5
21
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cassandra-driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version:
|
5
|
+
version: 1.0.0.beta.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Theo Hultberg
|
@@ -10,8 +10,24 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-09-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ione
|
17
|
+
type: :runtime
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '1.0'
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '1.0'
|
15
31
|
- !ruby/object:Gem::Dependency
|
16
32
|
name: bundler
|
17
33
|
type: :development
|
@@ -44,20 +60,130 @@ dependencies:
|
|
44
60
|
- - ~>
|
45
61
|
- !ruby/object:Gem::Version
|
46
62
|
version: '10.0'
|
47
|
-
description: A pure Ruby driver for Cassandra
|
63
|
+
description: A pure Ruby driver for Apache Cassandra
|
48
64
|
email:
|
49
65
|
- theo@iconara.net
|
50
66
|
- bulat.shakirzyanov@datastax.com
|
51
67
|
executables: []
|
52
68
|
extensions: []
|
53
|
-
extra_rdoc_files:
|
69
|
+
extra_rdoc_files:
|
70
|
+
- README.md
|
54
71
|
files:
|
72
|
+
- lib/cassandra/auth/providers/password.rb
|
73
|
+
- lib/cassandra/auth/providers.rb
|
74
|
+
- lib/cassandra/auth.rb
|
75
|
+
- lib/cassandra/client/batch.rb
|
76
|
+
- lib/cassandra/client/client.rb
|
77
|
+
- lib/cassandra/client/column_metadata.rb
|
78
|
+
- lib/cassandra/client/connection_manager.rb
|
79
|
+
- lib/cassandra/client/connector.rb
|
80
|
+
- lib/cassandra/client/execute_options_decoder.rb
|
81
|
+
- lib/cassandra/client/null_logger.rb
|
82
|
+
- lib/cassandra/client/peer_discovery.rb
|
83
|
+
- lib/cassandra/client/prepared_statement.rb
|
84
|
+
- lib/cassandra/client/query_result.rb
|
85
|
+
- lib/cassandra/client/request_runner.rb
|
86
|
+
- lib/cassandra/client/result_metadata.rb
|
87
|
+
- lib/cassandra/client/void_result.rb
|
88
|
+
- lib/cassandra/client.rb
|
89
|
+
- lib/cassandra/cluster/client.rb
|
90
|
+
- lib/cassandra/cluster/connector.rb
|
91
|
+
- lib/cassandra/cluster/control_connection.rb
|
92
|
+
- lib/cassandra/cluster/options.rb
|
93
|
+
- lib/cassandra/cluster/registry.rb
|
94
|
+
- lib/cassandra/cluster/schema/type_parser.rb
|
95
|
+
- lib/cassandra/cluster/schema.rb
|
96
|
+
- lib/cassandra/cluster.rb
|
97
|
+
- lib/cassandra/column.rb
|
98
|
+
- lib/cassandra/compression/compressors/lz4.rb
|
99
|
+
- lib/cassandra/compression/compressors/snappy.rb
|
100
|
+
- lib/cassandra/compression.rb
|
101
|
+
- lib/cassandra/driver.rb
|
102
|
+
- lib/cassandra/errors.rb
|
103
|
+
- lib/cassandra/execution/info.rb
|
104
|
+
- lib/cassandra/execution/options.rb
|
105
|
+
- lib/cassandra/execution/trace.rb
|
106
|
+
- lib/cassandra/future.rb
|
107
|
+
- lib/cassandra/host.rb
|
108
|
+
- lib/cassandra/keyspace.rb
|
109
|
+
- lib/cassandra/listener.rb
|
110
|
+
- lib/cassandra/load_balancing/policies/dc_aware_round_robin.rb
|
111
|
+
- lib/cassandra/load_balancing/policies/round_robin.rb
|
112
|
+
- lib/cassandra/load_balancing/policies/white_list.rb
|
113
|
+
- lib/cassandra/load_balancing/policies.rb
|
114
|
+
- lib/cassandra/load_balancing.rb
|
115
|
+
- lib/cassandra/protocol/cql_byte_buffer.rb
|
116
|
+
- lib/cassandra/protocol/cql_protocol_handler.rb
|
117
|
+
- lib/cassandra/protocol/frame_decoder.rb
|
118
|
+
- lib/cassandra/protocol/frame_encoder.rb
|
119
|
+
- lib/cassandra/protocol/request.rb
|
120
|
+
- lib/cassandra/protocol/requests/auth_response_request.rb
|
121
|
+
- lib/cassandra/protocol/requests/batch_request.rb
|
122
|
+
- lib/cassandra/protocol/requests/credentials_request.rb
|
123
|
+
- lib/cassandra/protocol/requests/execute_request.rb
|
124
|
+
- lib/cassandra/protocol/requests/options_request.rb
|
125
|
+
- lib/cassandra/protocol/requests/prepare_request.rb
|
126
|
+
- lib/cassandra/protocol/requests/query_request.rb
|
127
|
+
- lib/cassandra/protocol/requests/register_request.rb
|
128
|
+
- lib/cassandra/protocol/requests/startup_request.rb
|
129
|
+
- lib/cassandra/protocol/requests/void_query_request.rb
|
130
|
+
- lib/cassandra/protocol/response.rb
|
131
|
+
- lib/cassandra/protocol/responses/auth_challenge_response.rb
|
132
|
+
- lib/cassandra/protocol/responses/auth_success_response.rb
|
133
|
+
- lib/cassandra/protocol/responses/authenticate_response.rb
|
134
|
+
- lib/cassandra/protocol/responses/detailed_error_response.rb
|
135
|
+
- lib/cassandra/protocol/responses/error_response.rb
|
136
|
+
- lib/cassandra/protocol/responses/event_response.rb
|
137
|
+
- lib/cassandra/protocol/responses/prepared_result_response.rb
|
138
|
+
- lib/cassandra/protocol/responses/raw_rows_result_response.rb
|
139
|
+
- lib/cassandra/protocol/responses/ready_response.rb
|
140
|
+
- lib/cassandra/protocol/responses/result_response.rb
|
141
|
+
- lib/cassandra/protocol/responses/rows_result_response.rb
|
142
|
+
- lib/cassandra/protocol/responses/schema_change_event_response.rb
|
143
|
+
- lib/cassandra/protocol/responses/schema_change_result_response.rb
|
144
|
+
- lib/cassandra/protocol/responses/set_keyspace_result_response.rb
|
145
|
+
- lib/cassandra/protocol/responses/status_change_event_response.rb
|
146
|
+
- lib/cassandra/protocol/responses/supported_response.rb
|
147
|
+
- lib/cassandra/protocol/responses/topology_change_event_response.rb
|
148
|
+
- lib/cassandra/protocol/responses/void_result_response.rb
|
149
|
+
- lib/cassandra/protocol/type_converter.rb
|
150
|
+
- lib/cassandra/protocol.rb
|
151
|
+
- lib/cassandra/reconnection/policies/constant.rb
|
152
|
+
- lib/cassandra/reconnection/policies/exponential.rb
|
153
|
+
- lib/cassandra/reconnection/policies.rb
|
154
|
+
- lib/cassandra/reconnection.rb
|
155
|
+
- lib/cassandra/result.rb
|
156
|
+
- lib/cassandra/retry/policies/default.rb
|
157
|
+
- lib/cassandra/retry/policies/downgrading_consistency.rb
|
158
|
+
- lib/cassandra/retry/policies/fallthrough.rb
|
159
|
+
- lib/cassandra/retry/policies.rb
|
160
|
+
- lib/cassandra/retry.rb
|
161
|
+
- lib/cassandra/session.rb
|
162
|
+
- lib/cassandra/statement.rb
|
163
|
+
- lib/cassandra/statements/batch.rb
|
164
|
+
- lib/cassandra/statements/bound.rb
|
165
|
+
- lib/cassandra/statements/prepared.rb
|
166
|
+
- lib/cassandra/statements/simple.rb
|
167
|
+
- lib/cassandra/statements/void.rb
|
168
|
+
- lib/cassandra/statements.rb
|
169
|
+
- lib/cassandra/table.rb
|
170
|
+
- lib/cassandra/time_uuid.rb
|
171
|
+
- lib/cassandra/util.rb
|
172
|
+
- lib/cassandra/uuid.rb
|
55
173
|
- lib/cassandra/version.rb
|
56
|
-
|
174
|
+
- lib/cassandra.rb
|
175
|
+
- README.md
|
176
|
+
- .yardopts
|
177
|
+
homepage: http://datastax.github.io/ruby-driver
|
57
178
|
licenses:
|
58
179
|
- Apache License 2.0
|
59
180
|
post_install_message:
|
60
|
-
rdoc_options:
|
181
|
+
rdoc_options:
|
182
|
+
- --title
|
183
|
+
- Datastax Ruby Driver
|
184
|
+
- --main
|
185
|
+
- README.md
|
186
|
+
- --line-numbers
|
61
187
|
require_paths:
|
62
188
|
- lib
|
63
189
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -65,7 +191,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
191
|
requirements:
|
66
192
|
- - '>='
|
67
193
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
194
|
+
version: 1.9.3
|
69
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
196
|
none: false
|
71
197
|
requirements:
|
@@ -77,6 +203,6 @@ rubyforge_project:
|
|
77
203
|
rubygems_version: 1.8.23
|
78
204
|
signing_key:
|
79
205
|
specification_version: 3
|
80
|
-
summary: Cassandra
|
206
|
+
summary: Datastax Ruby Driver for Apache Cassandra
|
81
207
|
test_files: []
|
82
208
|
has_rdoc:
|