Permalink
Browse files

[split] some changes from security for open source

  • Loading branch information...
1 parent 003ae65 commit 742e01dba5f070b3d038470a46f2aa2062262d72 Ryan King committed Feb 6, 2012
Showing with 1,291 additions and 223 deletions.
  1. +26 −0 NOTICE
  2. +0 −2 OWNERS
  3. +14 −1 cassie-core/src/main/scala/com/twitter/cassie/BaseColumnFamily.scala
  4. +16 −8 cassie-core/src/main/scala/com/twitter/cassie/BatchMutationBuilder.scala
  5. +17 −4 cassie-core/src/main/scala/com/twitter/cassie/Cluster.scala
  6. +25 −7 cassie-core/src/main/scala/com/twitter/cassie/ClusterRemapper.scala
  7. +17 −4 cassie-core/src/main/scala/com/twitter/cassie/Column.scala
  8. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/ColumnFamily.scala
  9. +15 −1 cassie-core/src/main/scala/com/twitter/cassie/ColumnsIteratee.scala
  10. +15 −3 cassie-core/src/main/scala/com/twitter/cassie/CounterBatchMutationBuilder.scala
  11. +15 −1 cassie-core/src/main/scala/com/twitter/cassie/CounterColumn.scala
  12. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/CounterColumnFamily.scala
  13. +15 −1 cassie-core/src/main/scala/com/twitter/cassie/CounterColumnsIteratee.scala
  14. +17 −3 cassie-core/src/main/scala/com/twitter/cassie/CounterRowsIteratee.scala
  15. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/FNV1A.scala
  16. +18 −4 cassie-core/src/main/scala/com/twitter/cassie/Keyspace.scala
  17. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/Order.scala
  18. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/ReadConsistency.scala
  19. +17 −3 cassie-core/src/main/scala/com/twitter/cassie/RowsIteratee.scala
  20. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/SuperColumnFamily.scala
  21. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/SuperCounterBatchMutationBuilder.scala
  22. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/SuperCounterColumnFamily.scala
  23. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/WriteConsistency.scala
  24. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/clocks/Clock.scala
  25. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/clocks/MicrosecondEpochClock.scala
  26. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/clocks/StrictlyIncreasingClock.scala
  27. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/codecs/ByteArrayCodec.scala
  28. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/codecs/Codec.scala
  29. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/codecs/IntCodec.scala
  30. +17 −3 cassie-core/src/main/scala/com/twitter/cassie/codecs/LegacyUtf8Codec.scala
  31. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/codecs/LexicalUUIDCodec.scala
  32. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/codecs/LongCodec.scala
  33. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/codecs/ThriftCodec.scala
  34. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/codecs/Utf8Codec.scala
  35. +16 −1 cassie-core/src/main/scala/com/twitter/cassie/connection/CCluster.scala
  36. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/connection/ClientProvider.scala
  37. +23 −11 cassie-core/src/main/scala/com/twitter/cassie/connection/ClusterClientProvider.scala
  38. +23 −16 cassie-core/src/main/scala/com/twitter/cassie/tests/util/FakeCassandra.scala
  39. +16 −2 cassie-core/src/main/scala/com/twitter/cassie/types/LexicalUUID.scala
  40. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/types/ThriftEncoded.scala
  41. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/util/ByteBufferUtil.scala
  42. +14 −0 cassie-core/src/main/scala/com/twitter/cassie/util/FutureUtil.scala
  43. +21 −10 cassie-core/src/test/java/com/twitter/cassie/MockCassandraClient.java
  44. +18 −6 cassie-core/src/test/java/com/twitter/cassie/jtests/ClusterTest.java
  45. +21 −10 cassie-core/src/test/java/com/twitter/cassie/jtests/ColumnFamilyTest.java
  46. +19 −6 cassie-core/src/test/java/com/twitter/cassie/jtests/examples/CassieRun.java
  47. +15 −1 cassie-core/src/test/scala/com/twitter/cassie/FNV1ATest.scala
  48. +14 −0 cassie-core/src/test/scala/com/twitter/cassie/Mutations.scala
  49. +14 −0 cassie-core/src/test/scala/com/twitter/cassie/clocks/tests/MicrosecondEpochClockTest.scala
  50. +14 −0 cassie-core/src/test/scala/com/twitter/cassie/codecs/tests/ByteArrayCodecTest.scala
  51. +14 −0 cassie-core/src/test/scala/com/twitter/cassie/codecs/tests/ByteBufferLiteral.scala
  52. +14 −0 cassie-core/src/test/scala/com/twitter/cassie/codecs/tests/CodecTest.scala
  53. +14 −0 cassie-core/src/test/scala/com/twitter/cassie/codecs/tests/IntCodecTest.scala
  54. +14 −0 cassie-core/src/test/scala/com/twitter/cassie/codecs/tests/LexicalUUIDCodecTest.scala
  55. +14 −0 cassie-core/src/test/scala/com/twitter/cassie/codecs/tests/LongCodecTest.scala
  56. +14 −0 cassie-core/src/test/scala/com/twitter/cassie/codecs/tests/ThriftCodecTest.scala
  57. +14 −0 cassie-core/src/test/scala/com/twitter/cassie/codecs/tests/Utf8CodecTest.scala
  58. +15 −1 cassie-core/src/test/scala/com/twitter/cassie/examples/CassieRun.scala
  59. +18 −4 cassie-core/src/test/scala/com/twitter/cassie/tests/BatchMutationBuilderTest.scala
  60. +20 −7 cassie-core/src/test/scala/com/twitter/cassie/tests/ClusterRemapperTest.scala
  61. +17 −3 cassie-core/src/test/scala/com/twitter/cassie/tests/ClusterTest.scala
  62. +25 −11 cassie-core/src/test/scala/com/twitter/cassie/tests/ColumnFamilyTest.scala
  63. +16 −2 cassie-core/src/test/scala/com/twitter/cassie/tests/ColumnTest.scala
  64. +20 −6 cassie-core/src/test/scala/com/twitter/cassie/tests/ColumnsIterateeTest.scala
  65. +14 −0 cassie-core/src/test/scala/com/twitter/cassie/tests/CounterColumnFamilyTest.scala
  66. +14 −0 cassie-core/src/test/scala/com/twitter/cassie/tests/CounterRowsIterateeTest.scala
  67. +25 −11 cassie-core/src/test/scala/com/twitter/cassie/tests/KeyspaceTest.scala
  68. +16 −2 cassie-core/src/test/scala/com/twitter/cassie/tests/ReadConsistencyTest.scala
  69. +20 −6 cassie-core/src/test/scala/com/twitter/cassie/tests/RowsIterateeTest.scala
  70. +16 −2 cassie-core/src/test/scala/com/twitter/cassie/tests/WriteConsistencyTest.scala
  71. +17 −3 cassie-core/src/test/scala/com/twitter/cassie/types/tests/LexicalUUIDTest.scala
  72. +17 −3 cassie-core/src/test/scala/com/twitter/cassie/util/ColumnFamilyTestHelper.scala
  73. +23 −10 cassie-core/src/test/scala/com/twitter/cassie/util/FakeCassandraTest.scala
  74. +14 −0 cassie-core/src/test/thrift/person.thrift
  75. +14 −0 cassie-hadoop/src/main/java/com/twitter/cassie/hadoop/CassieCounters.java
  76. +24 −10 cassie-hadoop/src/main/scala/com/twitter/cassie/hadoop/CassieReducer.scala
  77. +17 −3 cassie-hadoop/src/main/scala/com/twitter/cassie/hadoop/ColumnWritable.scala
  78. +30 −20 cassie-hadoop/src/test/scala/com/twitter/cassie/hadoop/CassieReducerTest.scala
  79. +20 −10 cassie-serversets/src/main/scala/com/twitter/cassie/serversets/ServerSetsCluster.scala
  80. +1 −1 project/build/Cassie.scala
View
26 NOTICE
@@ -0,0 +1,26 @@
+Cassie is Scala client for Cassandra
+Copyright 2011-2012 Twitter, Inc.
+
+This work was originally inspired by Coda Hale's client on GitHub
+https://github.com/codahale/cassie
+
+Copyright (c) 2010 Coda Hale
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
2 OWNERS
@@ -1,2 +0,0 @@
-*: ryan, stuhood, harish
-review_group:cassandra
@@ -1,3 +1,17 @@
+// Copyright 2012 Twitter, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package com.twitter.cassie
import com.twitter.cassie.codecs.ThriftCodec
@@ -9,7 +23,6 @@ import com.twitter.util.Future
import org.apache.cassandra.finagle.thrift
import org.apache.cassandra.finagle.thrift.Cassandra.ServiceToClient
-
object BaseColumnFamily {
val annPredCodec = new ThriftCodec[thrift.SlicePredicate](classOf[thrift.SlicePredicate])
}
@@ -1,17 +1,25 @@
+// Copyright 2012 Twitter, Inc.
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+// http://www.apache.org/licenses/LICENSE-2.0
+
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package com.twitter.cassie
+import com.twitter.util.Future
import java.nio.ByteBuffer
-import java.util.{
- List => JList,
- Map => JMap,
- Set => JSet,
- ArrayList => JArrayList,
- HashMap => JHashMap
-}
import java.util.Collections.{ singleton => singletonJSet }
+import java.util.{ List => JList, Map => JMap, Set => JSet, ArrayList => JArrayList,HashMap => JHashMap}
import org.apache.cassandra.finagle.thrift
import scala.collection.mutable.ListBuffer
-import com.twitter.util.Future
trait BatchMutation {
private[cassie] def mutations: JMap[ByteBuffer, JMap[String, JList[thrift.Mutation]]]
@@ -1,13 +1,26 @@
+// Copyright 2012 Twitter, Inc.
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+// http://www.apache.org/licenses/LICENSE-2.0
+
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package com.twitter.cassie
-import connection._
-import scala.collection.JavaConversions._
-import com.twitter.cassie.connection.{ CCluster, RetryPolicy, SocketAddressCluster }
-import com.twitter.util.Duration
+import com.twitter.cassie.connection.{ CCluster, ClusterClientProvider, RetryPolicy, SocketAddressCluster }
import com.twitter.conversions.time._
import com.twitter.finagle.stats.{ StatsReceiver, NullStatsReceiver }
import com.twitter.finagle.tracing.{ Tracer, NullTracer }
+import com.twitter.util.Duration
import java.net.{ SocketAddress, InetSocketAddress }
+import scala.collection.JavaConversions._
/**
* A Cassandra cluster.
@@ -1,18 +1,36 @@
+// Copyright 2012 Twitter, Inc.
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+// http://www.apache.org/licenses/LICENSE-2.0
+
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package com.twitter.cassie
-import com.twitter.cassie.connection.ClusterClientProvider
-import com.twitter.cassie.connection.SocketAddressCluster
+import com.google.common.collect.ImmutableSet
import com.twitter.cassie.connection.CCluster
+import com.twitter.cassie.connection.{ClusterClientProvider, SocketAddressCluster}
+import com.twitter.concurrent.Spool
+import com.twitter.finagle.builder.{Cluster => FCluster}
+import com.twitter.finagle.ServiceFactory
import com.twitter.finagle.stats.{ StatsReceiver, NullStatsReceiver }
import com.twitter.finagle.util.Timer
+import com.twitter.finagle.WriteException
import com.twitter.logging.Logger
-import java.net.{ SocketAddress, InetSocketAddress }
+import com.twitter.util.{ Duration, Future, Promise, Return, Time }
+import java.io.IOException
+import java.net.{ InetSocketAddress, SocketAddress }
import org.jboss.netty.util.HashedWheelTimer
import scala.collection.JavaConversions._
-import com.twitter.concurrent.Spool
-import com.twitter.util._
-import com.twitter.finagle.builder.{Cluster => FCluster}
-
+import scala.collection.SeqProxy
+import scala.util.parsing.json.JSON
/**
* Given a seed host and port, returns a set of nodes in the cluster.
@@ -1,10 +1,23 @@
-package com.twitter.cassie
+// Copyright 2012 Twitter, Inc.
-import clocks.Clock
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
-import codecs.Codec
-import com.twitter.util.Duration
+// http://www.apache.org/licenses/LICENSE-2.0
+
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.twitter.cassie
+
+import com.twitter.cassie.clocks.Clock
+import com.twitter.cassie.codecs.Codec
import com.twitter.conversions.time._
+import com.twitter.util.Duration
import org.apache.cassandra.finagle.thrift
object Column {
@@ -1,3 +1,17 @@
+// Copyright 2012 Twitter, Inc.
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+// http://www.apache.org/licenses/LICENSE-2.0
+
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package com.twitter.cassie
import com.twitter.cassie.clocks.{ MicrosecondEpochClock, Clock }
@@ -1,9 +1,23 @@
+// Copyright 2012 Twitter, Inc.
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+// http://www.apache.org/licenses/LICENSE-2.0
+
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package com.twitter.cassie
-import scala.collection.JavaConversions._
import com.twitter.util.{ Future, Promise }
import java.util.{ Map => JMap, List => JList, ArrayList => JArrayList }
import org.apache.cassandra.finagle.thrift
+import scala.collection.JavaConversions._
/**
* Async iteration across the columns for a given key.
@@ -1,6 +1,20 @@
+// Copyright 2012 Twitter, Inc.
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+// http://www.apache.org/licenses/LICENSE-2.0
+
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package com.twitter.cassie
-import codecs.Codec
+import com.twitter.cassie.codecs.Codec
import com.twitter.util.Future
import java.nio.ByteBuffer
import java.util.Collections.{ singleton => singletonJSet }
@@ -11,8 +25,6 @@ import scala.collection.mutable.ListBuffer
/**
* A ColumnFamily-alike which batches mutations into a single API call for counters.
- *
- * TODO: Port to Java collections.
*/
class CounterBatchMutationBuilder[Key, Name](cf: CounterColumnFamily[Key, Name])
extends BatchMutation {
@@ -1,6 +1,20 @@
+// Copyright 2012 Twitter, Inc.
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+// http://www.apache.org/licenses/LICENSE-2.0
+
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package com.twitter.cassie
-import codecs.Codec
+import com.twitter.cassie.codecs.Codec
import org.apache.cassandra.finagle.thrift
object CounterColumn {
@@ -1,3 +1,17 @@
+// Copyright 2012 Twitter, Inc.
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+// http://www.apache.org/licenses/LICENSE-2.0
+
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package com.twitter.cassie
import com.twitter.cassie.clocks.{ MicrosecondEpochClock, Clock }
@@ -1,9 +1,23 @@
+// Copyright 2012 Twitter, Inc.
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+// http://www.apache.org/licenses/LICENSE-2.0
+
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package com.twitter.cassie
-import scala.collection.JavaConversions._
import com.twitter.util.{ Future, Promise }
import java.util.{ Map => JMap, List => JList, ArrayList => JArrayList }
import org.apache.cassandra.finagle.thrift
+import scala.collection.JavaConversions._
/**
* Async iteration across the columns for a given key.
@@ -1,10 +1,24 @@
+// Copyright 2012 Twitter, Inc.
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+// http://www.apache.org/licenses/LICENSE-2.0
+
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package com.twitter.cassie
-import scala.collection.JavaConversions._
+import com.twitter.cassie.util.ByteBufferUtil
import com.twitter.util.{ Future, Promise }
-import org.apache.cassandra.finagle.thrift
import java.util.{ List => JList }
-import com.twitter.cassie.util.ByteBufferUtil
+import org.apache.cassandra.finagle.thrift
+import scala.collection.JavaConversions._
/**
* Given a column family, a key range, a batch size, a slice predicate,
@@ -1,3 +1,17 @@
+// Copyright 2012 Twitter, Inc.
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+// http://www.apache.org/licenses/LICENSE-2.0
+
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package com.twitter.cassie
/**
Oops, something went wrong.

0 comments on commit 742e01d

Please sign in to comment.