Merge branch 'cassandra-1.2' into trunk
Conflicts:
src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0d5ed281
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0d5ed281
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0d5ed281
Branch: refs/heads/trunk
Commit: 0d5ed281f323f8a653017289825e8dc391564b0c
Parents: 0680372 49f220c
Author: Aleksey Yeschenko <[email protected]>
Authored: Thu May 23 17:55:38 2013 +0300
Committer: Aleksey Yeschenko <[email protected]>
Committed: Thu May 23 17:55:38 2013 +0300
----------------------------------------------------------------------
.../cql3/statements/ModificationStatement.java | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0d5ed281/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
----------------------------------------------------------------------
diff --cc
src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
index 5b3e718,322ce7f..133a8ff
--- a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
@@@ -34,71 -31,35 +34,70 @@@ import org.apache.cassandra.exceptions.
import org.apache.cassandra.service.ClientState;
import org.apache.cassandra.service.QueryState;
import org.apache.cassandra.service.StorageProxy;
+import org.apache.cassandra.thrift.ThriftValidation;
import org.apache.cassandra.transport.messages.ResultMessage;
+import org.apache.cassandra.utils.Pair;
-/**
- * Abstract class for statements that apply on a given column family.
+/*
+ * Abstract parent class of individual modifications, i.e. INSERT, UPDATE and
DELETE.
*/
-public abstract class ModificationStatement extends CFStatement implements
CQLStatement
+public abstract class ModificationStatement implements CQLStatement
{
- public static final ConsistencyLevel defaultConsistency =
ConsistencyLevel.ONE;
- public static enum Type
+ private static final ColumnIdentifier RESULT_COLUMN = new
ColumnIdentifier("result", false);
+
+ private final int boundTerms;
+ public final CFMetaData cfm;
+ private final Attributes attrs;
+
+ private final Map<ColumnIdentifier, List<Term>> processedKeys = new
HashMap<ColumnIdentifier, List<Term>>();
+ private final List<Operation> columnOperations = new
ArrayList<Operation>();
+
+ private List<Operation> columnConditions;
+ private boolean ifNotExists;
+
+ public ModificationStatement(int boundTerms, CFMetaData cfm, Attributes
attrs)
{
- LOGGED, UNLOGGED, COUNTER
+ this.boundTerms = boundTerms;
+ this.cfm = cfm;
+ this.attrs = attrs;
}
- protected Type type;
+ protected abstract boolean requireFullClusteringKey();
+ public abstract ColumnFamily updateForKey(ByteBuffer key,
ColumnNameBuilder builder, UpdateParameters params) throws
InvalidRequestException;
- private Long timestamp;
- private final int timeToLive;
+ public int getBoundsTerms()
+ {
+ return boundTerms;
+ }
- public ModificationStatement(CFName name, Attributes attrs)
+ public String keyspace()
{
- this(name, attrs.timestamp, attrs.timeToLive);
+ return cfm.ksName;
}
- public ModificationStatement(CFName name, Long timestamp, int timeToLive)
+ public String columnFamily()
{
- super(name);
- this.timestamp = timestamp;
- this.timeToLive = timeToLive;
+ return cfm.cfName;
+ }
+
+ public boolean isCounter()
+ {
+ return cfm.getDefaultValidator().isCommutative();
+ }
+
+ public int getTimeToLive()
+ {
+ return attrs.timeToLive;
+ }
+
+ public long getTimestamp(long now)
+ {
+ return attrs.timestamp == null ? now : attrs.timestamp;
+ }
+
+ public boolean isSetTimestamp()
+ {
+ return attrs.timestamp != null;
}
public void checkAccess(ClientState state) throws
InvalidRequestException, UnauthorizedException