Permalink
Browse files

prep for 0.7.2 release

  • Loading branch information...
1 parent 30ac546 commit 7a28cfac0d05eae6498414a1d369a5e785f42ca3 @ryanking ryanking committed Jan 25, 2010
Showing with 52 additions and 119 deletions.
  1. +2 −0 CHANGELOG
  2. +2 −2 Manifest
  3. +1 −2 Rakefile
  4. +47 −0 cassandra.gemspec
  5. +0 −115 lib/cassandra/uuid.rb
View
@@ -1,3 +1,5 @@
+v0.7.2 Switch to newly-extraced simple_uuid gem, minor bugfixes.
+
v0.7.1 update thrift-generated code to 0.5
v0.7 Various improvements.
View
@@ -1,7 +1,7 @@
CHANGELOG
LICENSE
Manifest
-README
+README.mkd
Rakefile
bin/cassandra_helper
conf/cassandra.in.sh
@@ -18,9 +18,9 @@ lib/cassandra/long.rb
lib/cassandra/ordered_hash.rb
lib/cassandra/protocol.rb
lib/cassandra/time.rb
-lib/cassandra/uuid.rb
test/cassandra_test.rb
test/comparable_types_test.rb
+test/ordered_hash_test.rb
test/test_helper.rb
vendor/gen-rb/cassandra.rb
vendor/gen-rb/cassandra_constants.rb
View
@@ -1,4 +1,3 @@
-
unless ENV['FROM_BIN_CASSANDRA_HELPER']
require 'rubygems'
require 'echoe'
@@ -8,7 +7,7 @@ unless ENV['FROM_BIN_CASSANDRA_HELPER']
p.project = "fauna"
p.summary = "A Ruby client for the Cassandra distributed database."
p.rubygems_version = ">= 0.8"
- p.dependencies = ['thrift_client', 'json', 'rake']
+ p.dependencies = ['thrift_client', 'json', 'rake', ['simple_uuid', '>= 0.0.2']]
p.ignore_pattern = /^(data|vendor\/cassandra|cassandra|vendor\/thrift)/
p.rdoc_pattern = /^(lib|bin|tasks|ext)|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
p.url = "http://blog.evanweaver.com/files/doc/fauna/cassandra/"
View
@@ -0,0 +1,47 @@
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{cassandra}
+ s.version = "0.7.2"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0.8") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Evan Weaver"]
+ s.cert_chain = ["/Users/ryan/.gemkeys/gem-public_cert.pem"]
+ s.date = %q{2010-01-25}
+ s.default_executable = %q{cassandra_helper}
+ s.description = %q{A Ruby client for the Cassandra distributed database.}
+ s.email = %q{}
+ s.executables = ["cassandra_helper"]
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.mkd", "bin/cassandra_helper", "lib/cassandra.rb", "lib/cassandra/array.rb", "lib/cassandra/cassandra.rb", "lib/cassandra/columns.rb", "lib/cassandra/comparable.rb", "lib/cassandra/constants.rb", "lib/cassandra/debug.rb", "lib/cassandra/long.rb", "lib/cassandra/ordered_hash.rb", "lib/cassandra/protocol.rb", "lib/cassandra/time.rb"]
+ s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.mkd", "Rakefile", "bin/cassandra_helper", "conf/cassandra.in.sh", "conf/log4j.properties", "conf/storage-conf.xml", "lib/cassandra.rb", "lib/cassandra/array.rb", "lib/cassandra/cassandra.rb", "lib/cassandra/columns.rb", "lib/cassandra/comparable.rb", "lib/cassandra/constants.rb", "lib/cassandra/debug.rb", "lib/cassandra/long.rb", "lib/cassandra/ordered_hash.rb", "lib/cassandra/protocol.rb", "lib/cassandra/time.rb", "test/cassandra_test.rb", "test/comparable_types_test.rb", "test/ordered_hash_test.rb", "test/test_helper.rb", "vendor/gen-rb/cassandra.rb", "vendor/gen-rb/cassandra_constants.rb", "vendor/gen-rb/cassandra_types.rb", "cassandra.gemspec"]
+ s.homepage = %q{http://blog.evanweaver.com/files/doc/fauna/cassandra/}
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Cassandra", "--main", "README.mkd"]
+ s.require_paths = ["lib"]
+ s.rubyforge_project = %q{fauna}
+ s.rubygems_version = %q{1.3.5}
+ s.signing_key = %q{/Users/ryan/.gemkeys/gem-private_key.pem}
+ s.summary = %q{A Ruby client for the Cassandra distributed database.}
+ s.test_files = ["test/cassandra_test.rb", "test/comparable_types_test.rb", "test/ordered_hash_test.rb", "test/test_helper.rb"]
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<thrift_client>, [">= 0"])
+ s.add_runtime_dependency(%q<json>, [">= 0"])
+ s.add_runtime_dependency(%q<rake>, [">= 0"])
+ s.add_runtime_dependency(%q<simple_uuid>, [">= 0.0.2"])
+ else
+ s.add_dependency(%q<thrift_client>, [">= 0"])
+ s.add_dependency(%q<json>, [">= 0"])
+ s.add_dependency(%q<rake>, [">= 0"])
+ s.add_dependency(%q<simple_uuid>, [">= 0.0.2"])
+ end
+ else
+ s.add_dependency(%q<thrift_client>, [">= 0"])
+ s.add_dependency(%q<json>, [">= 0"])
+ s.add_dependency(%q<rake>, [">= 0"])
+ s.add_dependency(%q<simple_uuid>, [">= 0.0.2"])
+ end
+end
View
@@ -1,115 +0,0 @@
-
-class Cassandra
-
- # UUID format version 1, as specified in RFC 4122, with jitter in place of the mac address and sequence counter.
- class UUID < Comparable
-
- class InvalidVersion < StandardError #:nodoc:
- end
-
- GREGORIAN_EPOCH_OFFSET = 0x01B2_1DD2_1381_4000 # Oct 15, 1582
-
- VARIANT = 0b1000_0000_0000_0000
-
- def initialize(bytes = nil)
- case bytes
- when self.class # UUID
- @bytes = bytes.to_s
- when String
- case bytes.size
- when 16 # Raw byte array
- @bytes = bytes
- when 36 # Human-readable UUID representation; inverse of #to_guid
- elements = bytes.split("-")
- raise TypeError, "Expected #{bytes.inspect} to cast to a #{self.class} (malformed UUID representation)" if elements.size != 5
- @bytes = elements.join.to_a.pack('H32')
- else
- raise TypeError, "Expected #{bytes.inspect} to cast to a #{self.class} (invalid bytecount)"
- end
-
- when Integer
- raise TypeError, "Expected #{bytes.inspect} to cast to a #{self.class} (integer out of range)" if bytes < 0 or bytes > 2**128
- @bytes = [
- (bytes >> 96) & 0xFFFF_FFFF,
- (bytes >> 64) & 0xFFFF_FFFF,
- (bytes >> 32) & 0xFFFF_FFFF,
- bytes & 0xFFFF_FFFF
- ].pack("NNNN")
-
- when NilClass, Time
- time = (bytes || Time).stamp * 10 + GREGORIAN_EPOCH_OFFSET
- # See http://github.com/spectra/ruby-uuid/
- @bytes = [
- time & 0xFFFF_FFFF,
- time >> 32,
- ((time >> 48) & 0x0FFF) | 0x1000,
- # Top 3 bytes reserved
- rand(2**13) | VARIANT,
- rand(2**16),
- rand(2**32)
- ].pack("NnnnnN")
-
- else
- raise TypeError, "Expected #{bytes.inspect} to cast to a #{self.class} (unknown source class)"
- end
- end
-
- def to_i
- ints = @bytes.unpack("NNNN")
- (ints[0] << 96) +
- (ints[1] << 64) +
- (ints[2] << 32) +
- ints[3]
- end
-
- def version
- time_high = @bytes.unpack("NnnQ")[2]
- version = (time_high & 0xF000).to_s(16)[0].chr.to_i
- version > 0 and version < 6 ? version : -1
- end
-
- def variant
- @bytes.unpack('QnnN')[1] >> 13
- end
-
- def to_guid
- elements = @bytes.unpack("NnnCCa6")
- node = elements[-1].unpack('C*')
- elements[-1] = '%02x%02x%02x%02x%02x%02x' % node
- "%08x-%04x-%04x-%02x%02x-%s" % elements
- end
-
- def seconds
- total_usecs / 1_000_000
- end
-
- def usecs
- total_usecs % 1_000_000
- end
-
- def <=>(other)
- total_usecs <=> other.send(:total_usecs)
- end
-
- def ==(other)
- to_s == other.to_s
- end
-
- def inspect(long = false)
- "<Cassandra::UUID##{object_id} time: #{
- Time.at(seconds).inspect
- }, usecs: #{
- usecs
- } jitter: #{
- @bytes.unpack('QQ')[1]
- }" + (long ? ", version: #{version}, variant: #{variant}, guid: #{to_guid}>" : ">")
- end
-
- private
-
- def total_usecs
- elements = @bytes.unpack("NnnQ")
- (elements[0] + (elements[1] << 32) + ((elements[2] & 0x0FFF) << 48) - GREGORIAN_EPOCH_OFFSET) / 10
- end
- end
-end

0 comments on commit 7a28cfa

Please sign in to comment.