[2/2] cassandra git commit: add missing file

2014-12-16 Thread jmckenzie
add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ffa80673
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ffa80673
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ffa80673

Branch: refs/heads/cassandra-2.1
Commit: ffa806733e7492d3d4b54957f911af501e043df9
Parents: 1fec4a4
Author: Joshua McKenzie jmcken...@apache.org
Authored: Tue Dec 16 15:06:02 2014 -0600
Committer: Joshua McKenzie jmcken...@apache.org
Committed: Tue Dec 16 15:06:02 2014 -0600

--
 .../cassandra/io/sstable/ISSTableScanner.java   | 34 
 1 file changed, 34 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ffa80673/src/java/org/apache/cassandra/io/sstable/ISSTableScanner.java
--
diff --git a/src/java/org/apache/cassandra/io/sstable/ISSTableScanner.java 
b/src/java/org/apache/cassandra/io/sstable/ISSTableScanner.java
new file mode 100644
index 000..b80bd87
--- /dev/null
+++ b/src/java/org/apache/cassandra/io/sstable/ISSTableScanner.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.cassandra.io.sstable;
+
+import org.apache.cassandra.db.columniterator.OnDiskAtomIterator;
+import org.apache.cassandra.utils.CloseableIterator;
+
+/**
+ * An ISSTableScanner is an abstraction allowing multiple SSTableScanners to be
+ * chained together under the hood.  See LeveledCompactionStrategy.getScanners.
+ */
+public interface ISSTableScanner extends CloseableIteratorOnDiskAtomIterator
+{
+public long getLengthInBytes();
+public long getCurrentPosition();
+public String getBackingFiles();
+}



[4/5] cassandra git commit: add missing file

2014-12-16 Thread jmckenzie
add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ffa80673
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ffa80673
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ffa80673

Branch: refs/heads/trunk
Commit: ffa806733e7492d3d4b54957f911af501e043df9
Parents: 1fec4a4
Author: Joshua McKenzie jmcken...@apache.org
Authored: Tue Dec 16 15:06:02 2014 -0600
Committer: Joshua McKenzie jmcken...@apache.org
Committed: Tue Dec 16 15:06:02 2014 -0600

--
 .../cassandra/io/sstable/ISSTableScanner.java   | 34 
 1 file changed, 34 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ffa80673/src/java/org/apache/cassandra/io/sstable/ISSTableScanner.java
--
diff --git a/src/java/org/apache/cassandra/io/sstable/ISSTableScanner.java 
b/src/java/org/apache/cassandra/io/sstable/ISSTableScanner.java
new file mode 100644
index 000..b80bd87
--- /dev/null
+++ b/src/java/org/apache/cassandra/io/sstable/ISSTableScanner.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.cassandra.io.sstable;
+
+import org.apache.cassandra.db.columniterator.OnDiskAtomIterator;
+import org.apache.cassandra.utils.CloseableIterator;
+
+/**
+ * An ISSTableScanner is an abstraction allowing multiple SSTableScanners to be
+ * chained together under the hood.  See LeveledCompactionStrategy.getScanners.
+ */
+public interface ISSTableScanner extends CloseableIteratorOnDiskAtomIterator
+{
+public long getLengthInBytes();
+public long getCurrentPosition();
+public String getBackingFiles();
+}



[3/6] git commit: add missing file

2014-10-16 Thread brandonwilliams
add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/67db1bf2
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/67db1bf2
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/67db1bf2

Branch: refs/heads/trunk
Commit: 67db1bf2786679b71dad8a32894346abdf59206e
Parents: e938839
Author: Brandon Williams brandonwilli...@apache.org
Authored: Thu Oct 16 12:16:16 2014 -0500
Committer: Brandon Williams brandonwilli...@apache.org
Committed: Thu Oct 16 12:16:16 2014 -0500

--
 .../metrics/CASClientRequestMetrics.java| 47 
 1 file changed, 47 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/67db1bf2/src/java/org/apache/cassandra/metrics/CASClientRequestMetrics.java
--
diff --git a/src/java/org/apache/cassandra/metrics/CASClientRequestMetrics.java 
b/src/java/org/apache/cassandra/metrics/CASClientRequestMetrics.java
new file mode 100644
index 000..3210d45
--- /dev/null
+++ b/src/java/org/apache/cassandra/metrics/CASClientRequestMetrics.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.cassandra.metrics;
+
+import com.yammer.metrics.*;
+import com.yammer.metrics.core.*;
+
+public class CASClientRequestMetrics extends ClientRequestMetrics
+{
+
+public final Histogram contention;
+/* Used only for write  */
+public final Counter conditionNotMet;
+
+public final Counter unfinishedCommit;
+
+public CASClientRequestMetrics(String scope) {
+super(scope);
+contention = 
Metrics.newHistogram(factory.createMetricName(ContentionHistogram), true);
+conditionNotMet =  
Metrics.newCounter(factory.createMetricName(ConditionNotMet));
+unfinishedCommit =  
Metrics.newCounter(factory.createMetricName(UnfinishedCommit));
+}
+
+public void release()
+{
+super.release();
+
Metrics.defaultRegistry().removeMetric(factory.createMetricName(ContentionHistogram));
+
Metrics.defaultRegistry().removeMetric(factory.createMetricName(ConditionNotMet));
+
Metrics.defaultRegistry().removeMetric(factory.createMetricName(UnfinishedCommit));
+}
+}



[1/6] git commit: add missing file

2014-10-16 Thread brandonwilliams
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 e93883988 - 67db1bf27
  refs/heads/cassandra-2.1 46c4f0b58 - 014d328f4
  refs/heads/trunk 1d05e8ea7 - 543fbc374


add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/67db1bf2
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/67db1bf2
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/67db1bf2

Branch: refs/heads/cassandra-2.0
Commit: 67db1bf2786679b71dad8a32894346abdf59206e
Parents: e938839
Author: Brandon Williams brandonwilli...@apache.org
Authored: Thu Oct 16 12:16:16 2014 -0500
Committer: Brandon Williams brandonwilli...@apache.org
Committed: Thu Oct 16 12:16:16 2014 -0500

--
 .../metrics/CASClientRequestMetrics.java| 47 
 1 file changed, 47 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/67db1bf2/src/java/org/apache/cassandra/metrics/CASClientRequestMetrics.java
--
diff --git a/src/java/org/apache/cassandra/metrics/CASClientRequestMetrics.java 
b/src/java/org/apache/cassandra/metrics/CASClientRequestMetrics.java
new file mode 100644
index 000..3210d45
--- /dev/null
+++ b/src/java/org/apache/cassandra/metrics/CASClientRequestMetrics.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.cassandra.metrics;
+
+import com.yammer.metrics.*;
+import com.yammer.metrics.core.*;
+
+public class CASClientRequestMetrics extends ClientRequestMetrics
+{
+
+public final Histogram contention;
+/* Used only for write  */
+public final Counter conditionNotMet;
+
+public final Counter unfinishedCommit;
+
+public CASClientRequestMetrics(String scope) {
+super(scope);
+contention = 
Metrics.newHistogram(factory.createMetricName(ContentionHistogram), true);
+conditionNotMet =  
Metrics.newCounter(factory.createMetricName(ConditionNotMet));
+unfinishedCommit =  
Metrics.newCounter(factory.createMetricName(UnfinishedCommit));
+}
+
+public void release()
+{
+super.release();
+
Metrics.defaultRegistry().removeMetric(factory.createMetricName(ContentionHistogram));
+
Metrics.defaultRegistry().removeMetric(factory.createMetricName(ConditionNotMet));
+
Metrics.defaultRegistry().removeMetric(factory.createMetricName(UnfinishedCommit));
+}
+}



[2/6] git commit: add missing file

2014-10-16 Thread brandonwilliams
add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/67db1bf2
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/67db1bf2
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/67db1bf2

Branch: refs/heads/cassandra-2.1
Commit: 67db1bf2786679b71dad8a32894346abdf59206e
Parents: e938839
Author: Brandon Williams brandonwilli...@apache.org
Authored: Thu Oct 16 12:16:16 2014 -0500
Committer: Brandon Williams brandonwilli...@apache.org
Committed: Thu Oct 16 12:16:16 2014 -0500

--
 .../metrics/CASClientRequestMetrics.java| 47 
 1 file changed, 47 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/67db1bf2/src/java/org/apache/cassandra/metrics/CASClientRequestMetrics.java
--
diff --git a/src/java/org/apache/cassandra/metrics/CASClientRequestMetrics.java 
b/src/java/org/apache/cassandra/metrics/CASClientRequestMetrics.java
new file mode 100644
index 000..3210d45
--- /dev/null
+++ b/src/java/org/apache/cassandra/metrics/CASClientRequestMetrics.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.cassandra.metrics;
+
+import com.yammer.metrics.*;
+import com.yammer.metrics.core.*;
+
+public class CASClientRequestMetrics extends ClientRequestMetrics
+{
+
+public final Histogram contention;
+/* Used only for write  */
+public final Counter conditionNotMet;
+
+public final Counter unfinishedCommit;
+
+public CASClientRequestMetrics(String scope) {
+super(scope);
+contention = 
Metrics.newHistogram(factory.createMetricName(ContentionHistogram), true);
+conditionNotMet =  
Metrics.newCounter(factory.createMetricName(ConditionNotMet));
+unfinishedCommit =  
Metrics.newCounter(factory.createMetricName(UnfinishedCommit));
+}
+
+public void release()
+{
+super.release();
+
Metrics.defaultRegistry().removeMetric(factory.createMetricName(ContentionHistogram));
+
Metrics.defaultRegistry().removeMetric(factory.createMetricName(ConditionNotMet));
+
Metrics.defaultRegistry().removeMetric(factory.createMetricName(UnfinishedCommit));
+}
+}



[1/2] git commit: Add missing file

2014-06-03 Thread marcuse
Repository: cassandra
Updated Branches:
  refs/heads/trunk 0a9845203 - fd50a2fdf


Add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f2a656e9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f2a656e9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f2a656e9

Branch: refs/heads/trunk
Commit: f2a656e9d6eb43fd5e6ca13603453bebd6fa210c
Parents: 0f2d7d0
Author: Marcus Eriksson marc...@apache.org
Authored: Tue Jun 3 08:18:00 2014 +0200
Committer: Marcus Eriksson marc...@apache.org
Committed: Tue Jun 3 08:18:00 2014 +0200

--
 .../repair/IRepairJobEventListener.java | 31 
 1 file changed, 31 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f2a656e9/src/java/org/apache/cassandra/repair/IRepairJobEventListener.java
--
diff --git a/src/java/org/apache/cassandra/repair/IRepairJobEventListener.java 
b/src/java/org/apache/cassandra/repair/IRepairJobEventListener.java
new file mode 100644
index 000..778c09d
--- /dev/null
+++ b/src/java/org/apache/cassandra/repair/IRepairJobEventListener.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.cassandra.repair;
+
+/**
+ * Implemented by the RepairSession to accept callbacks from sequential 
snapshot creation failure.
+ */
+
+public interface IRepairJobEventListener
+{
+/**
+ * Signal that there was a failure during the snapshot creation process.
+ *
+ */
+public void failedSnapshot();
+}



git commit: Add missing file

2014-06-03 Thread marcuse
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 0f2d7d0b9 - f2a656e9d


Add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f2a656e9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f2a656e9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f2a656e9

Branch: refs/heads/cassandra-2.1
Commit: f2a656e9d6eb43fd5e6ca13603453bebd6fa210c
Parents: 0f2d7d0
Author: Marcus Eriksson marc...@apache.org
Authored: Tue Jun 3 08:18:00 2014 +0200
Committer: Marcus Eriksson marc...@apache.org
Committed: Tue Jun 3 08:18:00 2014 +0200

--
 .../repair/IRepairJobEventListener.java | 31 
 1 file changed, 31 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f2a656e9/src/java/org/apache/cassandra/repair/IRepairJobEventListener.java
--
diff --git a/src/java/org/apache/cassandra/repair/IRepairJobEventListener.java 
b/src/java/org/apache/cassandra/repair/IRepairJobEventListener.java
new file mode 100644
index 000..778c09d
--- /dev/null
+++ b/src/java/org/apache/cassandra/repair/IRepairJobEventListener.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.cassandra.repair;
+
+/**
+ * Implemented by the RepairSession to accept callbacks from sequential 
snapshot creation failure.
+ */
+
+public interface IRepairJobEventListener
+{
+/**
+ * Signal that there was a failure during the snapshot creation process.
+ *
+ */
+public void failedSnapshot();
+}



git commit: Add missing file

2013-11-18 Thread slebresne
Updated Branches:
  refs/heads/cassandra-1.2 b678035ed - 582a16eff


Add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/582a16ef
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/582a16ef
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/582a16ef

Branch: refs/heads/cassandra-1.2
Commit: 582a16eff5fb7f94f936c9d6163f0a526c6ec4e4
Parents: b678035
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Tue Nov 19 08:30:08 2013 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Tue Nov 19 08:30:08 2013 +0100

--
 .../cql3/MeasurableForPreparedCache.java| 26 
 1 file changed, 26 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/582a16ef/src/java/org/apache/cassandra/cql3/MeasurableForPreparedCache.java
--
diff --git a/src/java/org/apache/cassandra/cql3/MeasurableForPreparedCache.java 
b/src/java/org/apache/cassandra/cql3/MeasurableForPreparedCache.java
new file mode 100644
index 000..6b3b4b5
--- /dev/null
+++ b/src/java/org/apache/cassandra/cql3/MeasurableForPreparedCache.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.cassandra.cql3;
+
+import org.github.jamm.MemoryMeter;
+
+public interface MeasurableForPreparedCache
+{
+public long measureForPreparedCache(MemoryMeter meter);
+}



[1/3] git commit: Add missing file

2013-11-18 Thread slebresne
Updated Branches:
  refs/heads/trunk 52cc7efb2 - 88fbdb11e


Add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/582a16ef
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/582a16ef
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/582a16ef

Branch: refs/heads/trunk
Commit: 582a16eff5fb7f94f936c9d6163f0a526c6ec4e4
Parents: b678035
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Tue Nov 19 08:30:08 2013 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Tue Nov 19 08:30:08 2013 +0100

--
 .../cql3/MeasurableForPreparedCache.java| 26 
 1 file changed, 26 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/582a16ef/src/java/org/apache/cassandra/cql3/MeasurableForPreparedCache.java
--
diff --git a/src/java/org/apache/cassandra/cql3/MeasurableForPreparedCache.java 
b/src/java/org/apache/cassandra/cql3/MeasurableForPreparedCache.java
new file mode 100644
index 000..6b3b4b5
--- /dev/null
+++ b/src/java/org/apache/cassandra/cql3/MeasurableForPreparedCache.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.cassandra.cql3;
+
+import org.github.jamm.MemoryMeter;
+
+public interface MeasurableForPreparedCache
+{
+public long measureForPreparedCache(MemoryMeter meter);
+}



[1/2] git commit: Add missing file

2013-11-18 Thread slebresne
Updated Branches:
  refs/heads/cassandra-2.0 ade99b918 - f65156733


Add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/582a16ef
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/582a16ef
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/582a16ef

Branch: refs/heads/cassandra-2.0
Commit: 582a16eff5fb7f94f936c9d6163f0a526c6ec4e4
Parents: b678035
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Tue Nov 19 08:30:08 2013 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Tue Nov 19 08:30:08 2013 +0100

--
 .../cql3/MeasurableForPreparedCache.java| 26 
 1 file changed, 26 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/582a16ef/src/java/org/apache/cassandra/cql3/MeasurableForPreparedCache.java
--
diff --git a/src/java/org/apache/cassandra/cql3/MeasurableForPreparedCache.java 
b/src/java/org/apache/cassandra/cql3/MeasurableForPreparedCache.java
new file mode 100644
index 000..6b3b4b5
--- /dev/null
+++ b/src/java/org/apache/cassandra/cql3/MeasurableForPreparedCache.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.cassandra.cql3;
+
+import org.github.jamm.MemoryMeter;
+
+public interface MeasurableForPreparedCache
+{
+public long measureForPreparedCache(MemoryMeter meter);
+}



git commit: add missing file

2013-04-21 Thread jbellis
Updated Branches:
  refs/heads/trunk 6968f68cd - 16806abb9


add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/16806abb
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/16806abb
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/16806abb

Branch: refs/heads/trunk
Commit: 16806abb966001c3ce358f45edcd1d316c63e7ad
Parents: 6968f68
Author: Jonathan Ellis jbel...@apache.org
Authored: Sun Apr 21 18:15:15 2013 -0500
Committer: Jonathan Ellis jbel...@apache.org
Committed: Sun Apr 21 18:15:15 2013 -0500

--
 .../SizeTieredCompactionStrategyOptions.java   |  104 +++
 1 files changed, 104 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/16806abb/src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategyOptions.java
--
diff --git 
a/src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategyOptions.java
 
b/src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategyOptions.java
new file mode 100644
index 000..d7c9075
--- /dev/null
+++ 
b/src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategyOptions.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.cassandra.db.compaction;
+
+import java.util.Map;
+
+import org.apache.cassandra.exceptions.ConfigurationException;
+
+public final class SizeTieredCompactionStrategyOptions
+{
+protected static final long DEFAULT_MIN_SSTABLE_SIZE = 50L * 1024L * 1024L;
+protected static final double DEFAULT_BUCKET_LOW = 0.5;
+protected static final double DEFAULT_BUCKET_HIGH = 1.5;
+protected static final String MIN_SSTABLE_SIZE_KEY = min_sstable_size;
+protected static final String BUCKET_LOW_KEY = bucket_low;
+protected static final String BUCKET_HIGH_KEY = bucket_high;
+
+protected long minSSTableSize;
+protected double bucketLow;
+protected double bucketHigh;
+
+public SizeTieredCompactionStrategyOptions(MapString, String options)
+{
+
+String optionValue = options.get(MIN_SSTABLE_SIZE_KEY);
+minSSTableSize = optionValue == null ? DEFAULT_MIN_SSTABLE_SIZE : 
Long.parseLong(optionValue);
+optionValue = options.get(BUCKET_LOW_KEY);
+bucketLow = optionValue == null ? DEFAULT_BUCKET_LOW : 
Double.parseDouble(optionValue);
+optionValue = options.get(BUCKET_HIGH_KEY);
+bucketHigh = optionValue == null ? DEFAULT_BUCKET_HIGH : 
Double.parseDouble(optionValue);
+}
+
+public SizeTieredCompactionStrategyOptions()
+{
+
+minSSTableSize = DEFAULT_MIN_SSTABLE_SIZE;
+bucketLow = DEFAULT_BUCKET_LOW;
+bucketHigh = DEFAULT_BUCKET_HIGH;
+}
+
+public static MapString, String validateOptions(MapString, String 
options, MapString, String uncheckedOptions) throws ConfigurationException
+{
+String optionValue = options.get(MIN_SSTABLE_SIZE_KEY);
+try
+{
+long minSSTableSize = optionValue == null ? 
DEFAULT_MIN_SSTABLE_SIZE : Long.parseLong(optionValue);
+if (minSSTableSize  0)
+{
+throw new ConfigurationException(String.format(%s must be non 
negative: %d, MIN_SSTABLE_SIZE_KEY, minSSTableSize));
+}
+}
+catch (NumberFormatException e)
+{
+throw new ConfigurationException(String.format(%s is not a 
parsable int (base10) for %s, optionValue, MIN_SSTABLE_SIZE_KEY), e);
+}
+
+double bucketLow, bucketHigh;
+optionValue = options.get(BUCKET_LOW_KEY);
+try
+{
+bucketLow = optionValue == null ? DEFAULT_BUCKET_LOW : 
Double.parseDouble(optionValue);
+}
+catch (NumberFormatException e)
+{
+throw new ConfigurationException(String.format(%s is not a 
parsable int (base10) for %s, optionValue, DEFAULT_BUCKET_LOW), e);
+}
+
+optionValue = 

[1/5] git commit: Add missing file from previous commit

2012-06-29 Thread slebresne
Updated Branches:
  refs/heads/trunk ce807c6a2 - 9d1bf3723


Add missing file from previous commit


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9d1bf372
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9d1bf372
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9d1bf372

Branch: refs/heads/trunk
Commit: 9d1bf372309f67ccd7242a24ef8061641e2857f7
Parents: 29124f6
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Jun 29 18:33:46 2012 +0200
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Jun 29 18:33:46 2012 +0200

--
 .../apache/cassandra/db/RangeTombstoneTest.java|  184 +++
 1 files changed, 184 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9d1bf372/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
--
diff --git a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java 
b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
new file mode 100644
index 000..1bc846b
--- /dev/null
+++ b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
@@ -0,0 +1,184 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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 org.apache.cassandra.db;
+
+import java.nio.ByteBuffer;
+import java.util.*;
+
+import org.junit.Test;
+
+import org.apache.cassandra.SchemaLoader;
+import org.apache.cassandra.db.compaction.CompactionManager;
+import org.apache.cassandra.db.filter.*;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
+import static org.apache.cassandra.Util.dk;
+
+public class RangeTombstoneTest extends SchemaLoader
+{
+private static final String KSNAME = Keyspace1;
+private static final String CFNAME = StandardInteger1;
+
+@Test
+public void simpleQueryWithRangeTombstoneTest() throws Exception
+{
+Table table = Table.open(KSNAME);
+ColumnFamilyStore cfs = table.getColumnFamilyStore(CFNAME);
+
+// Inserting data
+String key = k1;
+RowMutation rm;
+ColumnFamily cf;
+
+rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+for (int i = 0; i  40; i += 2)
+add(rm, i, 0);
+rm.apply();
+cfs.forceBlockingFlush();
+
+rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+cf = rm.addOrGet(CFNAME);
+delete(cf, 10, 22, 1);
+rm.apply();
+cfs.forceBlockingFlush();
+
+rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+for (int i = 1; i  40; i += 2)
+add(rm, i, 2);
+rm.apply();
+cfs.forceBlockingFlush();
+
+rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+cf = rm.addOrGet(CFNAME);
+delete(cf, 19, 27, 3);
+rm.apply();
+// We don't flush to test with both a range tomsbtone in memtable and 
in sstable
+
+QueryPath path = new QueryPath(CFNAME);
+
+// Queries by name
+int[] live = new int[]{ 4, 9, 11, 17, 28 };
+int[] dead = new int[]{ 12, 19, 21, 24, 27 };
+SortedSetByteBuffer columns = new 
TreeSetByteBuffer(cfs.getComparator());
+for (int i : live)
+columns.add(b(i));
+for (int i : dead)
+columns.add(b(i));
+cf = cfs.getColumnFamily(QueryFilter.getNamesFilter(dk(key), path, 
columns));
+
+for (int i : live)
+assert isLive(cf, cf.getColumn(b(i))) : Column  + i +  should 
be live;
+for (int i : dead)
+assert !isLive(cf, cf.getColumn(b(i))) : Column  + i +  
shouldn't be live;
+
+// Queries by slices
+cf = cfs.getColumnFamily(QueryFilter.getSliceFilter(dk(key), path, 
b(7), b(30), false, Integer.MAX_VALUE));
+
+for (int i : new int[]{ 7, 8, 9, 11, 13, 15, 17, 28, 29, 30 })
+assert isLive(cf, cf.getColumn(b(i))) : Column  + i +  should 
be live;
+for (int i : new int[]{ 10, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 
25, 26, 27 })
+assert !isLive(cf, 

[4/4] git commit: Add missing file

2012-05-01 Thread brandonwilliams
Add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c5ad288c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c5ad288c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c5ad288c

Branch: refs/heads/trunk
Commit: c5ad288c9119e4eda9e60fbb6d998e6a5fbd716b
Parents: b81f572
Author: Brandon Williams brandonwilli...@apache.org
Authored: Fri Apr 27 17:14:33 2012 -0500
Committer: Brandon Williams brandonwilli...@apache.org
Committed: Fri Apr 27 17:14:33 2012 -0500

--
 pylib/cqlshlib/cql3handling.py |  210 +++
 1 files changed, 210 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c5ad288c/pylib/cqlshlib/cql3handling.py
--
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
new file mode 100644
index 000..9d27f44
--- /dev/null
+++ b/pylib/cqlshlib/cql3handling.py
@@ -0,0 +1,210 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+import re
+from warnings import warn
+from .cqlhandling import cql_typename, cql_escape
+
+try:
+import json
+except ImportError:
+import simplejson as json
+
+class UnexpectedTableStructure(UserWarning):
+def __init__(self, msg):
+self.msg = msg
+
+def __str__(self):
+return 'Unexpected table structure; may not translate correctly to 
CQL. ' + self.msg
+
+keywords = set((
+'select', 'from', 'where', 'and', 'key', 'insert', 'update', 'with',
+'limit', 'using', 'consistency', 'one', 'quorum', 'all', 'any',
+'local_quorum', 'each_quorum', 'two', 'three', 'use', 'count', 'set',
+'begin', 'apply', 'batch', 'truncate', 'delete', 'in', 'create',
+'keyspace', 'schema', 'columnfamily', 'table', 'index', 'on', 'drop',
+'primary', 'into', 'values', 'timestamp', 'ttl', 'alter', 'add', 'type',
+'compact', 'storage', 'order', 'by', 'asc', 'desc'
+))
+
+columnfamily_options = (
+'comment',
+'bloom_filter_fp_chance',
+'caching',
+'read_repair_chance',
+# 'local_read_repair_chance',   -- not yet a valid cql option
+'gc_grace_seconds',
+'min_compaction_threshold',
+'max_compaction_threshold',
+'replicate_on_write',
+'compaction_strategy_class',
+)
+
+columnfamily_map_options = (
+('compaction_strategy_options',
+()),
+('compression_parameters',
+('sstable_compression', 'chunk_length_kb', 'crc_check_chance')),
+)
+
+def cql3_escape_value(value):
+return cql_escape(value)
+
+def cql3_escape_name(name):
+return '%s' % name.replace('', '')
+
+valid_cql3_word_re = re.compile(r'^[a-z][0-9a-z_]*$', re.I)
+
+def is_valid_cql3_name(s):
+return valid_cql3_word_re.match(s) is not None and s not in keywords
+
+def maybe_cql3_escape_name(name):
+if is_valid_cql3_name(name):
+return name
+return cql3_escape_name(name)
+
+class CqlColumnDef:
+index_name = None
+
+def __init__(self, name, cqltype):
+self.name = name
+self.cqltype = cqltype
+
+@classmethod
+def from_layout(cls, layout):
+c = cls(layout[u'column'], cql_typename(layout[u'validator']))
+c.index_name = layout[u'index_name']
+return c
+
+def __str__(self):
+indexstr = ' (index %s)' % self.index_name if self.index_name is not 
None else ''
+return 'CqlColumnDef %r %r%s' % (self.name, self.cqltype, indexstr)
+__repr__ = __str__
+
+class CqlTableDef:
+json_attrs = ('column_aliases', 'compaction_strategy_options', 
'compression_parameters')
+composite_type_name = 'org.apache.cassandra.db.marshal.CompositeType'
+colname_type_name = 'org.apache.cassandra.db.marshal.UTF8Type'
+column_class = CqlColumnDef
+compact_storage = False
+
+key_components = ()
+columns = ()
+
+def __init__(self, name):
+self.name = name
+
+@classmethod
+def from_layout(cls, layout, coldefs):
+cf = cls(name=layout[u'columnfamily'])
+for attr, val in 

git commit: Add missing file

2012-04-27 Thread brandonwilliams
Updated Branches:
  refs/heads/cassandra-1.1 b81f5723e - c5ad288c9


Add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c5ad288c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c5ad288c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c5ad288c

Branch: refs/heads/cassandra-1.1
Commit: c5ad288c9119e4eda9e60fbb6d998e6a5fbd716b
Parents: b81f572
Author: Brandon Williams brandonwilli...@apache.org
Authored: Fri Apr 27 17:14:33 2012 -0500
Committer: Brandon Williams brandonwilli...@apache.org
Committed: Fri Apr 27 17:14:33 2012 -0500

--
 pylib/cqlshlib/cql3handling.py |  210 +++
 1 files changed, 210 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c5ad288c/pylib/cqlshlib/cql3handling.py
--
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
new file mode 100644
index 000..9d27f44
--- /dev/null
+++ b/pylib/cqlshlib/cql3handling.py
@@ -0,0 +1,210 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+import re
+from warnings import warn
+from .cqlhandling import cql_typename, cql_escape
+
+try:
+import json
+except ImportError:
+import simplejson as json
+
+class UnexpectedTableStructure(UserWarning):
+def __init__(self, msg):
+self.msg = msg
+
+def __str__(self):
+return 'Unexpected table structure; may not translate correctly to 
CQL. ' + self.msg
+
+keywords = set((
+'select', 'from', 'where', 'and', 'key', 'insert', 'update', 'with',
+'limit', 'using', 'consistency', 'one', 'quorum', 'all', 'any',
+'local_quorum', 'each_quorum', 'two', 'three', 'use', 'count', 'set',
+'begin', 'apply', 'batch', 'truncate', 'delete', 'in', 'create',
+'keyspace', 'schema', 'columnfamily', 'table', 'index', 'on', 'drop',
+'primary', 'into', 'values', 'timestamp', 'ttl', 'alter', 'add', 'type',
+'compact', 'storage', 'order', 'by', 'asc', 'desc'
+))
+
+columnfamily_options = (
+'comment',
+'bloom_filter_fp_chance',
+'caching',
+'read_repair_chance',
+# 'local_read_repair_chance',   -- not yet a valid cql option
+'gc_grace_seconds',
+'min_compaction_threshold',
+'max_compaction_threshold',
+'replicate_on_write',
+'compaction_strategy_class',
+)
+
+columnfamily_map_options = (
+('compaction_strategy_options',
+()),
+('compression_parameters',
+('sstable_compression', 'chunk_length_kb', 'crc_check_chance')),
+)
+
+def cql3_escape_value(value):
+return cql_escape(value)
+
+def cql3_escape_name(name):
+return '%s' % name.replace('', '')
+
+valid_cql3_word_re = re.compile(r'^[a-z][0-9a-z_]*$', re.I)
+
+def is_valid_cql3_name(s):
+return valid_cql3_word_re.match(s) is not None and s not in keywords
+
+def maybe_cql3_escape_name(name):
+if is_valid_cql3_name(name):
+return name
+return cql3_escape_name(name)
+
+class CqlColumnDef:
+index_name = None
+
+def __init__(self, name, cqltype):
+self.name = name
+self.cqltype = cqltype
+
+@classmethod
+def from_layout(cls, layout):
+c = cls(layout[u'column'], cql_typename(layout[u'validator']))
+c.index_name = layout[u'index_name']
+return c
+
+def __str__(self):
+indexstr = ' (index %s)' % self.index_name if self.index_name is not 
None else ''
+return 'CqlColumnDef %r %r%s' % (self.name, self.cqltype, indexstr)
+__repr__ = __str__
+
+class CqlTableDef:
+json_attrs = ('column_aliases', 'compaction_strategy_options', 
'compression_parameters')
+composite_type_name = 'org.apache.cassandra.db.marshal.CompositeType'
+colname_type_name = 'org.apache.cassandra.db.marshal.UTF8Type'
+column_class = CqlColumnDef
+compact_storage = False
+
+key_components = ()
+columns = ()
+
+def __init__(self, name):
+self.name = name
+
+@classmethod
+def from_layout(cls, layout, coldefs):
+  

git commit: Add missing file

2012-04-27 Thread brandonwilliams
Updated Branches:
  refs/heads/trunk 5fd586424 - c6f95117d


Add missing file


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c6f95117
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c6f95117
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c6f95117

Branch: refs/heads/trunk
Commit: c6f95117d486795050bbfc2886be0cc645784587
Parents: 5fd5864
Author: Brandon Williams brandonwilli...@apache.org
Authored: Fri Apr 27 17:14:33 2012 -0500
Committer: Brandon Williams brandonwilli...@apache.org
Committed: Fri Apr 27 17:20:12 2012 -0500

--
 pylib/cqlshlib/cql3handling.py |  210 +++
 1 files changed, 210 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c6f95117/pylib/cqlshlib/cql3handling.py
--
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
new file mode 100644
index 000..9d27f44
--- /dev/null
+++ b/pylib/cqlshlib/cql3handling.py
@@ -0,0 +1,210 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+import re
+from warnings import warn
+from .cqlhandling import cql_typename, cql_escape
+
+try:
+import json
+except ImportError:
+import simplejson as json
+
+class UnexpectedTableStructure(UserWarning):
+def __init__(self, msg):
+self.msg = msg
+
+def __str__(self):
+return 'Unexpected table structure; may not translate correctly to 
CQL. ' + self.msg
+
+keywords = set((
+'select', 'from', 'where', 'and', 'key', 'insert', 'update', 'with',
+'limit', 'using', 'consistency', 'one', 'quorum', 'all', 'any',
+'local_quorum', 'each_quorum', 'two', 'three', 'use', 'count', 'set',
+'begin', 'apply', 'batch', 'truncate', 'delete', 'in', 'create',
+'keyspace', 'schema', 'columnfamily', 'table', 'index', 'on', 'drop',
+'primary', 'into', 'values', 'timestamp', 'ttl', 'alter', 'add', 'type',
+'compact', 'storage', 'order', 'by', 'asc', 'desc'
+))
+
+columnfamily_options = (
+'comment',
+'bloom_filter_fp_chance',
+'caching',
+'read_repair_chance',
+# 'local_read_repair_chance',   -- not yet a valid cql option
+'gc_grace_seconds',
+'min_compaction_threshold',
+'max_compaction_threshold',
+'replicate_on_write',
+'compaction_strategy_class',
+)
+
+columnfamily_map_options = (
+('compaction_strategy_options',
+()),
+('compression_parameters',
+('sstable_compression', 'chunk_length_kb', 'crc_check_chance')),
+)
+
+def cql3_escape_value(value):
+return cql_escape(value)
+
+def cql3_escape_name(name):
+return '%s' % name.replace('', '')
+
+valid_cql3_word_re = re.compile(r'^[a-z][0-9a-z_]*$', re.I)
+
+def is_valid_cql3_name(s):
+return valid_cql3_word_re.match(s) is not None and s not in keywords
+
+def maybe_cql3_escape_name(name):
+if is_valid_cql3_name(name):
+return name
+return cql3_escape_name(name)
+
+class CqlColumnDef:
+index_name = None
+
+def __init__(self, name, cqltype):
+self.name = name
+self.cqltype = cqltype
+
+@classmethod
+def from_layout(cls, layout):
+c = cls(layout[u'column'], cql_typename(layout[u'validator']))
+c.index_name = layout[u'index_name']
+return c
+
+def __str__(self):
+indexstr = ' (index %s)' % self.index_name if self.index_name is not 
None else ''
+return 'CqlColumnDef %r %r%s' % (self.name, self.cqltype, indexstr)
+__repr__ = __str__
+
+class CqlTableDef:
+json_attrs = ('column_aliases', 'compaction_strategy_options', 
'compression_parameters')
+composite_type_name = 'org.apache.cassandra.db.marshal.CompositeType'
+colname_type_name = 'org.apache.cassandra.db.marshal.UTF8Type'
+column_class = CqlColumnDef
+compact_storage = False
+
+key_components = ()
+columns = ()
+
+def __init__(self, name):
+self.name = name
+
+@classmethod
+def from_layout(cls, layout, coldefs):
+cf =