gotime-cassandra_object 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ pkg
2
+ .yardoc
3
+ doc/
4
+ bin/*
5
+ vendor/gems/*
6
+ !vendor/gems/cache/
7
+ .bundle
8
+
9
+ *.swp
10
+ *.swo
data/CHANGELOG ADDED
@@ -0,0 +1,3 @@
1
+ v 0.5.0.pre
2
+ - First release
3
+ - Rough around the corners, especially outside the core attributes/persistence stuff
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :gemcutter
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,46 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gotime-cassandra_object (0.8.1)
5
+ activemodel (~> 3)
6
+ activesupport (~> 3)
7
+ cassandra
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ activemodel (3.0.5)
13
+ activesupport (= 3.0.5)
14
+ builder (~> 2.1.2)
15
+ i18n (~> 0.4)
16
+ activesupport (3.0.5)
17
+ builder (2.1.2)
18
+ cassandra (0.9.0)
19
+ json
20
+ rake
21
+ simple_uuid (>= 0.1.0)
22
+ thrift_client (>= 0.6.0)
23
+ git (1.2.5)
24
+ i18n (0.5.0)
25
+ jeweler (1.5.1)
26
+ bundler (~> 1.0.0)
27
+ git (>= 1.2.5)
28
+ rake
29
+ json (1.5.1)
30
+ rake (0.8.7)
31
+ rcov (0.9.9)
32
+ shoulda (2.11.3)
33
+ simple_uuid (0.1.1)
34
+ thrift (0.5.0)
35
+ thrift_client (0.6.0)
36
+ thrift (~> 0.5.0)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ bundler (~> 1.0.0)
43
+ gotime-cassandra_object!
44
+ jeweler (~> 1.5.1)
45
+ rcov
46
+ shoulda
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2009 Koziarski Software Ltd
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted, provided that the above
5
+ copyright notice and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
data/Rakefile CHANGED
@@ -1,28 +1,5 @@
1
- require 'rubygems'
2
1
  require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'rake'
11
-
12
- require 'jeweler'
13
- require './lib/cassandra_object/version'
14
- Jeweler::Tasks.new do |gem|
15
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
16
- gem.name = "gotime-cassandra_object"
17
- gem.version = CassandraObject::Version::STRING
18
- gem.homepage = "http://github.com/gotime/cassandra_object"
19
- gem.license = "MIT"
20
- gem.summary = %Q{Cassandra ActiveModel}
21
- gem.description = %Q{Cassandra ActiveModel}
22
- gem.email = "grantr@gmail.com"
23
- gem.authors = ["Michael Koziarski", "grantr"]
24
- end
25
- Jeweler::RubygemsDotOrgTasks.new
2
+ Bundler::GemHelper.install_tasks
26
3
 
27
4
  require 'rake/testtask'
28
5
  Rake::TestTask.new(:test) do |test|
data/TODO ADDED
@@ -0,0 +1,2 @@
1
+ * Support for alternate column names in associations and indexes
2
+ * Support for compound keys for associations e.g. "#{customer_id}:#{invoice_date}"
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'gotime-cassandra_object'
5
+ s.version = '0.8.2'
6
+ s.description = 'Cassandra ActiveModel'
7
+ s.summary = 'Cassandra ActiveModel'
8
+ s.required_rubygems_version = '>= 1.3.5'
9
+ s.authors = ["Michael Koziarski", "grantr"]
10
+ s.email = 'grantr@gmail.com'
11
+ s.homepage = 'http://github.com/gotime/cassandra_object'
12
+ s.extra_rdoc_files = ["README.markdown"]
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.require_paths = ['lib']
16
+
17
+ s.add_runtime_dependency('activesupport', "~> 3")
18
+ s.add_runtime_dependency('activemodel', "~> 3")
19
+ s.add_runtime_dependency('cassandra')
20
+
21
+ s.add_development_dependency('shoulda')
22
+ s.add_development_dependency('bundler', "~> 1.0.0")
23
+ s.add_development_dependency('jeweler', "~> 1.5.1")
24
+ s.add_development_dependency('rcov')
25
+ end
26
+
@@ -11,8 +11,8 @@ module CassandraObject
11
11
  end
12
12
 
13
13
  def check_value!(value)
14
- converter.encode(value) unless value.nil? && @options[:allow_nil]
15
- value
14
+ return value if value.nil?
15
+ value.kind_of?(expected_type) ? value : converter.decode(value)
16
16
  end
17
17
 
18
18
  def define_methods!
@@ -0,0 +1,11 @@
1
+ class <%= name %> < CassandraObject::Migration
2
+
3
+ def self.up
4
+
5
+ end
6
+
7
+ def self.down
8
+
9
+ end
10
+
11
+ end
@@ -2,8 +2,6 @@ module CassandraObject
2
2
  module IntegerType
3
3
  REGEX = /\A[-+]?\d+\Z/
4
4
  def encode(int)
5
- return '' if int.nil?
6
- int = int.to_i if int.kind_of?(String) && int.match(REGEX)
7
5
  raise ArgumentError.new("#{self} requires an Integer. You passed #{int.inspect}") unless int.kind_of?(Integer)
8
6
  int.to_s
9
7
  end
@@ -11,17 +9,15 @@ module CassandraObject
11
9
 
12
10
  def decode(str)
13
11
  return nil if str.empty?
14
- raise ArgumentError.new("#{str} isn't a String that looks like a Integer") unless str.kind_of?(String) && str.match(REGEX)
12
+ raise ArgumentError.new("Cannot convert #{str} into an Integer") unless str.kind_of?(String) && str.match(REGEX)
15
13
  str.to_i
16
14
  end
17
15
  module_function :decode
18
16
  end
19
17
 
20
18
  module FloatType
21
- REGEX = /\A[-+]?\d+(\.\d+)\Z/
19
+ REGEX = /\A[-+]?\d+(\.\d+)?\Z/
22
20
  def encode(float)
23
- return '' if float.nil?
24
- float = float.to_f if float.kind_of?(String) && float.match(REGEX)
25
21
  raise ArgumentError.new("#{self} requires a Float") unless float.kind_of?(Float)
26
22
  float.to_s
27
23
  end
@@ -29,7 +25,7 @@ module CassandraObject
29
25
 
30
26
  def decode(str)
31
27
  return nil if str.empty?
32
- raise ArgumentError.new("#{str} isn't a String that looks like a Float") unless str.kind_of?(String) && str.match(REGEX)
28
+ raise ArgumentError.new("Cannot convert #{str} into a Float") unless str.kind_of?(String) && str.match(REGEX)
33
29
  str.to_f
34
30
  end
35
31
  module_function :decode
@@ -39,8 +35,6 @@ module CassandraObject
39
35
  FORMAT = '%Y-%m-%d'
40
36
  REGEX = /\A\d{4}-\d{2}-\d{2}\Z/
41
37
  def encode(date)
42
- return '' if date.nil?
43
- date = Date.parse(date) if date.kind_of?(String) && date.match(REGEX)
44
38
  raise ArgumentError.new("#{self} requires a Date") unless date.kind_of?(Date)
45
39
  date.strftime(FORMAT)
46
40
  end
@@ -48,7 +42,7 @@ module CassandraObject
48
42
 
49
43
  def decode(str)
50
44
  return nil if str.empty?
51
- raise ArgumentError.new("#{str} isn't a String that looks like a Date") unless str.kind_of?(String) && str.match(REGEX)
45
+ raise ArgumentError.new("Cannot convert #{str} into a Date") unless str.kind_of?(String) && str.match(REGEX)
52
46
  Date.strptime(str, FORMAT)
53
47
  end
54
48
  module_function :decode
@@ -65,8 +59,6 @@ module CassandraObject
65
59
  \s*\z/ix
66
60
 
67
61
  def encode(time)
68
- return '' if time.nil?
69
- time = Time.parse(time) if time.kind_of?(String) && time.match(REGEX)
70
62
  raise ArgumentError.new("#{self} requires a Time") unless time.kind_of?(Time)
71
63
  time.xmlschema(6)
72
64
  end
@@ -74,7 +66,7 @@ module CassandraObject
74
66
 
75
67
  def decode(str)
76
68
  return nil if str.empty?
77
- raise ArgumentError.new("#{str} isn't a String that looks like a Time") unless str.kind_of?(String) && str.match(REGEX)
69
+ raise ArgumentError.new("Cannot convert #{str} into a Time") unless str.kind_of?(String) && str.match(REGEX)
78
70
  Time.xmlschema(str)
79
71
  end
80
72
  module_function :decode
@@ -82,8 +74,6 @@ module CassandraObject
82
74
 
83
75
  module TimeWithZoneType
84
76
  def encode(time)
85
- return '' if time.nil?
86
- time = Time.zone.parse(time) if time.kind_of?(String) && time.match(TimeType::REGEX)
87
77
  raise ArgumentError.new("#{self} requires a Time") unless time.kind_of?(Time)
88
78
  time.utc.xmlschema(6)
89
79
  end
@@ -91,7 +81,7 @@ module CassandraObject
91
81
 
92
82
  def decode(str)
93
83
  return nil if str.empty?
94
- raise ArgumentError.new("#{str} isn't a String that looks like a Time") unless str.kind_of?(String) && str.match(TimeType::REGEX)
84
+ raise ArgumentError.new("Cannot convert #{str} into a Time") unless str.kind_of?(String) && str.match(TimeType::REGEX)
95
85
  Time.xmlschema(str).in_time_zone
96
86
  end
97
87
  module_function :decode
@@ -99,7 +89,6 @@ module CassandraObject
99
89
 
100
90
  module StringType
101
91
  def encode(str)
102
- return '' if str.nil?
103
92
  raise ArgumentError.new("#{self} requires a String") unless str.kind_of?(String)
104
93
  str.dup
105
94
  end
@@ -113,7 +102,6 @@ module CassandraObject
113
102
 
114
103
  module UTF8StringType
115
104
  def encode(str)
116
- return '' if str.nil?
117
105
  # This is technically the most correct, but it is a pain to require utf-8 encoding for all strings. Should revisit.
118
106
  #raise ArgumentError.new("#{self} requires a UTF-8 encoded String") unless str.kind_of?(String) && str.encoding == Encoding::UTF_8
119
107
  raise ArgumentError.new("#{self} requires a String") unless str.kind_of?(String)
@@ -129,7 +117,6 @@ module CassandraObject
129
117
 
130
118
  module HashType
131
119
  def encode(hash)
132
- return '' if hash.nil?
133
120
  raise ArgumentError.new("#{self} requires a Hash") unless hash.kind_of?(Hash)
134
121
  ActiveSupport::JSON.encode(hash)
135
122
  end
@@ -144,17 +131,18 @@ module CassandraObject
144
131
 
145
132
  module BooleanType
146
133
  TRUE_VALS = [true, 'true', '1']
147
- FALSE_VALS = [false, 'false', '0', nil]
134
+ FALSE_VALS = [false, 'false', '0', '', nil]
148
135
  def encode(bool)
149
- unless TRUE_VALS.any? { |a| bool == a } || FALSE_VALS.any?{ |a| bool == a }
150
- raise ArgumentError.new("#{self} requires a Boolean or nil")
136
+ unless TRUE_VALS.any? { |a| bool == a } || FALSE_VALS.any? { |a| bool == a }
137
+ raise ArgumentError.new("#{self} requires a boolean")
151
138
  end
152
139
  TRUE_VALS.include?(bool) ? '1' : '0'
153
140
  end
154
141
  module_function :encode
155
142
 
156
- def decode(bool)
157
- bool == '1'
143
+ def decode(str)
144
+ raise ArgumentError.new("Cannot convert #{str} into a boolean") unless TRUE_VALS.any? { |a| str == a } || FALSE_VALS.any? { |a| str == a }
145
+ TRUE_VALS.include?(str)
158
146
  end
159
147
  module_function :decode
160
148
  end
@@ -0,0 +1,53 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+
18
+ cassandra_home=`dirname $0`/..
19
+
20
+ # The directory where Cassandra's configs live (required)
21
+ CASSANDRA_CONF=`pwd`/../test/config
22
+
23
+ # This can be the path to a jar file, or a directory containing the
24
+ # compiled classes. NOTE: This isn't needed by the startup script,
25
+ # it's just used here in constructing the classpath.
26
+ cassandra_bin=$cassandra_home/build/classes
27
+ #cassandra_bin=$cassandra_home/build/cassandra.jar
28
+
29
+ # The java classpath (required)
30
+ CLASSPATH=$CASSANDRA_CONF:$cassandra_bin
31
+
32
+ for jar in $cassandra_home/lib/*.jar; do
33
+ CLASSPATH=$CLASSPATH:$jar
34
+ done
35
+
36
+ # Arguments to pass to the JVM
37
+ JVM_OPTS=" \
38
+ -ea \
39
+ -Xdebug \
40
+ -Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=n \
41
+ -Xms128M \
42
+ -Xmx1G \
43
+ -XX:SurvivorRatio=8 \
44
+ -XX:TargetSurvivorRatio=90 \
45
+ -XX:+AggressiveOpts \
46
+ -XX:+UseParNewGC \
47
+ -XX:+UseConcMarkSweepGC \
48
+ -XX:CMSInitiatingOccupancyFraction=1 \
49
+ -XX:+CMSParallelRemarkEnabled \
50
+ -XX:+HeapDumpOnOutOfMemoryError \
51
+ -Dcom.sun.management.jmxremote.port=8080 \
52
+ -Dcom.sun.management.jmxremote.ssl=false \
53
+ -Dcom.sun.management.jmxremote.authenticate=false"
@@ -0,0 +1,38 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # for production, you should probably set the root to INFO
18
+ # and the pattern to %c instead of %l. (%l is slower.)
19
+
20
+ # output messages into a rolling log file as well as stdout
21
+ log4j.rootLogger=DEBUG,stdout,R
22
+
23
+ # stdout
24
+ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
25
+ log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout
26
+
27
+ # rolling log file ("system.log
28
+ log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
29
+ log4j.appender.R.DatePattern='.'yyyy-MM-dd-HH
30
+ log4j.appender.R.layout=org.apache.log4j.PatternLayout
31
+ log4j.appender.R.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n
32
+ # Edit the next line to point to your logs directory
33
+ log4j.appender.R.File=data/logs/system.log
34
+
35
+ # Application logging options
36
+ #log4j.logger.com.facebook=DEBUG
37
+ #log4j.logger.com.facebook.infrastructure.gms=DEBUG
38
+ #log4j.logger.com.facebook.infrastructure.db=DEBUG
@@ -0,0 +1,221 @@
1
+ <!--
2
+ ~ Licensed to the Apache Software Foundation (ASF) under one
3
+ ~ or more contributor license agreements. See the NOTICE file
4
+ ~ distributed with this work for additional information
5
+ ~ regarding copyright ownership. The ASF licenses this file
6
+ ~ to you under the Apache License, Version 2.0 (the
7
+ ~ "License"); you may not use this file except in compliance
8
+ ~ with the License. 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,
13
+ ~ software distributed under the License is distributed on an
14
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ ~ KIND, either express or implied. See the License for the
16
+ ~ specific language governing permissions and limitations
17
+ ~ under the License.
18
+ -->
19
+ <Storage>
20
+ <!--======================================================================-->
21
+ <!-- Basic Configuration -->
22
+ <!--======================================================================-->
23
+ <ClusterName>Test</ClusterName>
24
+
25
+ <!-- Tables and ColumnFamilies
26
+ Think of a table as a namespace, not a relational table.
27
+ (ColumnFamilies are closer in meaning to those.)
28
+
29
+ There is an implicit table named 'system' for Cassandra internals.
30
+ -->
31
+ <Keyspaces>
32
+ <Keyspace Name="Twitter">
33
+ <KeysCachedFraction>0.01</KeysCachedFraction>
34
+ <ColumnFamily CompareWith="UTF8Type" Name="Users" />
35
+ <ColumnFamily CompareWith="UTF8Type" Name="UserAudits" />
36
+ <ColumnFamily CompareWith="UTF8Type" CompareSubcolumnsWith="TimeUUIDType" ColumnType="Super" Name="UserRelationships" />
37
+ <ColumnFamily CompareWith="UTF8Type" Name="Usernames" />
38
+ <ColumnFamily CompareWith="UTF8Type" Name="Statuses" />
39
+ <ColumnFamily CompareWith="UTF8Type" Name="StatusAudits" />
40
+ <ColumnFamily CompareWith="UTF8Type" CompareSubcolumnsWith="TimeUUIDType" ColumnType="Super" Name="StatusRelationships" />
41
+ </Keyspace>
42
+
43
+ <Keyspace Name="Multiblog">
44
+ <KeysCachedFraction>0.01</KeysCachedFraction>
45
+ <ColumnFamily CompareWith="UTF8Type" Name="Blogs"/>
46
+ <ColumnFamily CompareWith="UTF8Type" Name="Comments"/>
47
+ </Keyspace>
48
+
49
+ <Keyspace Name="CassandraObject">
50
+ <KeysCachedFraction>0.01</KeysCachedFraction>
51
+ <ColumnFamily CompareWith="UTF8Type" Name="Customers" />
52
+ <ColumnFamily CompareWith="UTF8Type" CompareSubcolumnsWith="TimeUUIDType" ColumnType="Super" Name="CustomerRelationships" />
53
+ <ColumnFamily CompareWith="UTF8Type" CompareSubcolumnsWith="TimeUUIDType" ColumnType="Super" Name="CustomersByLastName" />
54
+ <ColumnFamily CompareWith="UTF8Type" Name="Invoices" />
55
+ <ColumnFamily CompareWith="UTF8Type" CompareSubcolumnsWith="TimeUUIDType" ColumnType="Super" Name="InvoiceRelationships" />
56
+ <ColumnFamily CompareWith="UTF8Type" Name="InvoicesByNumber" />
57
+ <ColumnFamily CompareWith="UTF8Type" Name="Payments" />
58
+ </Keyspace>
59
+ </Keyspaces>
60
+
61
+ <!-- Partitioner: any IPartitioner may be used, including your own
62
+ as long as it is on the classpath. Out of the box,
63
+ Cassandra provides
64
+ org.apache.cassandra.dht.RandomPartitioner and
65
+ org.apache.cassandra.dht.OrderPreservingPartitioner.
66
+ Range queries require using OrderPreservingPartitioner or a subclass.
67
+
68
+ Achtung! Changing this parameter requires wiping your data directories,
69
+ since the partitioner can modify the sstable on-disk format.
70
+ -->
71
+ <Partitioner>org.apache.cassandra.dht.OrderPreservingPartitioner</Partitioner>
72
+
73
+ <!-- If you are using the OrderPreservingPartitioner and you know your key
74
+ distribution, you can specify the token for this node to use.
75
+ (Keys are sent to the node with the "closest" token, so distributing
76
+ your tokens equally along the key distribution space will spread
77
+ keys evenly across your cluster.) This setting is only checked the
78
+ first time a node is started.
79
+
80
+ This can also be useful with RandomPartitioner to force equal
81
+ spacing of tokens around the hash space, especially for
82
+ clusters with a small number of nodes. -->
83
+ <InitialToken></InitialToken>
84
+
85
+
86
+ <!-- EndPointSnitch: Setting this to the class that implements IEndPointSnitch
87
+ which will see if two endpoints are in the same data center or on the same rack.
88
+ Out of the box, Cassandra provides
89
+ org.apache.cassandra.locator.EndPointSnitch
90
+ -->
91
+ <EndPointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndPointSnitch>
92
+
93
+ <!-- Strategy: Setting this to the class that implements IReplicaPlacementStrategy
94
+ will change the way the node picker works.
95
+ Out of the box, Cassandra provides
96
+ org.apache.cassandra.locator.RackUnawareStrategy
97
+ org.apache.cassandra.locator.RackAwareStrategy
98
+ (place one replica in a different datacenter, and the
99
+ others on different racks in the same one.)
100
+ -->
101
+ <ReplicaPlacementStrategy>org.apache.cassandra.locator.RackUnawareStrategy</ReplicaPlacementStrategy>
102
+
103
+ <!-- Number of replicas of the data-->
104
+ <ReplicationFactor>1</ReplicationFactor>
105
+
106
+ <!-- Directories: Specify where Cassandra should store different data on disk
107
+ Keep the data disks and the CommitLog disks separate for best performance
108
+ -->
109
+ <CommitLogDirectory>data/commitlog</CommitLogDirectory>
110
+ <DataFileDirectories>
111
+ <DataFileDirectory>data/data</DataFileDirectory>
112
+ </DataFileDirectories>
113
+ <CalloutLocation>data/callouts</CalloutLocation>
114
+ <BootstrapFileDirectory>data/bootstrap</BootstrapFileDirectory>
115
+ <StagingFileDirectory>data/staging</StagingFileDirectory>
116
+
117
+ <!-- Addresses of hosts that are deemed contact points. Cassandra nodes use
118
+ this list of hosts to find each other and learn the topology of the ring.
119
+ You must change this if you are running multiple nodes!
120
+ -->
121
+ <Seeds>
122
+ <Seed>127.0.0.1</Seed>
123
+ </Seeds>
124
+
125
+
126
+ <!-- Miscellaneous -->
127
+
128
+ <!-- time to wait for a reply from other nodes before failing the command -->
129
+ <RpcTimeoutInMillis>5000</RpcTimeoutInMillis>
130
+ <!-- size to allow commitlog to grow to before creating a new segment -->
131
+ <CommitLogRotationThresholdInMB>128</CommitLogRotationThresholdInMB>
132
+
133
+
134
+ <!-- Local hosts and ports -->
135
+
136
+ <!-- Address to bind to and tell other nodes to connect to.
137
+ You _must_ change this if you want multiple nodes to be able
138
+ to communicate!
139
+
140
+ Leaving it blank leaves it up to InetAddress.getLocalHost().
141
+ This will always do the Right Thing *if* the node is properly
142
+ configured (hostname, name resolution, etc), and the Right
143
+ Thing is to use the address associated with the hostname (it
144
+ might not be). -->
145
+ <ListenAddress>localhost</ListenAddress>
146
+ <!-- TCP port, for commands and data -->
147
+ <StoragePort>7000</StoragePort>
148
+ <!-- UDP port, for membership communications (gossip) -->
149
+ <ControlPort>7001</ControlPort>
150
+
151
+ <!-- The address to bind the Thrift RPC service to. Unlike
152
+ ListenAddress above, you *can* specify 0.0.0.0 here if you want
153
+ Thrift to listen on all interfaces.
154
+
155
+ Leaving this blank has the same effect it does for ListenAddress,
156
+ (i.e. it will be based on the configured hostname of the node).
157
+ -->
158
+ <ThriftAddress>localhost</ThriftAddress>
159
+ <!-- Thrift RPC port (the port clients connect to). -->
160
+ <ThriftPort>9160</ThriftPort>
161
+
162
+
163
+ <!--======================================================================-->
164
+ <!-- Memory, Disk, and Performance -->
165
+ <!--======================================================================-->
166
+
167
+ <!-- Add column indexes to a row after its contents reach this size -->
168
+ <ColumnIndexSizeInKB>256</ColumnIndexSizeInKB>
169
+
170
+ <!--
171
+ The maximum amount of data to store in memory before flushing to
172
+ disk. Note: There is one memtable per column family, and this threshold
173
+ is based solely on the amount of data stored, not actual heap memory
174
+ usage (there is some overhead in indexing the columns).
175
+ -->
176
+ <MemtableSizeInMB>32</MemtableSizeInMB>
177
+
178
+ <!--
179
+ The maximum number of columns in millions to store in memory
180
+ before flushing to disk. This is also a per-memtable setting.
181
+ Use with MemtableSizeInMB to tune memory usage.
182
+ -->
183
+ <MemtableObjectCountInMillions>0.01</MemtableObjectCountInMillions>
184
+
185
+ <!-- Unlike most systems, in Cassandra writes are faster than
186
+ reads, so you can afford more of those in parallel.
187
+ A good rule of thumb is 2 concurrent reads per processor core.
188
+ You especially want more concurrentwrites if you are using
189
+ CommitLogSync + CommitLogSyncDelay. -->
190
+ <ConcurrentReads>8</ConcurrentReads>
191
+ <ConcurrentWrites>32</ConcurrentWrites>
192
+
193
+ <!-- Turn on CommitLogSync to improve durability.
194
+ When enabled, Cassandra won't ack writes until the commit log
195
+ has been synced to disk. This is less necessary in Cassandra
196
+ than in traditional databases since replication reduces the
197
+ odds of losing data from a failure after writing the log
198
+ entry but before it actually reaches the disk.
199
+ -->
200
+ <CommitLogSync>false</CommitLogSync>
201
+ <!-- Delay (in microseconds) during which additional commit log
202
+ entries may be written before fsync. This will increase
203
+ latency slightly, but can vastly improve throughput where
204
+ there are many writers. Set to zero to disable
205
+ (each entry will be synced individually).
206
+ Reasonable values range from a minimal 100 to even 10000
207
+ if throughput matters more than latency. (10000us = 10ms
208
+ write latency isn't even that bad by traditional db
209
+ standards.)
210
+ -->
211
+ <CommitLogSyncDelay>1000</CommitLogSyncDelay>
212
+
213
+
214
+ <!-- Time to wait before garbage-collection deletion markers.
215
+ Set this to a large enough value that you are confident
216
+ that the deletion marker will be propagated to all replicas
217
+ by the time this many seconds has elapsed, even in the
218
+ face of hardware failures. The default value is ten days.
219
+ -->
220
+ <GCGraceSeconds>864000</GCGraceSeconds>
221
+ </Storage>
metadata CHANGED
@@ -1,122 +1,116 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gotime-cassandra_object
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.2
4
5
  prerelease:
5
- version: 0.8.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Michael Koziarski
9
9
  - grantr
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
-
14
- date: 2011-03-09 00:00:00 -08:00
13
+ date: 2011-03-09 00:00:00.000000000 -08:00
15
14
  default_executable:
16
- dependencies:
17
- - !ruby/object:Gem::Dependency
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
18
17
  name: activesupport
19
- prerelease: false
20
- requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirement: &22774160 !ruby/object:Gem::Requirement
21
19
  none: false
22
- requirements:
20
+ requirements:
23
21
  - - ~>
24
- - !ruby/object:Gem::Version
25
- version: "3"
22
+ - !ruby/object:Gem::Version
23
+ version: '3'
26
24
  type: :runtime
27
- version_requirements: *id001
28
- - !ruby/object:Gem::Dependency
29
- name: activemodel
30
25
  prerelease: false
31
- requirement: &id002 !ruby/object:Gem::Requirement
26
+ version_requirements: *22774160
27
+ - !ruby/object:Gem::Dependency
28
+ name: activemodel
29
+ requirement: &22773480 !ruby/object:Gem::Requirement
32
30
  none: false
33
- requirements:
31
+ requirements:
34
32
  - - ~>
35
- - !ruby/object:Gem::Version
36
- version: "3"
33
+ - !ruby/object:Gem::Version
34
+ version: '3'
37
35
  type: :runtime
38
- version_requirements: *id002
39
- - !ruby/object:Gem::Dependency
40
- name: cassandra
41
36
  prerelease: false
42
- requirement: &id003 !ruby/object:Gem::Requirement
37
+ version_requirements: *22773480
38
+ - !ruby/object:Gem::Dependency
39
+ name: cassandra
40
+ requirement: &22772900 !ruby/object:Gem::Requirement
43
41
  none: false
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: "0"
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
48
46
  type: :runtime
49
- version_requirements: *id003
50
- - !ruby/object:Gem::Dependency
51
- name: nokogiri
52
47
  prerelease: false
53
- requirement: &id004 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- version: "0"
59
- type: :runtime
60
- version_requirements: *id004
61
- - !ruby/object:Gem::Dependency
48
+ version_requirements: *22772900
49
+ - !ruby/object:Gem::Dependency
62
50
  name: shoulda
63
- prerelease: false
64
- requirement: &id005 !ruby/object:Gem::Requirement
51
+ requirement: &22772220 !ruby/object:Gem::Requirement
65
52
  none: false
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: "0"
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
70
57
  type: :development
71
- version_requirements: *id005
72
- - !ruby/object:Gem::Dependency
73
- name: bundler
74
58
  prerelease: false
75
- requirement: &id006 !ruby/object:Gem::Requirement
59
+ version_requirements: *22772220
60
+ - !ruby/object:Gem::Dependency
61
+ name: bundler
62
+ requirement: &22771460 !ruby/object:Gem::Requirement
76
63
  none: false
77
- requirements:
64
+ requirements:
78
65
  - - ~>
79
- - !ruby/object:Gem::Version
66
+ - !ruby/object:Gem::Version
80
67
  version: 1.0.0
81
68
  type: :development
82
- version_requirements: *id006
83
- - !ruby/object:Gem::Dependency
84
- name: jeweler
85
69
  prerelease: false
86
- requirement: &id007 !ruby/object:Gem::Requirement
70
+ version_requirements: *22771460
71
+ - !ruby/object:Gem::Dependency
72
+ name: jeweler
73
+ requirement: &22770720 !ruby/object:Gem::Requirement
87
74
  none: false
88
- requirements:
75
+ requirements:
89
76
  - - ~>
90
- - !ruby/object:Gem::Version
77
+ - !ruby/object:Gem::Version
91
78
  version: 1.5.1
92
79
  type: :development
93
- version_requirements: *id007
94
- - !ruby/object:Gem::Dependency
95
- name: rcov
96
80
  prerelease: false
97
- requirement: &id008 !ruby/object:Gem::Requirement
81
+ version_requirements: *22770720
82
+ - !ruby/object:Gem::Dependency
83
+ name: rcov
84
+ requirement: &22770140 !ruby/object:Gem::Requirement
98
85
  none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: "0"
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
103
90
  type: :development
104
- version_requirements: *id008
91
+ prerelease: false
92
+ version_requirements: *22770140
105
93
  description: Cassandra ActiveModel
106
94
  email: grantr@gmail.com
107
95
  executables: []
108
-
109
96
  extensions: []
110
-
111
- extra_rdoc_files:
97
+ extra_rdoc_files:
112
98
  - README.markdown
113
- files:
99
+ files:
100
+ - .gitignore
101
+ - CHANGELOG
102
+ - Gemfile
103
+ - Gemfile.lock
104
+ - LICENSE
114
105
  - MIT-LICENSE
115
- - Rakefile
116
106
  - README.markdown
107
+ - Rakefile
108
+ - TODO
109
+ - gotime-cassandra_object.gemspec
110
+ - lib/cassandra_object.rb
111
+ - lib/cassandra_object/associations.rb
117
112
  - lib/cassandra_object/associations/one_to_many.rb
118
113
  - lib/cassandra_object/associations/one_to_one.rb
119
- - lib/cassandra_object/associations.rb
120
114
  - lib/cassandra_object/attributes.rb
121
115
  - lib/cassandra_object/base.rb
122
116
  - lib/cassandra_object/callbacks.rb
@@ -127,11 +121,12 @@ files:
127
121
  - lib/cassandra_object/find_each.rb
128
122
  - lib/cassandra_object/find_with_ids.rb
129
123
  - lib/cassandra_object/generators/migration_generator.rb
124
+ - lib/cassandra_object/generators/templates/migration.rb.erb
125
+ - lib/cassandra_object/identity.rb
130
126
  - lib/cassandra_object/identity/abstract_key_factory.rb
131
127
  - lib/cassandra_object/identity/key.rb
132
128
  - lib/cassandra_object/identity/natural_key_factory.rb
133
129
  - lib/cassandra_object/identity/uuid_key_factory.rb
134
- - lib/cassandra_object/identity.rb
135
130
  - lib/cassandra_object/indexes.rb
136
131
  - lib/cassandra_object/log_subscriber.rb
137
132
  - lib/cassandra_object/migration.rb
@@ -147,10 +142,12 @@ files:
147
142
  - lib/cassandra_object/type_registration.rb
148
143
  - lib/cassandra_object/types.rb
149
144
  - lib/cassandra_object/validation.rb
150
- - lib/cassandra_object.rb
151
145
  - test/active_model_test.rb
152
146
  - test/basic_scenarios_test.rb
153
147
  - test/callbacks_test.rb
148
+ - test/config/cassandra.in.sh
149
+ - test/config/log4j.properties
150
+ - test/config/storage-conf.xml
154
151
  - test/connection.rb
155
152
  - test/cursor_test.rb
156
153
  - test/dirty_test.rb
@@ -169,30 +166,47 @@ files:
169
166
  has_rdoc: true
170
167
  homepage: http://github.com/gotime/cassandra_object
171
168
  licenses: []
172
-
173
169
  post_install_message:
174
170
  rdoc_options: []
175
-
176
- require_paths:
171
+ require_paths:
177
172
  - lib
178
- required_ruby_version: !ruby/object:Gem::Requirement
173
+ required_ruby_version: !ruby/object:Gem::Requirement
179
174
  none: false
180
- requirements:
181
- - - ">="
182
- - !ruby/object:Gem::Version
183
- version: "0"
184
- required_rubygems_version: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - ! '>='
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
179
+ required_rubygems_version: !ruby/object:Gem::Requirement
185
180
  none: false
186
- requirements:
187
- - - ">="
188
- - !ruby/object:Gem::Version
181
+ requirements:
182
+ - - ! '>='
183
+ - !ruby/object:Gem::Version
189
184
  version: 1.3.5
190
185
  requirements: []
191
-
192
186
  rubyforge_project:
193
- rubygems_version: 1.6.1
187
+ rubygems_version: 1.6.0
194
188
  signing_key:
195
189
  specification_version: 3
196
190
  summary: Cassandra ActiveModel
197
- test_files: []
198
-
191
+ test_files:
192
+ - test/active_model_test.rb
193
+ - test/basic_scenarios_test.rb
194
+ - test/callbacks_test.rb
195
+ - test/config/cassandra.in.sh
196
+ - test/config/log4j.properties
197
+ - test/config/storage-conf.xml
198
+ - test/connection.rb
199
+ - test/cursor_test.rb
200
+ - test/dirty_test.rb
201
+ - test/fixture_models.rb
202
+ - test/identity/natural_key_factory_test.rb
203
+ - test/index_test.rb
204
+ - test/legacy/test_helper.rb
205
+ - test/migration_test.rb
206
+ - test/one_to_many_associations_test.rb
207
+ - test/test_case.rb
208
+ - test/test_helper.rb
209
+ - test/time_test.rb
210
+ - test/types_test.rb
211
+ - test/validation_test.rb
212
+ - test/z_mock_test.rb