com.splout.db.thrift.PartitionMetadata Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of splout-server Show documentation
Show all versions of splout-server Show documentation
Splout SQL is a read only, horizontally scalable and
partitioned SQL database that plays well with Hadoop.
/**
* Autogenerated by Thrift Compiler (0.7.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package com.splout.db.thrift;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PartitionMetadata implements org.apache.thrift.TBase, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PartitionMetadata");
private static final org.apache.thrift.protocol.TField MIN_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("minKey", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField MAX_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("maxKey", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField N_REPLICAS_FIELD_DESC = new org.apache.thrift.protocol.TField("nReplicas", org.apache.thrift.protocol.TType.I32, (short)3);
private static final org.apache.thrift.protocol.TField DEPLOYMENT_DATE_FIELD_DESC = new org.apache.thrift.protocol.TField("deploymentDate", org.apache.thrift.protocol.TType.I64, (short)4);
private static final org.apache.thrift.protocol.TField INIT_STATEMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("initStatements", org.apache.thrift.protocol.TType.LIST, (short)5);
public String minKey; // required
public String maxKey; // required
public int nReplicas; // required
public long deploymentDate; // required
public List initStatements; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
MIN_KEY((short)1, "minKey"),
MAX_KEY((short)2, "maxKey"),
N_REPLICAS((short)3, "nReplicas"),
DEPLOYMENT_DATE((short)4, "deploymentDate"),
INIT_STATEMENTS((short)5, "initStatements");
private static final Map byName = new HashMap();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // MIN_KEY
return MIN_KEY;
case 2: // MAX_KEY
return MAX_KEY;
case 3: // N_REPLICAS
return N_REPLICAS;
case 4: // DEPLOYMENT_DATE
return DEPLOYMENT_DATE;
case 5: // INIT_STATEMENTS
return INIT_STATEMENTS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __NREPLICAS_ISSET_ID = 0;
private static final int __DEPLOYMENTDATE_ISSET_ID = 1;
private BitSet __isset_bit_vector = new BitSet(2);
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.MIN_KEY, new org.apache.thrift.meta_data.FieldMetaData("minKey", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.MAX_KEY, new org.apache.thrift.meta_data.FieldMetaData("maxKey", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.N_REPLICAS, new org.apache.thrift.meta_data.FieldMetaData("nReplicas", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.DEPLOYMENT_DATE, new org.apache.thrift.meta_data.FieldMetaData("deploymentDate", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.INIT_STATEMENTS, new org.apache.thrift.meta_data.FieldMetaData("initStatements", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PartitionMetadata.class, metaDataMap);
}
public PartitionMetadata() {
}
public PartitionMetadata(
String minKey,
String maxKey,
int nReplicas,
long deploymentDate)
{
this();
this.minKey = minKey;
this.maxKey = maxKey;
this.nReplicas = nReplicas;
setNReplicasIsSet(true);
this.deploymentDate = deploymentDate;
setDeploymentDateIsSet(true);
}
/**
* Performs a deep copy on other.
*/
public PartitionMetadata(PartitionMetadata other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetMinKey()) {
this.minKey = other.minKey;
}
if (other.isSetMaxKey()) {
this.maxKey = other.maxKey;
}
this.nReplicas = other.nReplicas;
this.deploymentDate = other.deploymentDate;
if (other.isSetInitStatements()) {
List __this__initStatements = new ArrayList();
for (String other_element : other.initStatements) {
__this__initStatements.add(other_element);
}
this.initStatements = __this__initStatements;
}
}
public PartitionMetadata deepCopy() {
return new PartitionMetadata(this);
}
@Override
public void clear() {
this.minKey = null;
this.maxKey = null;
setNReplicasIsSet(false);
this.nReplicas = 0;
setDeploymentDateIsSet(false);
this.deploymentDate = 0;
this.initStatements = null;
}
public String getMinKey() {
return this.minKey;
}
public PartitionMetadata setMinKey(String minKey) {
this.minKey = minKey;
return this;
}
public void unsetMinKey() {
this.minKey = null;
}
/** Returns true if field minKey is set (has been assigned a value) and false otherwise */
public boolean isSetMinKey() {
return this.minKey != null;
}
public void setMinKeyIsSet(boolean value) {
if (!value) {
this.minKey = null;
}
}
public String getMaxKey() {
return this.maxKey;
}
public PartitionMetadata setMaxKey(String maxKey) {
this.maxKey = maxKey;
return this;
}
public void unsetMaxKey() {
this.maxKey = null;
}
/** Returns true if field maxKey is set (has been assigned a value) and false otherwise */
public boolean isSetMaxKey() {
return this.maxKey != null;
}
public void setMaxKeyIsSet(boolean value) {
if (!value) {
this.maxKey = null;
}
}
public int getNReplicas() {
return this.nReplicas;
}
public PartitionMetadata setNReplicas(int nReplicas) {
this.nReplicas = nReplicas;
setNReplicasIsSet(true);
return this;
}
public void unsetNReplicas() {
__isset_bit_vector.clear(__NREPLICAS_ISSET_ID);
}
/** Returns true if field nReplicas is set (has been assigned a value) and false otherwise */
public boolean isSetNReplicas() {
return __isset_bit_vector.get(__NREPLICAS_ISSET_ID);
}
public void setNReplicasIsSet(boolean value) {
__isset_bit_vector.set(__NREPLICAS_ISSET_ID, value);
}
public long getDeploymentDate() {
return this.deploymentDate;
}
public PartitionMetadata setDeploymentDate(long deploymentDate) {
this.deploymentDate = deploymentDate;
setDeploymentDateIsSet(true);
return this;
}
public void unsetDeploymentDate() {
__isset_bit_vector.clear(__DEPLOYMENTDATE_ISSET_ID);
}
/** Returns true if field deploymentDate is set (has been assigned a value) and false otherwise */
public boolean isSetDeploymentDate() {
return __isset_bit_vector.get(__DEPLOYMENTDATE_ISSET_ID);
}
public void setDeploymentDateIsSet(boolean value) {
__isset_bit_vector.set(__DEPLOYMENTDATE_ISSET_ID, value);
}
public int getInitStatementsSize() {
return (this.initStatements == null) ? 0 : this.initStatements.size();
}
public java.util.Iterator getInitStatementsIterator() {
return (this.initStatements == null) ? null : this.initStatements.iterator();
}
public void addToInitStatements(String elem) {
if (this.initStatements == null) {
this.initStatements = new ArrayList();
}
this.initStatements.add(elem);
}
public List getInitStatements() {
return this.initStatements;
}
public PartitionMetadata setInitStatements(List initStatements) {
this.initStatements = initStatements;
return this;
}
public void unsetInitStatements() {
this.initStatements = null;
}
/** Returns true if field initStatements is set (has been assigned a value) and false otherwise */
public boolean isSetInitStatements() {
return this.initStatements != null;
}
public void setInitStatementsIsSet(boolean value) {
if (!value) {
this.initStatements = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case MIN_KEY:
if (value == null) {
unsetMinKey();
} else {
setMinKey((String)value);
}
break;
case MAX_KEY:
if (value == null) {
unsetMaxKey();
} else {
setMaxKey((String)value);
}
break;
case N_REPLICAS:
if (value == null) {
unsetNReplicas();
} else {
setNReplicas((Integer)value);
}
break;
case DEPLOYMENT_DATE:
if (value == null) {
unsetDeploymentDate();
} else {
setDeploymentDate((Long)value);
}
break;
case INIT_STATEMENTS:
if (value == null) {
unsetInitStatements();
} else {
setInitStatements((List)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case MIN_KEY:
return getMinKey();
case MAX_KEY:
return getMaxKey();
case N_REPLICAS:
return Integer.valueOf(getNReplicas());
case DEPLOYMENT_DATE:
return Long.valueOf(getDeploymentDate());
case INIT_STATEMENTS:
return getInitStatements();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case MIN_KEY:
return isSetMinKey();
case MAX_KEY:
return isSetMaxKey();
case N_REPLICAS:
return isSetNReplicas();
case DEPLOYMENT_DATE:
return isSetDeploymentDate();
case INIT_STATEMENTS:
return isSetInitStatements();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof PartitionMetadata)
return this.equals((PartitionMetadata)that);
return false;
}
public boolean equals(PartitionMetadata that) {
if (that == null)
return false;
boolean this_present_minKey = true && this.isSetMinKey();
boolean that_present_minKey = true && that.isSetMinKey();
if (this_present_minKey || that_present_minKey) {
if (!(this_present_minKey && that_present_minKey))
return false;
if (!this.minKey.equals(that.minKey))
return false;
}
boolean this_present_maxKey = true && this.isSetMaxKey();
boolean that_present_maxKey = true && that.isSetMaxKey();
if (this_present_maxKey || that_present_maxKey) {
if (!(this_present_maxKey && that_present_maxKey))
return false;
if (!this.maxKey.equals(that.maxKey))
return false;
}
boolean this_present_nReplicas = true;
boolean that_present_nReplicas = true;
if (this_present_nReplicas || that_present_nReplicas) {
if (!(this_present_nReplicas && that_present_nReplicas))
return false;
if (this.nReplicas != that.nReplicas)
return false;
}
boolean this_present_deploymentDate = true;
boolean that_present_deploymentDate = true;
if (this_present_deploymentDate || that_present_deploymentDate) {
if (!(this_present_deploymentDate && that_present_deploymentDate))
return false;
if (this.deploymentDate != that.deploymentDate)
return false;
}
boolean this_present_initStatements = true && this.isSetInitStatements();
boolean that_present_initStatements = true && that.isSetInitStatements();
if (this_present_initStatements || that_present_initStatements) {
if (!(this_present_initStatements && that_present_initStatements))
return false;
if (!this.initStatements.equals(that.initStatements))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(PartitionMetadata other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
PartitionMetadata typedOther = (PartitionMetadata)other;
lastComparison = Boolean.valueOf(isSetMinKey()).compareTo(typedOther.isSetMinKey());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMinKey()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.minKey, typedOther.minKey);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetMaxKey()).compareTo(typedOther.isSetMaxKey());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMaxKey()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxKey, typedOther.maxKey);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetNReplicas()).compareTo(typedOther.isSetNReplicas());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNReplicas()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nReplicas, typedOther.nReplicas);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetDeploymentDate()).compareTo(typedOther.isSetDeploymentDate());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDeploymentDate()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.deploymentDate, typedOther.deploymentDate);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetInitStatements()).compareTo(typedOther.isSetInitStatements());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetInitStatements()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.initStatements, typedOther.initStatements);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (field.id) {
case 1: // MIN_KEY
if (field.type == org.apache.thrift.protocol.TType.STRING) {
this.minKey = iprot.readString();
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // MAX_KEY
if (field.type == org.apache.thrift.protocol.TType.STRING) {
this.maxKey = iprot.readString();
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 3: // N_REPLICAS
if (field.type == org.apache.thrift.protocol.TType.I32) {
this.nReplicas = iprot.readI32();
setNReplicasIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 4: // DEPLOYMENT_DATE
if (field.type == org.apache.thrift.protocol.TType.I64) {
this.deploymentDate = iprot.readI64();
setDeploymentDateIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 5: // INIT_STATEMENTS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
this.initStatements = new ArrayList(_list0.size);
for (int _i1 = 0; _i1 < _list0.size; ++_i1)
{
String _elem2; // required
_elem2 = iprot.readString();
this.initStatements.add(_elem2);
}
iprot.readListEnd();
}
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.minKey != null) {
oprot.writeFieldBegin(MIN_KEY_FIELD_DESC);
oprot.writeString(this.minKey);
oprot.writeFieldEnd();
}
if (this.maxKey != null) {
oprot.writeFieldBegin(MAX_KEY_FIELD_DESC);
oprot.writeString(this.maxKey);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(N_REPLICAS_FIELD_DESC);
oprot.writeI32(this.nReplicas);
oprot.writeFieldEnd();
oprot.writeFieldBegin(DEPLOYMENT_DATE_FIELD_DESC);
oprot.writeI64(this.deploymentDate);
oprot.writeFieldEnd();
if (this.initStatements != null) {
if (isSetInitStatements()) {
oprot.writeFieldBegin(INIT_STATEMENTS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.initStatements.size()));
for (String _iter3 : this.initStatements)
{
oprot.writeString(_iter3);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("PartitionMetadata(");
boolean first = true;
sb.append("minKey:");
if (this.minKey == null) {
sb.append("null");
} else {
sb.append(this.minKey);
}
first = false;
if (!first) sb.append(", ");
sb.append("maxKey:");
if (this.maxKey == null) {
sb.append("null");
} else {
sb.append(this.maxKey);
}
first = false;
if (!first) sb.append(", ");
sb.append("nReplicas:");
sb.append(this.nReplicas);
first = false;
if (!first) sb.append(", ");
sb.append("deploymentDate:");
sb.append(this.deploymentDate);
first = false;
if (isSetInitStatements()) {
if (!first) sb.append(", ");
sb.append("initStatements:");
if (this.initStatements == null) {
sb.append("null");
} else {
sb.append(this.initStatements);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bit_vector = new BitSet(1);
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
}