You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/05/15 22:18:55 UTC
svn commit: r775308 - in /incubator/cassandra/trunk: interface/
interface/gen-java/org/apache/cassandra/service/
src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/service/
test/unit/org/apache/cassandra/db/
Author: jbellis
Date: Fri May 15 20:18:55 2009
New Revision: 775308
URL: http://svn.apache.org/viewvc?rev=775308&view=rev
Log:
add get_slice_by_name_range command. patch by Sandeep Tata; reviewed by jbellis for CASSANDRA-53
Modified:
incubator/cassandra/trunk/interface/cassandra.thrift
incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadCommand.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java
Modified: incubator/cassandra/trunk/interface/cassandra.thrift
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/cassandra.thrift?rev=775308&r1=775307&r2=775308&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/cassandra.thrift (original)
+++ incubator/cassandra/trunk/interface/cassandra.thrift Fri May 15 20:18:55 2009
@@ -80,7 +80,10 @@
list<column_t> get_slice(1:string tablename, 2:string key, 3:string columnFamily_column, 4:i32 start=-1, 5:i32 count=-1)
throws (1: InvalidRequestException ire, 2: NotFoundException nfe),
- list<column_t> get_slice_by_names(1:string tablename, 2:string key, 3:string columnFamily, 4:list<string> columnNames)
+ list<column_t> get_slice_by_name_range(1:string tablename, 2:string key, 3:string columnFamily, 4:string start, 5:string end, 6:i32 count=-1)
+ throws (1: InvalidRequestException ire, 2: NotFoundException nfe),
+
+list<column_t> get_slice_by_names(1:string tablename, 2:string key, 3:string columnFamily, 4:list<string> columnNames)
throws (1: InvalidRequestException ire, 2: NotFoundException nfe),
column_t get_column(1:string tablename, 2:string key, 3:string columnFamily_column)
@@ -124,15 +127,15 @@
/////////////////////////////////////////////////////////////////////////////////////
// get property whose value is of type "string"
- string getStringProperty(string propertyName),
+ string getStringProperty(1:string propertyName),
// get property whose value is list of "strings"
- list<string> getStringListProperty(string propertyName),
+ list<string> getStringListProperty(1:string propertyName),
// describe specified table
- string describeTable(string tableName),
+ string describeTable(1:string tableName),
// execute a CQL query
- CqlResult_t executeQuery(string query)
+ CqlResult_t executeQuery(1:string query)
}
Modified: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java?rev=775308&r1=775307&r2=775308&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java (original)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java Fri May 15 20:18:55 2009
@@ -24,6 +24,8 @@
public List<column_t> get_slice(String tablename, String key, String columnFamily_column, int start, int count) throws InvalidRequestException, NotFoundException, TException;
+ public List<column_t> get_slice_by_name_range(String tablename, String key, String columnFamily, String start, String end, int count) throws InvalidRequestException, NotFoundException, TException;
+
public List<column_t> get_slice_by_names(String tablename, String key, String columnFamily, List<String> columnNames) throws InvalidRequestException, NotFoundException, TException;
public column_t get_column(String tablename, String key, String columnFamily_column) throws InvalidRequestException, NotFoundException, TException;
@@ -130,6 +132,50 @@
throw new TApplicationException(TApplicationException.MISSING_RESULT, "get_slice failed: unknown result");
}
+ public List<column_t> get_slice_by_name_range(String tablename, String key, String columnFamily, String start, String end, int count) throws InvalidRequestException, NotFoundException, TException
+ {
+ send_get_slice_by_name_range(tablename, key, columnFamily, start, end, count);
+ return recv_get_slice_by_name_range();
+ }
+
+ public void send_get_slice_by_name_range(String tablename, String key, String columnFamily, String start, String end, int count) throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("get_slice_by_name_range", TMessageType.CALL, seqid_));
+ get_slice_by_name_range_args args = new get_slice_by_name_range_args();
+ args.tablename = tablename;
+ args.key = key;
+ args.columnFamily = columnFamily;
+ args.start = start;
+ args.end = end;
+ args.count = count;
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public List<column_t> recv_get_slice_by_name_range() throws InvalidRequestException, NotFoundException, TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ get_slice_by_name_range_result result = new get_slice_by_name_range_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ if (result.ire != null) {
+ throw result.ire;
+ }
+ if (result.nfe != null) {
+ throw result.nfe;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "get_slice_by_name_range failed: unknown result");
+ }
+
public List<column_t> get_slice_by_names(String tablename, String key, String columnFamily, List<String> columnNames) throws InvalidRequestException, NotFoundException, TException
{
send_get_slice_by_names(tablename, key, columnFamily, columnNames);
@@ -762,6 +808,7 @@
{
iface_ = iface;
processMap_.put("get_slice", new get_slice());
+ processMap_.put("get_slice_by_name_range", new get_slice_by_name_range());
processMap_.put("get_slice_by_names", new get_slice_by_names());
processMap_.put("get_column", new get_column());
processMap_.put("get_column_count", new get_column_count());
@@ -836,6 +883,36 @@
}
+ private class get_slice_by_name_range implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ get_slice_by_name_range_args args = new get_slice_by_name_range_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ get_slice_by_name_range_result result = new get_slice_by_name_range_result();
+ try {
+ result.success = iface_.get_slice_by_name_range(args.tablename, args.key, args.columnFamily, args.start, args.end, args.count);
+ } catch (InvalidRequestException ire) {
+ result.ire = ire;
+ } catch (NotFoundException nfe) {
+ result.nfe = nfe;
+ } catch (Throwable th) {
+ LOGGER.error("Internal error processing get_slice_by_name_range", th);
+ TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing get_slice_by_name_range");
+ oprot.writeMessageBegin(new TMessage("get_slice_by_name_range", TMessageType.EXCEPTION, seqid));
+ x.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ return;
+ }
+ oprot.writeMessageBegin(new TMessage("get_slice_by_name_range", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
private class get_slice_by_names implements ProcessFunction {
public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
{
@@ -1266,28 +1343,908 @@
}
- public static class get_slice_args implements TBase, java.io.Serializable, Cloneable {
- private static final TStruct STRUCT_DESC = new TStruct("get_slice_args");
+ public static class get_slice_args implements TBase, java.io.Serializable, Cloneable {
+ private static final TStruct STRUCT_DESC = new TStruct("get_slice_args");
+ private static final TField TABLENAME_FIELD_DESC = new TField("tablename", TType.STRING, (short)1);
+ private static final TField KEY_FIELD_DESC = new TField("key", TType.STRING, (short)2);
+ private static final TField COLUMN_FAMILY_COLUMN_FIELD_DESC = new TField("columnFamily_column", TType.STRING, (short)3);
+ private static final TField START_FIELD_DESC = new TField("start", TType.I32, (short)4);
+ private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)5);
+
+ public String tablename;
+ public static final int TABLENAME = 1;
+ public String key;
+ public static final int KEY = 2;
+ public String columnFamily_column;
+ public static final int COLUMNFAMILY_COLUMN = 3;
+ public int start;
+ public static final int START = 4;
+ public int count;
+ public static final int COUNT = 5;
+
+ private final Isset __isset = new Isset();
+ private static final class Isset implements java.io.Serializable {
+ public boolean start = false;
+ public boolean count = false;
+ }
+
+ public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
+ put(TABLENAME, new FieldMetaData("tablename", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ put(KEY, new FieldMetaData("key", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ put(COLUMNFAMILY_COLUMN, new FieldMetaData("columnFamily_column", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ put(START, new FieldMetaData("start", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.I32)));
+ put(COUNT, new FieldMetaData("count", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.I32)));
+ }});
+
+ static {
+ FieldMetaData.addStructMetaDataMap(get_slice_args.class, metaDataMap);
+ }
+
+ public get_slice_args() {
+ this.start = -1;
+
+ this.count = -1;
+
+ }
+
+ public get_slice_args(
+ String tablename,
+ String key,
+ String columnFamily_column,
+ int start,
+ int count)
+ {
+ this();
+ this.tablename = tablename;
+ this.key = key;
+ this.columnFamily_column = columnFamily_column;
+ this.start = start;
+ this.__isset.start = true;
+ this.count = count;
+ this.__isset.count = true;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public get_slice_args(get_slice_args other) {
+ if (other.isSetTablename()) {
+ this.tablename = other.tablename;
+ }
+ if (other.isSetKey()) {
+ this.key = other.key;
+ }
+ if (other.isSetColumnFamily_column()) {
+ this.columnFamily_column = other.columnFamily_column;
+ }
+ __isset.start = other.__isset.start;
+ this.start = other.start;
+ __isset.count = other.__isset.count;
+ this.count = other.count;
+ }
+
+ @Override
+ public get_slice_args clone() {
+ return new get_slice_args(this);
+ }
+
+ public String getTablename() {
+ return this.tablename;
+ }
+
+ public void setTablename(String tablename) {
+ this.tablename = tablename;
+ }
+
+ public void unsetTablename() {
+ this.tablename = null;
+ }
+
+ // Returns true if field tablename is set (has been asigned a value) and false otherwise
+ public boolean isSetTablename() {
+ return this.tablename != null;
+ }
+
+ public void setTablenameIsSet(boolean value) {
+ if (!value) {
+ this.tablename = null;
+ }
+ }
+
+ public String getKey() {
+ return this.key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public void unsetKey() {
+ this.key = null;
+ }
+
+ // Returns true if field key is set (has been asigned a value) and false otherwise
+ public boolean isSetKey() {
+ return this.key != null;
+ }
+
+ public void setKeyIsSet(boolean value) {
+ if (!value) {
+ this.key = null;
+ }
+ }
+
+ public String getColumnFamily_column() {
+ return this.columnFamily_column;
+ }
+
+ public void setColumnFamily_column(String columnFamily_column) {
+ this.columnFamily_column = columnFamily_column;
+ }
+
+ public void unsetColumnFamily_column() {
+ this.columnFamily_column = null;
+ }
+
+ // Returns true if field columnFamily_column is set (has been asigned a value) and false otherwise
+ public boolean isSetColumnFamily_column() {
+ return this.columnFamily_column != null;
+ }
+
+ public void setColumnFamily_columnIsSet(boolean value) {
+ if (!value) {
+ this.columnFamily_column = null;
+ }
+ }
+
+ public int getStart() {
+ return this.start;
+ }
+
+ public void setStart(int start) {
+ this.start = start;
+ this.__isset.start = true;
+ }
+
+ public void unsetStart() {
+ this.__isset.start = false;
+ }
+
+ // Returns true if field start is set (has been asigned a value) and false otherwise
+ public boolean isSetStart() {
+ return this.__isset.start;
+ }
+
+ public void setStartIsSet(boolean value) {
+ this.__isset.start = value;
+ }
+
+ public int getCount() {
+ return this.count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ this.__isset.count = true;
+ }
+
+ public void unsetCount() {
+ this.__isset.count = false;
+ }
+
+ // Returns true if field count is set (has been asigned a value) and false otherwise
+ public boolean isSetCount() {
+ return this.__isset.count;
+ }
+
+ public void setCountIsSet(boolean value) {
+ this.__isset.count = value;
+ }
+
+ public void setFieldValue(int fieldID, Object value) {
+ switch (fieldID) {
+ case TABLENAME:
+ if (value == null) {
+ unsetTablename();
+ } else {
+ setTablename((String)value);
+ }
+ break;
+
+ case KEY:
+ if (value == null) {
+ unsetKey();
+ } else {
+ setKey((String)value);
+ }
+ break;
+
+ case COLUMNFAMILY_COLUMN:
+ if (value == null) {
+ unsetColumnFamily_column();
+ } else {
+ setColumnFamily_column((String)value);
+ }
+ break;
+
+ case START:
+ if (value == null) {
+ unsetStart();
+ } else {
+ setStart((Integer)value);
+ }
+ break;
+
+ case COUNT:
+ if (value == null) {
+ unsetCount();
+ } else {
+ setCount((Integer)value);
+ }
+ break;
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ public Object getFieldValue(int fieldID) {
+ switch (fieldID) {
+ case TABLENAME:
+ return getTablename();
+
+ case KEY:
+ return getKey();
+
+ case COLUMNFAMILY_COLUMN:
+ return getColumnFamily_column();
+
+ case START:
+ return new Integer(getStart());
+
+ case COUNT:
+ return new Integer(getCount());
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
+ public boolean isSet(int fieldID) {
+ switch (fieldID) {
+ case TABLENAME:
+ return isSetTablename();
+ case KEY:
+ return isSetKey();
+ case COLUMNFAMILY_COLUMN:
+ return isSetColumnFamily_column();
+ case START:
+ return isSetStart();
+ case COUNT:
+ return isSetCount();
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof get_slice_args)
+ return this.equals((get_slice_args)that);
+ return false;
+ }
+
+ public boolean equals(get_slice_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_tablename = true && this.isSetTablename();
+ boolean that_present_tablename = true && that.isSetTablename();
+ if (this_present_tablename || that_present_tablename) {
+ if (!(this_present_tablename && that_present_tablename))
+ return false;
+ if (!this.tablename.equals(that.tablename))
+ return false;
+ }
+
+ boolean this_present_key = true && this.isSetKey();
+ boolean that_present_key = true && that.isSetKey();
+ if (this_present_key || that_present_key) {
+ if (!(this_present_key && that_present_key))
+ return false;
+ if (!this.key.equals(that.key))
+ return false;
+ }
+
+ boolean this_present_columnFamily_column = true && this.isSetColumnFamily_column();
+ boolean that_present_columnFamily_column = true && that.isSetColumnFamily_column();
+ if (this_present_columnFamily_column || that_present_columnFamily_column) {
+ if (!(this_present_columnFamily_column && that_present_columnFamily_column))
+ return false;
+ if (!this.columnFamily_column.equals(that.columnFamily_column))
+ return false;
+ }
+
+ boolean this_present_start = true;
+ boolean that_present_start = true;
+ if (this_present_start || that_present_start) {
+ if (!(this_present_start && that_present_start))
+ return false;
+ if (this.start != that.start)
+ return false;
+ }
+
+ boolean this_present_count = true;
+ boolean that_present_count = true;
+ if (this_present_count || that_present_count) {
+ if (!(this_present_count && that_present_count))
+ return false;
+ if (this.count != that.count)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case TABLENAME:
+ if (field.type == TType.STRING) {
+ this.tablename = iprot.readString();
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case KEY:
+ if (field.type == TType.STRING) {
+ this.key = iprot.readString();
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case COLUMNFAMILY_COLUMN:
+ if (field.type == TType.STRING) {
+ this.columnFamily_column = iprot.readString();
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case START:
+ if (field.type == TType.I32) {
+ this.start = iprot.readI32();
+ this.__isset.start = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case COUNT:
+ if (field.type == TType.I32) {
+ this.count = iprot.readI32();
+ this.__isset.count = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ validate();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (this.tablename != null) {
+ oprot.writeFieldBegin(TABLENAME_FIELD_DESC);
+ oprot.writeString(this.tablename);
+ oprot.writeFieldEnd();
+ }
+ if (this.key != null) {
+ oprot.writeFieldBegin(KEY_FIELD_DESC);
+ oprot.writeString(this.key);
+ oprot.writeFieldEnd();
+ }
+ if (this.columnFamily_column != null) {
+ oprot.writeFieldBegin(COLUMN_FAMILY_COLUMN_FIELD_DESC);
+ oprot.writeString(this.columnFamily_column);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(START_FIELD_DESC);
+ oprot.writeI32(this.start);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(COUNT_FIELD_DESC);
+ oprot.writeI32(this.count);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("get_slice_args(");
+ boolean first = true;
+
+ sb.append("tablename:");
+ if (this.tablename == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.tablename);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("key:");
+ if (this.key == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.key);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("columnFamily_column:");
+ if (this.columnFamily_column == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.columnFamily_column);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("start:");
+ sb.append(this.start);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("count:");
+ sb.append(this.count);
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws TException {
+ // check for required fields
+ // check that fields of type enum have valid values
+ }
+
+ }
+
+ public static class get_slice_result implements TBase, java.io.Serializable, Cloneable {
+ private static final TStruct STRUCT_DESC = new TStruct("get_slice_result");
+ private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
+ private static final TField IRE_FIELD_DESC = new TField("ire", TType.STRUCT, (short)1);
+ private static final TField NFE_FIELD_DESC = new TField("nfe", TType.STRUCT, (short)2);
+
+ public List<column_t> success;
+ public static final int SUCCESS = 0;
+ public InvalidRequestException ire;
+ public static final int IRE = 1;
+ public NotFoundException nfe;
+ public static final int NFE = 2;
+
+ private final Isset __isset = new Isset();
+ private static final class Isset implements java.io.Serializable {
+ }
+
+ public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
+ put(SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT,
+ new ListMetaData(TType.LIST,
+ new StructMetaData(TType.STRUCT, column_t.class))));
+ put(IRE, new FieldMetaData("ire", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRUCT)));
+ put(NFE, new FieldMetaData("nfe", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRUCT)));
+ }});
+
+ static {
+ FieldMetaData.addStructMetaDataMap(get_slice_result.class, metaDataMap);
+ }
+
+ public get_slice_result() {
+ }
+
+ public get_slice_result(
+ List<column_t> success,
+ InvalidRequestException ire,
+ NotFoundException nfe)
+ {
+ this();
+ this.success = success;
+ this.ire = ire;
+ this.nfe = nfe;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public get_slice_result(get_slice_result other) {
+ if (other.isSetSuccess()) {
+ List<column_t> __this__success = new ArrayList<column_t>();
+ for (column_t other_element : other.success) {
+ __this__success.add(new column_t(other_element));
+ }
+ this.success = __this__success;
+ }
+ if (other.isSetIre()) {
+ this.ire = new InvalidRequestException(other.ire);
+ }
+ if (other.isSetNfe()) {
+ this.nfe = new NotFoundException(other.nfe);
+ }
+ }
+
+ @Override
+ public get_slice_result clone() {
+ return new get_slice_result(this);
+ }
+
+ public int getSuccessSize() {
+ return (this.success == null) ? 0 : this.success.size();
+ }
+
+ public java.util.Iterator<column_t> getSuccessIterator() {
+ return (this.success == null) ? null : this.success.iterator();
+ }
+
+ public void addToSuccess(column_t elem) {
+ if (this.success == null) {
+ this.success = new ArrayList<column_t>();
+ }
+ this.success.add(elem);
+ }
+
+ public List<column_t> getSuccess() {
+ return this.success;
+ }
+
+ public void setSuccess(List<column_t> success) {
+ this.success = success;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ }
+
+ // Returns true if field success is set (has been asigned a value) and false otherwise
+ public boolean isSetSuccess() {
+ return this.success != null;
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ if (!value) {
+ this.success = null;
+ }
+ }
+
+ public InvalidRequestException getIre() {
+ return this.ire;
+ }
+
+ public void setIre(InvalidRequestException ire) {
+ this.ire = ire;
+ }
+
+ public void unsetIre() {
+ this.ire = null;
+ }
+
+ // Returns true if field ire is set (has been asigned a value) and false otherwise
+ public boolean isSetIre() {
+ return this.ire != null;
+ }
+
+ public void setIreIsSet(boolean value) {
+ if (!value) {
+ this.ire = null;
+ }
+ }
+
+ public NotFoundException getNfe() {
+ return this.nfe;
+ }
+
+ public void setNfe(NotFoundException nfe) {
+ this.nfe = nfe;
+ }
+
+ public void unsetNfe() {
+ this.nfe = null;
+ }
+
+ // Returns true if field nfe is set (has been asigned a value) and false otherwise
+ public boolean isSetNfe() {
+ return this.nfe != null;
+ }
+
+ public void setNfeIsSet(boolean value) {
+ if (!value) {
+ this.nfe = null;
+ }
+ }
+
+ public void setFieldValue(int fieldID, Object value) {
+ switch (fieldID) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((List<column_t>)value);
+ }
+ break;
+
+ case IRE:
+ if (value == null) {
+ unsetIre();
+ } else {
+ setIre((InvalidRequestException)value);
+ }
+ break;
+
+ case NFE:
+ if (value == null) {
+ unsetNfe();
+ } else {
+ setNfe((NotFoundException)value);
+ }
+ break;
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ public Object getFieldValue(int fieldID) {
+ switch (fieldID) {
+ case SUCCESS:
+ return getSuccess();
+
+ case IRE:
+ return getIre();
+
+ case NFE:
+ return getNfe();
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
+ public boolean isSet(int fieldID) {
+ switch (fieldID) {
+ case SUCCESS:
+ return isSetSuccess();
+ case IRE:
+ return isSetIre();
+ case NFE:
+ return isSetNfe();
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof get_slice_result)
+ return this.equals((get_slice_result)that);
+ return false;
+ }
+
+ public boolean equals(get_slice_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && this.isSetSuccess();
+ boolean that_present_success = true && that.isSetSuccess();
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ boolean this_present_ire = true && this.isSetIre();
+ boolean that_present_ire = true && that.isSetIre();
+ if (this_present_ire || that_present_ire) {
+ if (!(this_present_ire && that_present_ire))
+ return false;
+ if (!this.ire.equals(that.ire))
+ return false;
+ }
+
+ boolean this_present_nfe = true && this.isSetNfe();
+ boolean that_present_nfe = true && that.isSetNfe();
+ if (this_present_nfe || that_present_nfe) {
+ if (!(this_present_nfe && that_present_nfe))
+ return false;
+ if (!this.nfe.equals(that.nfe))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case SUCCESS:
+ if (field.type == TType.LIST) {
+ {
+ TList _list31 = iprot.readListBegin();
+ this.success = new ArrayList<column_t>(_list31.size);
+ for (int _i32 = 0; _i32 < _list31.size; ++_i32)
+ {
+ column_t _elem33;
+ _elem33 = new column_t();
+ _elem33.read(iprot);
+ this.success.add(_elem33);
+ }
+ iprot.readListEnd();
+ }
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case IRE:
+ if (field.type == TType.STRUCT) {
+ this.ire = new InvalidRequestException();
+ this.ire.read(iprot);
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case NFE:
+ if (field.type == TType.STRUCT) {
+ this.nfe = new NotFoundException();
+ this.nfe.read(iprot);
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ validate();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ oprot.writeStructBegin(STRUCT_DESC);
+
+ if (this.isSetSuccess()) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
+ for (column_t _iter34 : this.success) {
+ _iter34.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ } else if (this.isSetIre()) {
+ oprot.writeFieldBegin(IRE_FIELD_DESC);
+ this.ire.write(oprot);
+ oprot.writeFieldEnd();
+ } else if (this.isSetNfe()) {
+ oprot.writeFieldBegin(NFE_FIELD_DESC);
+ this.nfe.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("get_slice_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ if (this.success == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.success);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("ire:");
+ if (this.ire == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.ire);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("nfe:");
+ if (this.nfe == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.nfe);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws TException {
+ // check for required fields
+ // check that fields of type enum have valid values
+ }
+
+ }
+
+ public static class get_slice_by_name_range_args implements TBase, java.io.Serializable, Cloneable {
+ private static final TStruct STRUCT_DESC = new TStruct("get_slice_by_name_range_args");
private static final TField TABLENAME_FIELD_DESC = new TField("tablename", TType.STRING, (short)1);
private static final TField KEY_FIELD_DESC = new TField("key", TType.STRING, (short)2);
- private static final TField COLUMN_FAMILY_COLUMN_FIELD_DESC = new TField("columnFamily_column", TType.STRING, (short)3);
- private static final TField START_FIELD_DESC = new TField("start", TType.I32, (short)4);
- private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)5);
+ private static final TField COLUMN_FAMILY_FIELD_DESC = new TField("columnFamily", TType.STRING, (short)3);
+ private static final TField START_FIELD_DESC = new TField("start", TType.STRING, (short)4);
+ private static final TField END_FIELD_DESC = new TField("end", TType.STRING, (short)5);
+ private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)6);
public String tablename;
public static final int TABLENAME = 1;
public String key;
public static final int KEY = 2;
- public String columnFamily_column;
- public static final int COLUMNFAMILY_COLUMN = 3;
- public int start;
+ public String columnFamily;
+ public static final int COLUMNFAMILY = 3;
+ public String start;
public static final int START = 4;
+ public String end;
+ public static final int END = 5;
public int count;
- public static final int COUNT = 5;
+ public static final int COUNT = 6;
private final Isset __isset = new Isset();
private static final class Isset implements java.io.Serializable {
- public boolean start = false;
public boolean count = false;
}
@@ -1296,38 +2253,39 @@
new FieldValueMetaData(TType.STRING)));
put(KEY, new FieldMetaData("key", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
- put(COLUMNFAMILY_COLUMN, new FieldMetaData("columnFamily_column", TFieldRequirementType.DEFAULT,
+ put(COLUMNFAMILY, new FieldMetaData("columnFamily", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
put(START, new FieldMetaData("start", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.I32)));
+ new FieldValueMetaData(TType.STRING)));
+ put(END, new FieldMetaData("end", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
put(COUNT, new FieldMetaData("count", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I32)));
}});
static {
- FieldMetaData.addStructMetaDataMap(get_slice_args.class, metaDataMap);
+ FieldMetaData.addStructMetaDataMap(get_slice_by_name_range_args.class, metaDataMap);
}
- public get_slice_args() {
- this.start = -1;
-
+ public get_slice_by_name_range_args() {
this.count = -1;
}
- public get_slice_args(
+ public get_slice_by_name_range_args(
String tablename,
String key,
- String columnFamily_column,
- int start,
+ String columnFamily,
+ String start,
+ String end,
int count)
{
this();
this.tablename = tablename;
this.key = key;
- this.columnFamily_column = columnFamily_column;
+ this.columnFamily = columnFamily;
this.start = start;
- this.__isset.start = true;
+ this.end = end;
this.count = count;
this.__isset.count = true;
}
@@ -1335,25 +2293,29 @@
/**
* Performs a deep copy on <i>other</i>.
*/
- public get_slice_args(get_slice_args other) {
+ public get_slice_by_name_range_args(get_slice_by_name_range_args other) {
if (other.isSetTablename()) {
this.tablename = other.tablename;
}
if (other.isSetKey()) {
this.key = other.key;
}
- if (other.isSetColumnFamily_column()) {
- this.columnFamily_column = other.columnFamily_column;
+ if (other.isSetColumnFamily()) {
+ this.columnFamily = other.columnFamily;
+ }
+ if (other.isSetStart()) {
+ this.start = other.start;
+ }
+ if (other.isSetEnd()) {
+ this.end = other.end;
}
- __isset.start = other.__isset.start;
- this.start = other.start;
__isset.count = other.__isset.count;
this.count = other.count;
}
@Override
- public get_slice_args clone() {
- return new get_slice_args(this);
+ public get_slice_by_name_range_args clone() {
+ return new get_slice_by_name_range_args(this);
}
public String getTablename() {
@@ -1402,49 +2364,73 @@
}
}
- public String getColumnFamily_column() {
- return this.columnFamily_column;
+ public String getColumnFamily() {
+ return this.columnFamily;
}
- public void setColumnFamily_column(String columnFamily_column) {
- this.columnFamily_column = columnFamily_column;
+ public void setColumnFamily(String columnFamily) {
+ this.columnFamily = columnFamily;
}
- public void unsetColumnFamily_column() {
- this.columnFamily_column = null;
+ public void unsetColumnFamily() {
+ this.columnFamily = null;
}
- // Returns true if field columnFamily_column is set (has been asigned a value) and false otherwise
- public boolean isSetColumnFamily_column() {
- return this.columnFamily_column != null;
+ // Returns true if field columnFamily is set (has been asigned a value) and false otherwise
+ public boolean isSetColumnFamily() {
+ return this.columnFamily != null;
}
- public void setColumnFamily_columnIsSet(boolean value) {
+ public void setColumnFamilyIsSet(boolean value) {
if (!value) {
- this.columnFamily_column = null;
+ this.columnFamily = null;
}
}
- public int getStart() {
+ public String getStart() {
return this.start;
}
- public void setStart(int start) {
+ public void setStart(String start) {
this.start = start;
- this.__isset.start = true;
}
public void unsetStart() {
- this.__isset.start = false;
+ this.start = null;
}
// Returns true if field start is set (has been asigned a value) and false otherwise
public boolean isSetStart() {
- return this.__isset.start;
+ return this.start != null;
}
public void setStartIsSet(boolean value) {
- this.__isset.start = value;
+ if (!value) {
+ this.start = null;
+ }
+ }
+
+ public String getEnd() {
+ return this.end;
+ }
+
+ public void setEnd(String end) {
+ this.end = end;
+ }
+
+ public void unsetEnd() {
+ this.end = null;
+ }
+
+ // Returns true if field end is set (has been asigned a value) and false otherwise
+ public boolean isSetEnd() {
+ return this.end != null;
+ }
+
+ public void setEndIsSet(boolean value) {
+ if (!value) {
+ this.end = null;
+ }
}
public int getCount() {
@@ -1487,11 +2473,11 @@
}
break;
- case COLUMNFAMILY_COLUMN:
+ case COLUMNFAMILY:
if (value == null) {
- unsetColumnFamily_column();
+ unsetColumnFamily();
} else {
- setColumnFamily_column((String)value);
+ setColumnFamily((String)value);
}
break;
@@ -1499,7 +2485,15 @@
if (value == null) {
unsetStart();
} else {
- setStart((Integer)value);
+ setStart((String)value);
+ }
+ break;
+
+ case END:
+ if (value == null) {
+ unsetEnd();
+ } else {
+ setEnd((String)value);
}
break;
@@ -1524,11 +2518,14 @@
case KEY:
return getKey();
- case COLUMNFAMILY_COLUMN:
- return getColumnFamily_column();
+ case COLUMNFAMILY:
+ return getColumnFamily();
case START:
- return new Integer(getStart());
+ return getStart();
+
+ case END:
+ return getEnd();
case COUNT:
return new Integer(getCount());
@@ -1545,10 +2542,12 @@
return isSetTablename();
case KEY:
return isSetKey();
- case COLUMNFAMILY_COLUMN:
- return isSetColumnFamily_column();
+ case COLUMNFAMILY:
+ return isSetColumnFamily();
case START:
return isSetStart();
+ case END:
+ return isSetEnd();
case COUNT:
return isSetCount();
default:
@@ -1560,12 +2559,12 @@
public boolean equals(Object that) {
if (that == null)
return false;
- if (that instanceof get_slice_args)
- return this.equals((get_slice_args)that);
+ if (that instanceof get_slice_by_name_range_args)
+ return this.equals((get_slice_by_name_range_args)that);
return false;
}
- public boolean equals(get_slice_args that) {
+ public boolean equals(get_slice_by_name_range_args that) {
if (that == null)
return false;
@@ -1587,21 +2586,30 @@
return false;
}
- boolean this_present_columnFamily_column = true && this.isSetColumnFamily_column();
- boolean that_present_columnFamily_column = true && that.isSetColumnFamily_column();
- if (this_present_columnFamily_column || that_present_columnFamily_column) {
- if (!(this_present_columnFamily_column && that_present_columnFamily_column))
+ boolean this_present_columnFamily = true && this.isSetColumnFamily();
+ boolean that_present_columnFamily = true && that.isSetColumnFamily();
+ if (this_present_columnFamily || that_present_columnFamily) {
+ if (!(this_present_columnFamily && that_present_columnFamily))
return false;
- if (!this.columnFamily_column.equals(that.columnFamily_column))
+ if (!this.columnFamily.equals(that.columnFamily))
return false;
}
- boolean this_present_start = true;
- boolean that_present_start = true;
+ boolean this_present_start = true && this.isSetStart();
+ boolean that_present_start = true && that.isSetStart();
if (this_present_start || that_present_start) {
if (!(this_present_start && that_present_start))
return false;
- if (this.start != that.start)
+ if (!this.start.equals(that.start))
+ return false;
+ }
+
+ boolean this_present_end = true && this.isSetEnd();
+ boolean that_present_end = true && that.isSetEnd();
+ if (this_present_end || that_present_end) {
+ if (!(this_present_end && that_present_end))
+ return false;
+ if (!this.end.equals(that.end))
return false;
}
@@ -1647,17 +2655,23 @@
TProtocolUtil.skip(iprot, field.type);
}
break;
- case COLUMNFAMILY_COLUMN:
+ case COLUMNFAMILY:
if (field.type == TType.STRING) {
- this.columnFamily_column = iprot.readString();
+ this.columnFamily = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case START:
- if (field.type == TType.I32) {
- this.start = iprot.readI32();
- this.__isset.start = true;
+ if (field.type == TType.STRING) {
+ this.start = iprot.readString();
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case END:
+ if (field.type == TType.STRING) {
+ this.end = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -1697,14 +2711,21 @@
oprot.writeString(this.key);
oprot.writeFieldEnd();
}
- if (this.columnFamily_column != null) {
- oprot.writeFieldBegin(COLUMN_FAMILY_COLUMN_FIELD_DESC);
- oprot.writeString(this.columnFamily_column);
+ if (this.columnFamily != null) {
+ oprot.writeFieldBegin(COLUMN_FAMILY_FIELD_DESC);
+ oprot.writeString(this.columnFamily);
+ oprot.writeFieldEnd();
+ }
+ if (this.start != null) {
+ oprot.writeFieldBegin(START_FIELD_DESC);
+ oprot.writeString(this.start);
+ oprot.writeFieldEnd();
+ }
+ if (this.end != null) {
+ oprot.writeFieldBegin(END_FIELD_DESC);
+ oprot.writeString(this.end);
oprot.writeFieldEnd();
}
- oprot.writeFieldBegin(START_FIELD_DESC);
- oprot.writeI32(this.start);
- oprot.writeFieldEnd();
oprot.writeFieldBegin(COUNT_FIELD_DESC);
oprot.writeI32(this.count);
oprot.writeFieldEnd();
@@ -1714,7 +2735,7 @@
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("get_slice_args(");
+ StringBuilder sb = new StringBuilder("get_slice_by_name_range_args(");
boolean first = true;
sb.append("tablename:");
@@ -1733,16 +2754,28 @@
}
first = false;
if (!first) sb.append(", ");
- sb.append("columnFamily_column:");
- if (this.columnFamily_column == null) {
+ sb.append("columnFamily:");
+ if (this.columnFamily == null) {
sb.append("null");
} else {
- sb.append(this.columnFamily_column);
+ sb.append(this.columnFamily);
}
first = false;
if (!first) sb.append(", ");
sb.append("start:");
- sb.append(this.start);
+ if (this.start == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.start);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("end:");
+ if (this.end == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.end);
+ }
first = false;
if (!first) sb.append(", ");
sb.append("count:");
@@ -1759,8 +2792,8 @@
}
- public static class get_slice_result implements TBase, java.io.Serializable, Cloneable {
- private static final TStruct STRUCT_DESC = new TStruct("get_slice_result");
+ public static class get_slice_by_name_range_result implements TBase, java.io.Serializable, Cloneable {
+ private static final TStruct STRUCT_DESC = new TStruct("get_slice_by_name_range_result");
private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
private static final TField IRE_FIELD_DESC = new TField("ire", TType.STRUCT, (short)1);
private static final TField NFE_FIELD_DESC = new TField("nfe", TType.STRUCT, (short)2);
@@ -1787,13 +2820,13 @@
}});
static {
- FieldMetaData.addStructMetaDataMap(get_slice_result.class, metaDataMap);
+ FieldMetaData.addStructMetaDataMap(get_slice_by_name_range_result.class, metaDataMap);
}
- public get_slice_result() {
+ public get_slice_by_name_range_result() {
}
- public get_slice_result(
+ public get_slice_by_name_range_result(
List<column_t> success,
InvalidRequestException ire,
NotFoundException nfe)
@@ -1807,7 +2840,7 @@
/**
* Performs a deep copy on <i>other</i>.
*/
- public get_slice_result(get_slice_result other) {
+ public get_slice_by_name_range_result(get_slice_by_name_range_result other) {
if (other.isSetSuccess()) {
List<column_t> __this__success = new ArrayList<column_t>();
for (column_t other_element : other.success) {
@@ -1824,8 +2857,8 @@
}
@Override
- public get_slice_result clone() {
- return new get_slice_result(this);
+ public get_slice_by_name_range_result clone() {
+ return new get_slice_by_name_range_result(this);
}
public int getSuccessSize() {
@@ -1977,12 +3010,12 @@
public boolean equals(Object that) {
if (that == null)
return false;
- if (that instanceof get_slice_result)
- return this.equals((get_slice_result)that);
+ if (that instanceof get_slice_by_name_range_result)
+ return this.equals((get_slice_by_name_range_result)that);
return false;
}
- public boolean equals(get_slice_result that) {
+ public boolean equals(get_slice_by_name_range_result that) {
if (that == null)
return false;
@@ -2035,14 +3068,14 @@
case SUCCESS:
if (field.type == TType.LIST) {
{
- TList _list31 = iprot.readListBegin();
- this.success = new ArrayList<column_t>(_list31.size);
- for (int _i32 = 0; _i32 < _list31.size; ++_i32)
+ TList _list35 = iprot.readListBegin();
+ this.success = new ArrayList<column_t>(_list35.size);
+ for (int _i36 = 0; _i36 < _list35.size; ++_i36)
{
- column_t _elem33;
- _elem33 = new column_t();
- _elem33.read(iprot);
- this.success.add(_elem33);
+ column_t _elem37;
+ _elem37 = new column_t();
+ _elem37.read(iprot);
+ this.success.add(_elem37);
}
iprot.readListEnd();
}
@@ -2086,8 +3119,8 @@
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
- for (column_t _iter34 : this.success) {
- _iter34.write(oprot);
+ for (column_t _iter38 : this.success) {
+ _iter38.write(oprot);
}
oprot.writeListEnd();
}
@@ -2107,7 +3140,7 @@
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("get_slice_result(");
+ StringBuilder sb = new StringBuilder("get_slice_by_name_range_result(");
boolean first = true;
sb.append("success:");
@@ -2496,13 +3529,13 @@
case COLUMNNAMES:
if (field.type == TType.LIST) {
{
- TList _list35 = iprot.readListBegin();
- this.columnNames = new ArrayList<String>(_list35.size);
- for (int _i36 = 0; _i36 < _list35.size; ++_i36)
+ TList _list39 = iprot.readListBegin();
+ this.columnNames = new ArrayList<String>(_list39.size);
+ for (int _i40 = 0; _i40 < _list39.size; ++_i40)
{
- String _elem37;
- _elem37 = iprot.readString();
- this.columnNames.add(_elem37);
+ String _elem41;
+ _elem41 = iprot.readString();
+ this.columnNames.add(_elem41);
}
iprot.readListEnd();
}
@@ -2546,8 +3579,8 @@
oprot.writeFieldBegin(COLUMN_NAMES_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRING, this.columnNames.size()));
- for (String _iter38 : this.columnNames) {
- oprot.writeString(_iter38);
+ for (String _iter42 : this.columnNames) {
+ oprot.writeString(_iter42);
}
oprot.writeListEnd();
}
@@ -2880,14 +3913,14 @@
case SUCCESS:
if (field.type == TType.LIST) {
{
- TList _list39 = iprot.readListBegin();
- this.success = new ArrayList<column_t>(_list39.size);
- for (int _i40 = 0; _i40 < _list39.size; ++_i40)
+ TList _list43 = iprot.readListBegin();
+ this.success = new ArrayList<column_t>(_list43.size);
+ for (int _i44 = 0; _i44 < _list43.size; ++_i44)
{
- column_t _elem41;
- _elem41 = new column_t();
- _elem41.read(iprot);
- this.success.add(_elem41);
+ column_t _elem45;
+ _elem45 = new column_t();
+ _elem45.read(iprot);
+ this.success.add(_elem45);
}
iprot.readListEnd();
}
@@ -2931,8 +3964,8 @@
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
- for (column_t _iter42 : this.success) {
- _iter42.write(oprot);
+ for (column_t _iter46 : this.success) {
+ _iter46.write(oprot);
}
oprot.writeListEnd();
}
@@ -7158,14 +8191,14 @@
case SUCCESS:
if (field.type == TType.LIST) {
{
- TList _list43 = iprot.readListBegin();
- this.success = new ArrayList<column_t>(_list43.size);
- for (int _i44 = 0; _i44 < _list43.size; ++_i44)
+ TList _list47 = iprot.readListBegin();
+ this.success = new ArrayList<column_t>(_list47.size);
+ for (int _i48 = 0; _i48 < _list47.size; ++_i48)
{
- column_t _elem45;
- _elem45 = new column_t();
- _elem45.read(iprot);
- this.success.add(_elem45);
+ column_t _elem49;
+ _elem49 = new column_t();
+ _elem49.read(iprot);
+ this.success.add(_elem49);
}
iprot.readListEnd();
}
@@ -7209,8 +8242,8 @@
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
- for (column_t _iter46 : this.success) {
- _iter46.write(oprot);
+ for (column_t _iter50 : this.success) {
+ _iter50.write(oprot);
}
oprot.writeListEnd();
}
@@ -7981,14 +9014,14 @@
case SUCCESS:
if (field.type == TType.LIST) {
{
- TList _list47 = iprot.readListBegin();
- this.success = new ArrayList<superColumn_t>(_list47.size);
- for (int _i48 = 0; _i48 < _list47.size; ++_i48)
+ TList _list51 = iprot.readListBegin();
+ this.success = new ArrayList<superColumn_t>(_list51.size);
+ for (int _i52 = 0; _i52 < _list51.size; ++_i52)
{
- superColumn_t _elem49;
- _elem49 = new superColumn_t();
- _elem49.read(iprot);
- this.success.add(_elem49);
+ superColumn_t _elem53;
+ _elem53 = new superColumn_t();
+ _elem53.read(iprot);
+ this.success.add(_elem53);
}
iprot.readListEnd();
}
@@ -8024,8 +9057,8 @@
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
- for (superColumn_t _iter50 : this.success) {
- _iter50.write(oprot);
+ for (superColumn_t _iter54 : this.success) {
+ _iter54.write(oprot);
}
oprot.writeListEnd();
}
@@ -8422,13 +9455,13 @@
case SUPERCOLUMNNAMES:
if (field.type == TType.LIST) {
{
- TList _list51 = iprot.readListBegin();
- this.superColumnNames = new ArrayList<String>(_list51.size);
- for (int _i52 = 0; _i52 < _list51.size; ++_i52)
+ TList _list55 = iprot.readListBegin();
+ this.superColumnNames = new ArrayList<String>(_list55.size);
+ for (int _i56 = 0; _i56 < _list55.size; ++_i56)
{
- String _elem53;
- _elem53 = iprot.readString();
- this.superColumnNames.add(_elem53);
+ String _elem57;
+ _elem57 = iprot.readString();
+ this.superColumnNames.add(_elem57);
}
iprot.readListEnd();
}
@@ -8472,8 +9505,8 @@
oprot.writeFieldBegin(SUPER_COLUMN_NAMES_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRING, this.superColumnNames.size()));
- for (String _iter54 : this.superColumnNames) {
- oprot.writeString(_iter54);
+ for (String _iter58 : this.superColumnNames) {
+ oprot.writeString(_iter58);
}
oprot.writeListEnd();
}
@@ -8751,14 +9784,14 @@
case SUCCESS:
if (field.type == TType.LIST) {
{
- TList _list55 = iprot.readListBegin();
- this.success = new ArrayList<superColumn_t>(_list55.size);
- for (int _i56 = 0; _i56 < _list55.size; ++_i56)
+ TList _list59 = iprot.readListBegin();
+ this.success = new ArrayList<superColumn_t>(_list59.size);
+ for (int _i60 = 0; _i60 < _list59.size; ++_i60)
{
- superColumn_t _elem57;
- _elem57 = new superColumn_t();
- _elem57.read(iprot);
- this.success.add(_elem57);
+ superColumn_t _elem61;
+ _elem61 = new superColumn_t();
+ _elem61.read(iprot);
+ this.success.add(_elem61);
}
iprot.readListEnd();
}
@@ -8794,8 +9827,8 @@
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
- for (superColumn_t _iter58 : this.success) {
- _iter58.write(oprot);
+ for (superColumn_t _iter62 : this.success) {
+ _iter62.write(oprot);
}
oprot.writeListEnd();
}
@@ -10999,13 +12032,13 @@
case SUCCESS:
if (field.type == TType.LIST) {
{
- TList _list59 = iprot.readListBegin();
- this.success = new ArrayList<String>(_list59.size);
- for (int _i60 = 0; _i60 < _list59.size; ++_i60)
+ TList _list63 = iprot.readListBegin();
+ this.success = new ArrayList<String>(_list63.size);
+ for (int _i64 = 0; _i64 < _list63.size; ++_i64)
{
- String _elem61;
- _elem61 = iprot.readString();
- this.success.add(_elem61);
+ String _elem65;
+ _elem65 = iprot.readString();
+ this.success.add(_elem65);
}
iprot.readListEnd();
}
@@ -11041,8 +12074,8 @@
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRING, this.success.size()));
- for (String _iter62 : this.success) {
- oprot.writeString(_iter62);
+ for (String _iter66 : this.success) {
+ oprot.writeString(_iter66);
}
oprot.writeListEnd();
}
@@ -11089,10 +12122,10 @@
public static class getStringProperty_args implements TBase, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("getStringProperty_args");
- private static final TField PROPERTY_NAME_FIELD_DESC = new TField("propertyName", TType.STRING, (short)-1);
+ private static final TField PROPERTY_NAME_FIELD_DESC = new TField("propertyName", TType.STRING, (short)1);
public String propertyName;
- public static final int PROPERTYNAME = -1;
+ public static final int PROPERTYNAME = 1;
private final Isset __isset = new Isset();
private static final class Isset implements java.io.Serializable {
@@ -11486,10 +12519,10 @@
public static class getStringListProperty_args implements TBase, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("getStringListProperty_args");
- private static final TField PROPERTY_NAME_FIELD_DESC = new TField("propertyName", TType.STRING, (short)-1);
+ private static final TField PROPERTY_NAME_FIELD_DESC = new TField("propertyName", TType.STRING, (short)1);
public String propertyName;
- public static final int PROPERTYNAME = -1;
+ public static final int PROPERTYNAME = 1;
private final Isset __isset = new Isset();
private static final class Isset implements java.io.Serializable {
@@ -11849,13 +12882,13 @@
case SUCCESS:
if (field.type == TType.LIST) {
{
- TList _list63 = iprot.readListBegin();
- this.success = new ArrayList<String>(_list63.size);
- for (int _i64 = 0; _i64 < _list63.size; ++_i64)
+ TList _list67 = iprot.readListBegin();
+ this.success = new ArrayList<String>(_list67.size);
+ for (int _i68 = 0; _i68 < _list67.size; ++_i68)
{
- String _elem65;
- _elem65 = iprot.readString();
- this.success.add(_elem65);
+ String _elem69;
+ _elem69 = iprot.readString();
+ this.success.add(_elem69);
}
iprot.readListEnd();
}
@@ -11883,8 +12916,8 @@
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRING, this.success.size()));
- for (String _iter66 : this.success) {
- oprot.writeString(_iter66);
+ for (String _iter70 : this.success) {
+ oprot.writeString(_iter70);
}
oprot.writeListEnd();
}
@@ -11919,10 +12952,10 @@
public static class describeTable_args implements TBase, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("describeTable_args");
- private static final TField TABLE_NAME_FIELD_DESC = new TField("tableName", TType.STRING, (short)-1);
+ private static final TField TABLE_NAME_FIELD_DESC = new TField("tableName", TType.STRING, (short)1);
public String tableName;
- public static final int TABLENAME = -1;
+ public static final int TABLENAME = 1;
private final Isset __isset = new Isset();
private static final class Isset implements java.io.Serializable {
@@ -12316,10 +13349,10 @@
public static class executeQuery_args implements TBase, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("executeQuery_args");
- private static final TField QUERY_FIELD_DESC = new TField("query", TType.STRING, (short)-1);
+ private static final TField QUERY_FIELD_DESC = new TField("query", TType.STRING, (short)1);
public String query;
- public static final int QUERY = -1;
+ public static final int QUERY = 1;
private final Isset __isset = new Isset();
private static final class Isset implements java.io.Serializable {
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadCommand.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadCommand.java?rev=775308&r1=775307&r2=775308&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadCommand.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadCommand.java Fri May 15 20:18:55 2009
@@ -38,6 +38,7 @@
public static final byte CMD_TYPE_GET_SLICE_BY_NAMES=3;
public static final byte CMD_TYPE_GET_COLUMNS_SINCE=4;
public static final byte CMD_TYPE_GET_SLICE=5;
+ public static final byte CMD_TYPE_GET_SLICE_BY_RANGE = 6;
public static final String EMPTY_CF = "";
private static ReadCommandSerializer serializer = new ReadCommandSerializer();
@@ -94,6 +95,7 @@
CMD_SERIALIZER_MAP.put(ReadCommand.CMD_TYPE_GET_SLICE_BY_NAMES, new SliceByNamesReadCommandSerializer());
CMD_SERIALIZER_MAP.put(ReadCommand.CMD_TYPE_GET_COLUMNS_SINCE, new ColumnsSinceReadCommandSerializer());
CMD_SERIALIZER_MAP.put(ReadCommand.CMD_TYPE_GET_SLICE, new SliceReadCommandSerializer());
+ CMD_SERIALIZER_MAP.put(ReadCommand.CMD_TYPE_GET_SLICE_BY_RANGE, new SliceByRangeReadCommandSerializer());
}
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java?rev=775308&r1=775307&r2=775308&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java Fri May 15 20:18:55 2009
@@ -718,6 +718,25 @@
return row;
}
+ public Row getRow(String key, String cf, String startColumn, String endColumn, int count) throws IOException
+ {
+ Row row = new Row(key);
+ String[] values = RowMutation.getColumnAndColumnFamily(cf);
+ ColumnFamilyStore cfStore = columnFamilyStores_.get(values[0]);
+ long start1 = System.currentTimeMillis();
+ assert cfStore != null : "Column family " + cf + " has not been defined";
+ ColumnFamily columnFamily = cfStore.getColumnFamily(key, cf, new IdentityFilter());
+ if ( columnFamily != null )
+ {
+ ColumnFamily filteredCf = new RangeFilter(startColumn, endColumn, count).filter(cf, columnFamily);
+ row.addColumnFamily(filteredCf);
+ }
+ long timeTaken = System.currentTimeMillis() - start1;
+ dbAnalyticsSource_.updateReadStatistics(timeTaken);
+ return row;
+ }
+
+
public Row getRow(String key, String cf, long sinceTimeStamp) throws IOException
{
Row row = new Row(key);
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java?rev=775308&r1=775307&r2=775308&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java Fri May 15 20:18:55 2009
@@ -34,6 +34,7 @@
import org.apache.cassandra.db.ColumnReadCommand;
import org.apache.cassandra.db.ColumnsSinceReadCommand;
import org.apache.cassandra.db.SliceByNamesReadCommand;
+import org.apache.cassandra.db.SliceByRangeReadCommand;
import org.apache.cassandra.db.SliceReadCommand;
import org.apache.cassandra.db.IColumn;
import org.apache.cassandra.db.Row;
@@ -539,5 +540,17 @@
StorageProxy.touchProtocol(DatabaseDescriptor.getTables().get(0), key, fData, StorageService.ConsistencyLevel.WEAK);
}
+ public List<column_t> get_slice_by_name_range(String tablename, String key, String columnFamily, String start, String end, int count)
+ throws InvalidRequestException, NotFoundException, TException
+ {
+ logger.debug("get_slice_by_range");
+ ColumnFamily cfamily = readColumnFamily(new SliceByRangeReadCommand(tablename, key, columnFamily, start, end, count));
+ if (cfamily == null)
+ {
+ return EMPTY_COLUMNS;
+ }
+ return thriftifyColumns(cfamily.getAllColumns());
+ }
+
// main method moved to CassandraDaemon
}
Modified: incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java?rev=775308&r1=775307&r2=775308&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java (original)
+++ incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java Fri May 15 20:18:55 2009
@@ -1,9 +1,12 @@
package org.apache.cassandra.db;
+import static org.junit.Assert.*;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
+import org.junit.Assert;
import org.junit.Test;
import org.apache.cassandra.io.DataInputBuffer;
@@ -39,6 +42,10 @@
rm = new SliceReadCommand("Table1", "row1", "foo", 1, 2);
rm2 = serializeAndDeserializeReadMessage(rm);
assert rm2.toString().equals(rm.toString());
+
+ rm = new SliceByRangeReadCommand("Table1", "row1", "foo", "a", "z", 5);
+ rm2 = serializeAndDeserializeReadMessage(rm);
+ assertEquals(rm2.toString(), rm.toString());
}
private ReadCommand serializeAndDeserializeReadMessage(ReadCommand rm)
Modified: incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java?rev=775308&r1=775307&r2=775308&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java (original)
+++ incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java Fri May 15 20:18:55 2009
@@ -124,6 +124,34 @@
}
@Test
+ public void testGetRowSliceByRange() throws Throwable
+ {
+ String key = TEST_KEY+"slicerow";
+ Table table = Table.open(TABLE_NAME);
+ RowMutation rm = new RowMutation(TABLE_NAME,key);
+ ColumnFamily cf = new ColumnFamily("Standard1","Standard");
+ // First write "a", "b", "c"
+ cf.addColumn(new Column("a", "val1".getBytes(), 1L));
+ cf.addColumn(new Column("b", "val2".getBytes(), 1L));
+ cf.addColumn(new Column("c", "val3".getBytes(), 1L));
+ rm.add(cf);
+ rm.apply();
+
+ Row result = table.getRow(key, "Standard1", "b", "c",-1);
+ assertEquals(2, result.getColumnFamily("Standard1").getColumnCount());
+
+ result = table.getRow(key, "Standard1", "b", "b", 50);
+ assertEquals(1, result.getColumnFamily("Standard1").getColumnCount());
+
+ result = table.getRow(key, "Standard1", "b", "c",1);
+ assertEquals(1, result.getColumnFamily("Standard1").getColumnCount());
+
+ result = table.getRow(key, "Standard1", "c", "b",1);
+ assertEquals(0, result.getColumnFamily("Standard1").getColumnCount());
+
+ }
+
+ @Test
public void testGetRowSuperColumnOffsetCount() throws Throwable
{
Table table = Table.open(TABLE_NAME);