Author: ecn
Date: Thu Jan 24 18:37:18 2013
New Revision: 1438121
URL: http://svn.apache.org/viewvc?rev=1438121&view=rev
Log:
ACCUMULO-969 added options for the batchwriter
Added:
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/WriterOptions.java
(with props)
Modified:
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/BatchScanOptions.java
accumulo/trunk/proxy/src/main/thrift/proxy.thrift
accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
Modified:
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1438121&r1=1438120&r2=1438121&view=diff
==============================================================================
---
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
(original)
+++
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
Thu Jan 24 18:37:18 2013
@@ -81,6 +81,7 @@ import org.apache.accumulo.proxy.thrift.
import org.apache.accumulo.proxy.thrift.UnknownScanner;
import org.apache.accumulo.proxy.thrift.UnknownWriter;
import org.apache.accumulo.proxy.thrift.UserPass;
+import org.apache.accumulo.proxy.thrift.WriterOptions;
import org.apache.hadoop.io.Text;
import org.apache.thrift.TException;
@@ -733,17 +734,17 @@ public class ProxyServer implements Accu
try {
Connector connector = getConnector(userpass);
- int batchSize = 10;
+ int threads = 10;
Authorizations auth;
if (opts != null && opts.isSetAuthorizations()) {
auth = getAuthorizations(opts.authorizations);
} else {
auth =
connector.securityOperations().getUserAuthorizations(userpass.getUsername());
}
- if (opts != null && opts.isSetBufferSize() && opts.bufferSize > 0)
- batchSize = opts.bufferSize;
+ if (opts != null && opts.threads > 0)
+ threads = opts.threads;
- BatchScanner scanner = connector.createBatchScanner(tableName, auth,
batchSize);
+ BatchScanner scanner = connector.createBatchScanner(tableName, auth,
threads);
if (opts != null) {
if (opts.iterators != null) {
@@ -837,7 +838,7 @@ public class ProxyServer implements Accu
@Override
public void updateAndFlush(UserPass userpass, String tableName,
Map<ByteBuffer,List<ColumnUpdate>> cells) throws TException {
try {
- BatchWriter writer = getWriter(userpass, tableName);
+ BatchWriter writer = getWriter(userpass, tableName, null);
addCellsToWriter(cells, writer);
writer.flush();
writer.close();
@@ -885,9 +886,9 @@ public class ProxyServer implements Accu
}
@Override
- public String createWriter(UserPass userpass, String tableName) throws
TException {
+ public String createWriter(UserPass userpass, String tableName,
WriterOptions opts) throws TException {
try {
- BatchWriter writer = getWriter(userpass, tableName);
+ BatchWriter writer = getWriter(userpass, tableName, opts);
UUID uuid = UUID.randomUUID();
writerCache.put(uuid, writer);
return uuid.toString();
@@ -936,8 +937,19 @@ public class ProxyServer implements Accu
}
}
- private BatchWriter getWriter(UserPass userpass, String tableName) throws
Exception {
- return getConnector(userpass).createBatchWriter(tableName, new
BatchWriterConfig());
+ private BatchWriter getWriter(UserPass userpass, String tableName,
WriterOptions opts) throws Exception {
+ BatchWriterConfig cfg = new BatchWriterConfig();
+ if (opts != null) {
+ if (opts.maxMemory != 0)
+ cfg.setMaxMemory(opts.maxMemory);
+ if (opts.threads != 0)
+ cfg.setMaxWriteThreads(opts.threads);
+ if (opts.timeoutMs != 0)
+ cfg.setTimeout(opts.timeoutMs, TimeUnit.MILLISECONDS);
+ if (opts.latencyMs != 0)
+ cfg.setMaxLatency(opts.latencyMs, TimeUnit.MILLISECONDS);
+ }
+ return getConnector(userpass).createBatchWriter(tableName, cfg);
}
private IteratorSetting
getIteratorSetting(org.apache.accumulo.proxy.thrift.IteratorSetting setting) {
Modified:
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java?rev=1438121&r1=1438120&r2=1438121&view=diff
==============================================================================
---
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java
(original)
+++
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java
Thu Jan 24 18:37:18 2013
@@ -114,7 +114,7 @@ public class TestProxyClient {
start = new Date();
then = new Date();
mutations.clear();
- String writer = tpc.proxy().createWriter(userpass, testTable);
+ String writer = tpc.proxy().createWriter(userpass, testTable, null);
for (int i = 0; i < maxInserts; i++) {
String result = String.format(format, i);
Key pkey = new Key();
Modified:
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java?rev=1438121&r1=1438120&r2=1438121&view=diff
==============================================================================
---
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java
(original)
+++
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java
Thu Jan 24 18:37:18 2013
@@ -178,7 +178,7 @@ import org.slf4j.LoggerFactory;
public void updateAndFlush(UserPass userpass, String tableName,
Map<ByteBuffer,List<ColumnUpdate>> cells) throws AccumuloException,
AccumuloSecurityException, org.apache.thrift.TException;
- public String createWriter(UserPass userpass, String tableName) throws
AccumuloException, AccumuloSecurityException, org.apache.thrift.TException;
+ public String createWriter(UserPass userpass, String tableName,
WriterOptions opts) throws AccumuloException, AccumuloSecurityException,
org.apache.thrift.TException;
public void writer_update(String writer,
Map<ByteBuffer,List<ColumnUpdate>> cells) throws org.apache.thrift.TException;
@@ -322,7 +322,7 @@ import org.slf4j.LoggerFactory;
public void updateAndFlush(UserPass userpass, String tableName,
Map<ByteBuffer,List<ColumnUpdate>> cells,
org.apache.thrift.async.AsyncMethodCallback<AsyncClient.updateAndFlush_call>
resultHandler) throws org.apache.thrift.TException;
- public void createWriter(UserPass userpass, String tableName,
org.apache.thrift.async.AsyncMethodCallback<AsyncClient.createWriter_call>
resultHandler) throws org.apache.thrift.TException;
+ public void createWriter(UserPass userpass, String tableName,
WriterOptions opts,
org.apache.thrift.async.AsyncMethodCallback<AsyncClient.createWriter_call>
resultHandler) throws org.apache.thrift.TException;
public void writer_update(String writer,
Map<ByteBuffer,List<ColumnUpdate>> cells,
org.apache.thrift.async.AsyncMethodCallback<AsyncClient.writer_update_call>
resultHandler) throws org.apache.thrift.TException;
@@ -2259,17 +2259,18 @@ import org.slf4j.LoggerFactory;
return;
}
- public String createWriter(UserPass userpass, String tableName) throws
AccumuloException, AccumuloSecurityException, org.apache.thrift.TException
+ public String createWriter(UserPass userpass, String tableName,
WriterOptions opts) throws AccumuloException, AccumuloSecurityException,
org.apache.thrift.TException
{
- send_createWriter(userpass, tableName);
+ send_createWriter(userpass, tableName, opts);
return recv_createWriter();
}
- public void send_createWriter(UserPass userpass, String tableName) throws
org.apache.thrift.TException
+ public void send_createWriter(UserPass userpass, String tableName,
WriterOptions opts) throws org.apache.thrift.TException
{
createWriter_args args = new createWriter_args();
args.setUserpass(userpass);
args.setTableName(tableName);
+ args.setOpts(opts);
sendBase("createWriter", args);
}
@@ -4824,9 +4825,9 @@ import org.slf4j.LoggerFactory;
}
}
- public void createWriter(UserPass userpass, String tableName,
org.apache.thrift.async.AsyncMethodCallback<createWriter_call> resultHandler)
throws org.apache.thrift.TException {
+ public void createWriter(UserPass userpass, String tableName,
WriterOptions opts,
org.apache.thrift.async.AsyncMethodCallback<createWriter_call> resultHandler)
throws org.apache.thrift.TException {
checkReady();
- createWriter_call method_call = new createWriter_call(userpass,
tableName, resultHandler, this, ___protocolFactory, ___transport);
+ createWriter_call method_call = new createWriter_call(userpass,
tableName, opts, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
@@ -4834,10 +4835,12 @@ import org.slf4j.LoggerFactory;
public static class createWriter_call extends
org.apache.thrift.async.TAsyncMethodCall {
private UserPass userpass;
private String tableName;
- public createWriter_call(UserPass userpass, String tableName,
org.apache.thrift.async.AsyncMethodCallback<createWriter_call> resultHandler,
org.apache.thrift.async.TAsyncClient client,
org.apache.thrift.protocol.TProtocolFactory protocolFactory,
org.apache.thrift.transport.TNonblockingTransport transport) throws
org.apache.thrift.TException {
+ private WriterOptions opts;
+ public createWriter_call(UserPass userpass, String tableName,
WriterOptions opts,
org.apache.thrift.async.AsyncMethodCallback<createWriter_call> resultHandler,
org.apache.thrift.async.TAsyncClient client,
org.apache.thrift.protocol.TProtocolFactory protocolFactory,
org.apache.thrift.transport.TNonblockingTransport transport) throws
org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.userpass = userpass;
this.tableName = tableName;
+ this.opts = opts;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws
org.apache.thrift.TException {
@@ -4845,6 +4848,7 @@ import org.slf4j.LoggerFactory;
createWriter_args args = new createWriter_args();
args.setUserpass(userpass);
args.setTableName(tableName);
+ args.setOpts(opts);
args.write(prot);
prot.writeMessageEnd();
}
@@ -6810,7 +6814,7 @@ import org.slf4j.LoggerFactory;
public createWriter_result getResult(I iface, createWriter_args args)
throws org.apache.thrift.TException {
createWriter_result result = new createWriter_result();
try {
- result.success = iface.createWriter(args.userpass, args.tableName);
+ result.success = iface.createWriter(args.userpass, args.tableName,
args.opts);
} catch (AccumuloException outch1) {
result.outch1 = outch1;
} catch (AccumuloSecurityException ouch2) {
@@ -77045,6 +77049,7 @@ import org.slf4j.LoggerFactory;
private static final org.apache.thrift.protocol.TField USERPASS_FIELD_DESC
= new org.apache.thrift.protocol.TField("userpass",
org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField
TABLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tableName",
org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField OPTS_FIELD_DESC =
new org.apache.thrift.protocol.TField("opts",
org.apache.thrift.protocol.TType.STRUCT, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes
= new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -77054,11 +77059,13 @@ import org.slf4j.LoggerFactory;
public UserPass userpass; // required
public String tableName; // required
+ public WriterOptions opts; // required
/** The set of fields this struct contains, along with convenience methods
for finding and manipulating them. */
@SuppressWarnings("all") public enum _Fields implements
org.apache.thrift.TFieldIdEnum {
USERPASS((short)1, "userpass"),
- TABLE_NAME((short)2, "tableName");
+ TABLE_NAME((short)2, "tableName"),
+ OPTS((short)3, "opts");
private static final Map<String, _Fields> byName = new HashMap<String,
_Fields>();
@@ -77077,6 +77084,8 @@ import org.slf4j.LoggerFactory;
return USERPASS;
case 2: // TABLE_NAME
return TABLE_NAME;
+ case 3: // OPTS
+ return OPTS;
default:
return null;
}
@@ -77124,6 +77133,8 @@ import org.slf4j.LoggerFactory;
new
org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
UserPass.class)));
tmpMap.put(_Fields.TABLE_NAME, new
org.apache.thrift.meta_data.FieldMetaData("tableName",
org.apache.thrift.TFieldRequirementType.DEFAULT,
new
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.OPTS, new
org.apache.thrift.meta_data.FieldMetaData("opts",
org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new
org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
WriterOptions.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(createWriter_args.class,
metaDataMap);
}
@@ -77133,11 +77144,13 @@ import org.slf4j.LoggerFactory;
public createWriter_args(
UserPass userpass,
- String tableName)
+ String tableName,
+ WriterOptions opts)
{
this();
this.userpass = userpass;
this.tableName = tableName;
+ this.opts = opts;
}
/**
@@ -77150,6 +77163,9 @@ import org.slf4j.LoggerFactory;
if (other.isSetTableName()) {
this.tableName = other.tableName;
}
+ if (other.isSetOpts()) {
+ this.opts = new WriterOptions(other.opts);
+ }
}
public createWriter_args deepCopy() {
@@ -77160,6 +77176,7 @@ import org.slf4j.LoggerFactory;
public void clear() {
this.userpass = null;
this.tableName = null;
+ this.opts = null;
}
public UserPass getUserpass() {
@@ -77210,6 +77227,30 @@ import org.slf4j.LoggerFactory;
}
}
+ public WriterOptions getOpts() {
+ return this.opts;
+ }
+
+ public createWriter_args setOpts(WriterOptions opts) {
+ this.opts = opts;
+ return this;
+ }
+
+ public void unsetOpts() {
+ this.opts = null;
+ }
+
+ /** Returns true if field opts is set (has been assigned a value) and
false otherwise */
+ public boolean isSetOpts() {
+ return this.opts != null;
+ }
+
+ public void setOptsIsSet(boolean value) {
+ if (!value) {
+ this.opts = null;
+ }
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case USERPASS:
@@ -77228,6 +77269,14 @@ import org.slf4j.LoggerFactory;
}
break;
+ case OPTS:
+ if (value == null) {
+ unsetOpts();
+ } else {
+ setOpts((WriterOptions)value);
+ }
+ break;
+
}
}
@@ -77239,6 +77288,9 @@ import org.slf4j.LoggerFactory;
case TABLE_NAME:
return getTableName();
+ case OPTS:
+ return getOpts();
+
}
throw new IllegalStateException();
}
@@ -77254,6 +77306,8 @@ import org.slf4j.LoggerFactory;
return isSetUserpass();
case TABLE_NAME:
return isSetTableName();
+ case OPTS:
+ return isSetOpts();
}
throw new IllegalStateException();
}
@@ -77289,6 +77343,15 @@ import org.slf4j.LoggerFactory;
return false;
}
+ boolean this_present_opts = true && this.isSetOpts();
+ boolean that_present_opts = true && that.isSetOpts();
+ if (this_present_opts || that_present_opts) {
+ if (!(this_present_opts && that_present_opts))
+ return false;
+ if (!this.opts.equals(that.opts))
+ return false;
+ }
+
return true;
}
@@ -77325,6 +77388,16 @@ import org.slf4j.LoggerFactory;
return lastComparison;
}
}
+ lastComparison =
Boolean.valueOf(isSetOpts()).compareTo(typedOther.isSetOpts());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetOpts()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.opts,
typedOther.opts);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -77360,6 +77433,14 @@ import org.slf4j.LoggerFactory;
sb.append(this.tableName);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("opts:");
+ if (this.opts == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.opts);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -77370,6 +77451,9 @@ import org.slf4j.LoggerFactory;
if (userpass != null) {
userpass.validate();
}
+ if (opts != null) {
+ opts.validate();
+ }
}
private void writeObject(java.io.ObjectOutputStream out) throws
java.io.IOException {
@@ -77423,6 +77507,15 @@ import org.slf4j.LoggerFactory;
org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
}
break;
+ case 3: // OPTS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT)
{
+ struct.opts = new WriterOptions();
+ struct.opts.read(iprot);
+ struct.setOptsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
}
@@ -77448,6 +77541,11 @@ import org.slf4j.LoggerFactory;
oprot.writeString(struct.tableName);
oprot.writeFieldEnd();
}
+ if (struct.opts != null) {
+ oprot.writeFieldBegin(OPTS_FIELD_DESC);
+ struct.opts.write(oprot);
+ oprot.writeFieldEnd();
+ }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -77472,19 +77570,25 @@ import org.slf4j.LoggerFactory;
if (struct.isSetTableName()) {
optionals.set(1);
}
- oprot.writeBitSet(optionals, 2);
+ if (struct.isSetOpts()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
if (struct.isSetUserpass()) {
struct.userpass.write(oprot);
}
if (struct.isSetTableName()) {
oprot.writeString(struct.tableName);
}
+ if (struct.isSetOpts()) {
+ struct.opts.write(oprot);
+ }
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot,
createWriter_args struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(2);
+ BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.userpass = new UserPass();
struct.userpass.read(iprot);
@@ -77494,6 +77598,11 @@ import org.slf4j.LoggerFactory;
struct.tableName = iprot.readString();
struct.setTableNameIsSet(true);
}
+ if (incoming.get(2)) {
+ struct.opts = new WriterOptions();
+ struct.opts.read(iprot);
+ struct.setOptsIsSet(true);
+ }
}
}
Modified:
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/BatchScanOptions.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/BatchScanOptions.java?rev=1438121&r1=1438120&r2=1438121&view=diff
==============================================================================
---
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/BatchScanOptions.java
(original)
+++
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/BatchScanOptions.java
Thu Jan 24 18:37:18 2013
@@ -53,7 +53,7 @@ import org.slf4j.LoggerFactory;
private static final org.apache.thrift.protocol.TField RANGES_FIELD_DESC =
new org.apache.thrift.protocol.TField("ranges",
org.apache.thrift.protocol.TType.LIST, (short)2);
private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC =
new org.apache.thrift.protocol.TField("columns",
org.apache.thrift.protocol.TType.LIST, (short)3);
private static final org.apache.thrift.protocol.TField ITERATORS_FIELD_DESC
= new org.apache.thrift.protocol.TField("iterators",
org.apache.thrift.protocol.TType.LIST, (short)4);
- private static final org.apache.thrift.protocol.TField
BUFFER_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("bufferSize",
org.apache.thrift.protocol.TType.I32, (short)5);
+ private static final org.apache.thrift.protocol.TField THREADS_FIELD_DESC =
new org.apache.thrift.protocol.TField("threads",
org.apache.thrift.protocol.TType.I32, (short)5);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -65,7 +65,7 @@ import org.slf4j.LoggerFactory;
public List<Range> ranges; // optional
public List<ScanColumn> columns; // optional
public List<IteratorSetting> iterators; // optional
- public int bufferSize; // optional
+ public int threads; // optional
/** The set of fields this struct contains, along with convenience methods
for finding and manipulating them. */
@SuppressWarnings("all") public enum _Fields implements
org.apache.thrift.TFieldIdEnum {
@@ -73,7 +73,7 @@ import org.slf4j.LoggerFactory;
RANGES((short)2, "ranges"),
COLUMNS((short)3, "columns"),
ITERATORS((short)4, "iterators"),
- BUFFER_SIZE((short)5, "bufferSize");
+ THREADS((short)5, "threads");
private static final Map<String, _Fields> byName = new HashMap<String,
_Fields>();
@@ -96,8 +96,8 @@ import org.slf4j.LoggerFactory;
return COLUMNS;
case 4: // ITERATORS
return ITERATORS;
- case 5: // BUFFER_SIZE
- return BUFFER_SIZE;
+ case 5: // THREADS
+ return THREADS;
default:
return null;
}
@@ -138,9 +138,9 @@ import org.slf4j.LoggerFactory;
}
// isset id assignments
- private static final int __BUFFERSIZE_ISSET_ID = 0;
+ private static final int __THREADS_ISSET_ID = 0;
private byte __isset_bitfield = 0;
- private _Fields optionals[] =
{_Fields.AUTHORIZATIONS,_Fields.RANGES,_Fields.COLUMNS,_Fields.ITERATORS,_Fields.BUFFER_SIZE};
+ private _Fields optionals[] =
{_Fields.AUTHORIZATIONS,_Fields.RANGES,_Fields.COLUMNS,_Fields.ITERATORS,_Fields.THREADS};
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);
@@ -156,7 +156,7 @@ import org.slf4j.LoggerFactory;
tmpMap.put(_Fields.ITERATORS, new
org.apache.thrift.meta_data.FieldMetaData("iterators",
org.apache.thrift.TFieldRequirementType.OPTIONAL,
new
org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new
org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
IteratorSetting.class))));
- tmpMap.put(_Fields.BUFFER_SIZE, new
org.apache.thrift.meta_data.FieldMetaData("bufferSize",
org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ tmpMap.put(_Fields.THREADS, new
org.apache.thrift.meta_data.FieldMetaData("threads",
org.apache.thrift.TFieldRequirementType.OPTIONAL,
new
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(BatchScanOptions.class,
metaDataMap);
@@ -200,7 +200,7 @@ import org.slf4j.LoggerFactory;
}
this.iterators = __this__iterators;
}
- this.bufferSize = other.bufferSize;
+ this.threads = other.threads;
}
public BatchScanOptions deepCopy() {
@@ -213,8 +213,8 @@ import org.slf4j.LoggerFactory;
this.ranges = null;
this.columns = null;
this.iterators = null;
- setBufferSizeIsSet(false);
- this.bufferSize = 0;
+ setThreadsIsSet(false);
+ this.threads = 0;
}
public int getAuthorizationsSize() {
@@ -373,27 +373,27 @@ import org.slf4j.LoggerFactory;
}
}
- public int getBufferSize() {
- return this.bufferSize;
+ public int getThreads() {
+ return this.threads;
}
- public BatchScanOptions setBufferSize(int bufferSize) {
- this.bufferSize = bufferSize;
- setBufferSizeIsSet(true);
+ public BatchScanOptions setThreads(int threads) {
+ this.threads = threads;
+ setThreadsIsSet(true);
return this;
}
- public void unsetBufferSize() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield,
__BUFFERSIZE_ISSET_ID);
+ public void unsetThreads() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield,
__THREADS_ISSET_ID);
}
- /** Returns true if field bufferSize is set (has been assigned a value) and
false otherwise */
- public boolean isSetBufferSize() {
- return EncodingUtils.testBit(__isset_bitfield, __BUFFERSIZE_ISSET_ID);
+ /** Returns true if field threads is set (has been assigned a value) and
false otherwise */
+ public boolean isSetThreads() {
+ return EncodingUtils.testBit(__isset_bitfield, __THREADS_ISSET_ID);
}
- public void setBufferSizeIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield,
__BUFFERSIZE_ISSET_ID, value);
+ public void setThreadsIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield,
__THREADS_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
@@ -430,11 +430,11 @@ import org.slf4j.LoggerFactory;
}
break;
- case BUFFER_SIZE:
+ case THREADS:
if (value == null) {
- unsetBufferSize();
+ unsetThreads();
} else {
- setBufferSize((Integer)value);
+ setThreads((Integer)value);
}
break;
@@ -455,8 +455,8 @@ import org.slf4j.LoggerFactory;
case ITERATORS:
return getIterators();
- case BUFFER_SIZE:
- return Integer.valueOf(getBufferSize());
+ case THREADS:
+ return Integer.valueOf(getThreads());
}
throw new IllegalStateException();
@@ -477,8 +477,8 @@ import org.slf4j.LoggerFactory;
return isSetColumns();
case ITERATORS:
return isSetIterators();
- case BUFFER_SIZE:
- return isSetBufferSize();
+ case THREADS:
+ return isSetThreads();
}
throw new IllegalStateException();
}
@@ -532,12 +532,12 @@ import org.slf4j.LoggerFactory;
return false;
}
- boolean this_present_bufferSize = true && this.isSetBufferSize();
- boolean that_present_bufferSize = true && that.isSetBufferSize();
- if (this_present_bufferSize || that_present_bufferSize) {
- if (!(this_present_bufferSize && that_present_bufferSize))
+ boolean this_present_threads = true && this.isSetThreads();
+ boolean that_present_threads = true && that.isSetThreads();
+ if (this_present_threads || that_present_threads) {
+ if (!(this_present_threads && that_present_threads))
return false;
- if (this.bufferSize != that.bufferSize)
+ if (this.threads != that.threads)
return false;
}
@@ -597,12 +597,12 @@ import org.slf4j.LoggerFactory;
return lastComparison;
}
}
- lastComparison =
Boolean.valueOf(isSetBufferSize()).compareTo(typedOther.isSetBufferSize());
+ lastComparison =
Boolean.valueOf(isSetThreads()).compareTo(typedOther.isSetThreads());
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetBufferSize()) {
- lastComparison =
org.apache.thrift.TBaseHelper.compareTo(this.bufferSize, typedOther.bufferSize);
+ if (isSetThreads()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.threads,
typedOther.threads);
if (lastComparison != 0) {
return lastComparison;
}
@@ -666,10 +666,10 @@ import org.slf4j.LoggerFactory;
}
first = false;
}
- if (isSetBufferSize()) {
+ if (isSetThreads()) {
if (!first) sb.append(", ");
- sb.append("bufferSize:");
- sb.append(this.bufferSize);
+ sb.append("threads:");
+ sb.append(this.threads);
first = false;
}
sb.append(")");
@@ -792,10 +792,10 @@ import org.slf4j.LoggerFactory;
org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
}
break;
- case 5: // BUFFER_SIZE
+ case 5: // THREADS
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.bufferSize = iprot.readI32();
- struct.setBufferSizeIsSet(true);
+ struct.threads = iprot.readI32();
+ struct.setThreadsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
}
@@ -871,9 +871,9 @@ import org.slf4j.LoggerFactory;
oprot.writeFieldEnd();
}
}
- if (struct.isSetBufferSize()) {
- oprot.writeFieldBegin(BUFFER_SIZE_FIELD_DESC);
- oprot.writeI32(struct.bufferSize);
+ if (struct.isSetThreads()) {
+ oprot.writeFieldBegin(THREADS_FIELD_DESC);
+ oprot.writeI32(struct.threads);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
@@ -906,7 +906,7 @@ import org.slf4j.LoggerFactory;
if (struct.isSetIterators()) {
optionals.set(3);
}
- if (struct.isSetBufferSize()) {
+ if (struct.isSetThreads()) {
optionals.set(4);
}
oprot.writeBitSet(optionals, 5);
@@ -946,8 +946,8 @@ import org.slf4j.LoggerFactory;
}
}
}
- if (struct.isSetBufferSize()) {
- oprot.writeI32(struct.bufferSize);
+ if (struct.isSetThreads()) {
+ oprot.writeI32(struct.threads);
}
}
@@ -1011,8 +1011,8 @@ import org.slf4j.LoggerFactory;
struct.setIteratorsIsSet(true);
}
if (incoming.get(4)) {
- struct.bufferSize = iprot.readI32();
- struct.setBufferSizeIsSet(true);
+ struct.threads = iprot.readI32();
+ struct.setThreadsIsSet(true);
}
}
}
Added:
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/WriterOptions.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/WriterOptions.java?rev=1438121&view=auto
==============================================================================
---
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/WriterOptions.java
(added)
+++
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/WriterOptions.java
Thu Jan 24 18:37:18 2013
@@ -0,0 +1,682 @@
+/*
+ * 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.
+ */
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.accumulo.proxy.thrift;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+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;
+
+@SuppressWarnings("all") public class WriterOptions implements
org.apache.thrift.TBase<WriterOptions, WriterOptions._Fields>,
java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new
org.apache.thrift.protocol.TStruct("WriterOptions");
+
+ private static final org.apache.thrift.protocol.TField MAX_MEMORY_FIELD_DESC
= new org.apache.thrift.protocol.TField("maxMemory",
org.apache.thrift.protocol.TType.I64, (short)1);
+ private static final org.apache.thrift.protocol.TField LATENCY_MS_FIELD_DESC
= new org.apache.thrift.protocol.TField("latencyMs",
org.apache.thrift.protocol.TType.I64, (short)2);
+ private static final org.apache.thrift.protocol.TField TIMEOUT_MS_FIELD_DESC
= new org.apache.thrift.protocol.TField("timeoutMs",
org.apache.thrift.protocol.TType.I64, (short)3);
+ private static final org.apache.thrift.protocol.TField THREADS_FIELD_DESC =
new org.apache.thrift.protocol.TField("threads",
org.apache.thrift.protocol.TType.I32, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new
WriterOptionsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new WriterOptionsTupleSchemeFactory());
+ }
+
+ public long maxMemory; // required
+ public long latencyMs; // required
+ public long timeoutMs; // required
+ public int threads; // required
+
+ /** The set of fields this struct contains, along with convenience methods
for finding and manipulating them. */
+ @SuppressWarnings("all") public enum _Fields implements
org.apache.thrift.TFieldIdEnum {
+ MAX_MEMORY((short)1, "maxMemory"),
+ LATENCY_MS((short)2, "latencyMs"),
+ TIMEOUT_MS((short)3, "timeoutMs"),
+ THREADS((short)4, "threads");
+
+ private static final Map<String, _Fields> byName = new HashMap<String,
_Fields>();
+
+ 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: // MAX_MEMORY
+ return MAX_MEMORY;
+ case 2: // LATENCY_MS
+ return LATENCY_MS;
+ case 3: // TIMEOUT_MS
+ return TIMEOUT_MS;
+ case 4: // THREADS
+ return THREADS;
+ 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 __MAXMEMORY_ISSET_ID = 0;
+ private static final int __LATENCYMS_ISSET_ID = 1;
+ private static final int __TIMEOUTMS_ISSET_ID = 2;
+ private static final int __THREADS_ISSET_ID = 3;
+ private byte __isset_bitfield = 0;
+ 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.MAX_MEMORY, new
org.apache.thrift.meta_data.FieldMetaData("maxMemory",
org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.LATENCY_MS, new
org.apache.thrift.meta_data.FieldMetaData("latencyMs",
org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.TIMEOUT_MS, new
org.apache.thrift.meta_data.FieldMetaData("timeoutMs",
org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.THREADS, new
org.apache.thrift.meta_data.FieldMetaData("threads",
org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(WriterOptions.class,
metaDataMap);
+ }
+
+ public WriterOptions() {
+ }
+
+ public WriterOptions(
+ long maxMemory,
+ long latencyMs,
+ long timeoutMs,
+ int threads)
+ {
+ this();
+ this.maxMemory = maxMemory;
+ setMaxMemoryIsSet(true);
+ this.latencyMs = latencyMs;
+ setLatencyMsIsSet(true);
+ this.timeoutMs = timeoutMs;
+ setTimeoutMsIsSet(true);
+ this.threads = threads;
+ setThreadsIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public WriterOptions(WriterOptions other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.maxMemory = other.maxMemory;
+ this.latencyMs = other.latencyMs;
+ this.timeoutMs = other.timeoutMs;
+ this.threads = other.threads;
+ }
+
+ public WriterOptions deepCopy() {
+ return new WriterOptions(this);
+ }
+
+ @Override
+ public void clear() {
+ setMaxMemoryIsSet(false);
+ this.maxMemory = 0;
+ setLatencyMsIsSet(false);
+ this.latencyMs = 0;
+ setTimeoutMsIsSet(false);
+ this.timeoutMs = 0;
+ setThreadsIsSet(false);
+ this.threads = 0;
+ }
+
+ public long getMaxMemory() {
+ return this.maxMemory;
+ }
+
+ public WriterOptions setMaxMemory(long maxMemory) {
+ this.maxMemory = maxMemory;
+ setMaxMemoryIsSet(true);
+ return this;
+ }
+
+ public void unsetMaxMemory() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield,
__MAXMEMORY_ISSET_ID);
+ }
+
+ /** Returns true if field maxMemory is set (has been assigned a value) and
false otherwise */
+ public boolean isSetMaxMemory() {
+ return EncodingUtils.testBit(__isset_bitfield, __MAXMEMORY_ISSET_ID);
+ }
+
+ public void setMaxMemoryIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield,
__MAXMEMORY_ISSET_ID, value);
+ }
+
+ public long getLatencyMs() {
+ return this.latencyMs;
+ }
+
+ public WriterOptions setLatencyMs(long latencyMs) {
+ this.latencyMs = latencyMs;
+ setLatencyMsIsSet(true);
+ return this;
+ }
+
+ public void unsetLatencyMs() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield,
__LATENCYMS_ISSET_ID);
+ }
+
+ /** Returns true if field latencyMs is set (has been assigned a value) and
false otherwise */
+ public boolean isSetLatencyMs() {
+ return EncodingUtils.testBit(__isset_bitfield, __LATENCYMS_ISSET_ID);
+ }
+
+ public void setLatencyMsIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield,
__LATENCYMS_ISSET_ID, value);
+ }
+
+ public long getTimeoutMs() {
+ return this.timeoutMs;
+ }
+
+ public WriterOptions setTimeoutMs(long timeoutMs) {
+ this.timeoutMs = timeoutMs;
+ setTimeoutMsIsSet(true);
+ return this;
+ }
+
+ public void unsetTimeoutMs() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield,
__TIMEOUTMS_ISSET_ID);
+ }
+
+ /** Returns true if field timeoutMs is set (has been assigned a value) and
false otherwise */
+ public boolean isSetTimeoutMs() {
+ return EncodingUtils.testBit(__isset_bitfield, __TIMEOUTMS_ISSET_ID);
+ }
+
+ public void setTimeoutMsIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield,
__TIMEOUTMS_ISSET_ID, value);
+ }
+
+ public int getThreads() {
+ return this.threads;
+ }
+
+ public WriterOptions setThreads(int threads) {
+ this.threads = threads;
+ setThreadsIsSet(true);
+ return this;
+ }
+
+ public void unsetThreads() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield,
__THREADS_ISSET_ID);
+ }
+
+ /** Returns true if field threads is set (has been assigned a value) and
false otherwise */
+ public boolean isSetThreads() {
+ return EncodingUtils.testBit(__isset_bitfield, __THREADS_ISSET_ID);
+ }
+
+ public void setThreadsIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield,
__THREADS_ISSET_ID, value);
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case MAX_MEMORY:
+ if (value == null) {
+ unsetMaxMemory();
+ } else {
+ setMaxMemory((Long)value);
+ }
+ break;
+
+ case LATENCY_MS:
+ if (value == null) {
+ unsetLatencyMs();
+ } else {
+ setLatencyMs((Long)value);
+ }
+ break;
+
+ case TIMEOUT_MS:
+ if (value == null) {
+ unsetTimeoutMs();
+ } else {
+ setTimeoutMs((Long)value);
+ }
+ break;
+
+ case THREADS:
+ if (value == null) {
+ unsetThreads();
+ } else {
+ setThreads((Integer)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case MAX_MEMORY:
+ return Long.valueOf(getMaxMemory());
+
+ case LATENCY_MS:
+ return Long.valueOf(getLatencyMs());
+
+ case TIMEOUT_MS:
+ return Long.valueOf(getTimeoutMs());
+
+ case THREADS:
+ return Integer.valueOf(getThreads());
+
+ }
+ 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 MAX_MEMORY:
+ return isSetMaxMemory();
+ case LATENCY_MS:
+ return isSetLatencyMs();
+ case TIMEOUT_MS:
+ return isSetTimeoutMs();
+ case THREADS:
+ return isSetThreads();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof WriterOptions)
+ return this.equals((WriterOptions)that);
+ return false;
+ }
+
+ public boolean equals(WriterOptions that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_maxMemory = true;
+ boolean that_present_maxMemory = true;
+ if (this_present_maxMemory || that_present_maxMemory) {
+ if (!(this_present_maxMemory && that_present_maxMemory))
+ return false;
+ if (this.maxMemory != that.maxMemory)
+ return false;
+ }
+
+ boolean this_present_latencyMs = true;
+ boolean that_present_latencyMs = true;
+ if (this_present_latencyMs || that_present_latencyMs) {
+ if (!(this_present_latencyMs && that_present_latencyMs))
+ return false;
+ if (this.latencyMs != that.latencyMs)
+ return false;
+ }
+
+ boolean this_present_timeoutMs = true;
+ boolean that_present_timeoutMs = true;
+ if (this_present_timeoutMs || that_present_timeoutMs) {
+ if (!(this_present_timeoutMs && that_present_timeoutMs))
+ return false;
+ if (this.timeoutMs != that.timeoutMs)
+ return false;
+ }
+
+ boolean this_present_threads = true;
+ boolean that_present_threads = true;
+ if (this_present_threads || that_present_threads) {
+ if (!(this_present_threads && that_present_threads))
+ return false;
+ if (this.threads != that.threads)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ public int compareTo(WriterOptions other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ WriterOptions typedOther = (WriterOptions)other;
+
+ lastComparison =
Boolean.valueOf(isSetMaxMemory()).compareTo(typedOther.isSetMaxMemory());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetMaxMemory()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxMemory,
typedOther.maxMemory);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison =
Boolean.valueOf(isSetLatencyMs()).compareTo(typedOther.isSetLatencyMs());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetLatencyMs()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.latencyMs,
typedOther.latencyMs);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison =
Boolean.valueOf(isSetTimeoutMs()).compareTo(typedOther.isSetTimeoutMs());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetTimeoutMs()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeoutMs,
typedOther.timeoutMs);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison =
Boolean.valueOf(isSetThreads()).compareTo(typedOther.isSetThreads());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetThreads()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.threads,
typedOther.threads);
+ 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 {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws
org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("WriterOptions(");
+ boolean first = true;
+
+ sb.append("maxMemory:");
+ sb.append(this.maxMemory);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("latencyMs:");
+ sb.append(this.latencyMs);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("timeoutMs:");
+ sb.append(this.timeoutMs);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("threads:");
+ sb.append(this.threads);
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ }
+
+ 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_bitfield = 0;
+ 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);
+ }
+ }
+
+ private static class WriterOptionsStandardSchemeFactory implements
SchemeFactory {
+ public WriterOptionsStandardScheme getScheme() {
+ return new WriterOptionsStandardScheme();
+ }
+ }
+
+ private static class WriterOptionsStandardScheme extends
StandardScheme<WriterOptions> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, WriterOptions
struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // MAX_MEMORY
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.maxMemory = iprot.readI64();
+ struct.setMaxMemoryIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
+ }
+ break;
+ case 2: // LATENCY_MS
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.latencyMs = iprot.readI64();
+ struct.setLatencyMsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
+ }
+ break;
+ case 3: // TIMEOUT_MS
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.timeoutMs = iprot.readI64();
+ struct.setTimeoutMsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
+ }
+ break;
+ case 4: // THREADS
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.threads = iprot.readI32();
+ struct.setThreadsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked
in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot,
WriterOptions struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(MAX_MEMORY_FIELD_DESC);
+ oprot.writeI64(struct.maxMemory);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(LATENCY_MS_FIELD_DESC);
+ oprot.writeI64(struct.latencyMs);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(TIMEOUT_MS_FIELD_DESC);
+ oprot.writeI64(struct.timeoutMs);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(THREADS_FIELD_DESC);
+ oprot.writeI32(struct.threads);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class WriterOptionsTupleSchemeFactory implements
SchemeFactory {
+ public WriterOptionsTupleScheme getScheme() {
+ return new WriterOptionsTupleScheme();
+ }
+ }
+
+ private static class WriterOptionsTupleScheme extends
TupleScheme<WriterOptions> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, WriterOptions
struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetMaxMemory()) {
+ optionals.set(0);
+ }
+ if (struct.isSetLatencyMs()) {
+ optionals.set(1);
+ }
+ if (struct.isSetTimeoutMs()) {
+ optionals.set(2);
+ }
+ if (struct.isSetThreads()) {
+ optionals.set(3);
+ }
+ oprot.writeBitSet(optionals, 4);
+ if (struct.isSetMaxMemory()) {
+ oprot.writeI64(struct.maxMemory);
+ }
+ if (struct.isSetLatencyMs()) {
+ oprot.writeI64(struct.latencyMs);
+ }
+ if (struct.isSetTimeoutMs()) {
+ oprot.writeI64(struct.timeoutMs);
+ }
+ if (struct.isSetThreads()) {
+ oprot.writeI32(struct.threads);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, WriterOptions
struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(4);
+ if (incoming.get(0)) {
+ struct.maxMemory = iprot.readI64();
+ struct.setMaxMemoryIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.latencyMs = iprot.readI64();
+ struct.setLatencyMsIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.timeoutMs = iprot.readI64();
+ struct.setTimeoutMsIsSet(true);
+ }
+ if (incoming.get(3)) {
+ struct.threads = iprot.readI32();
+ struct.setThreadsIsSet(true);
+ }
+ }
+ }
+
+}
+
Propchange:
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/WriterOptions.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: accumulo/trunk/proxy/src/main/thrift/proxy.thrift
URL:
http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/thrift/proxy.thrift?rev=1438121&r1=1438120&r2=1438121&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/main/thrift/proxy.thrift (original)
+++ accumulo/trunk/proxy/src/main/thrift/proxy.thrift Thu Jan 24 18:37:18 2013
@@ -89,7 +89,7 @@ struct BatchScanOptions {
2:optional list<Range> ranges,
3:optional list<ScanColumn> columns;
4:optional list<IteratorSetting> iterators;
- 5:optional i32 bufferSize;
+ 5:optional i32 threads;
}
struct KeyValueAndPeek {
@@ -182,6 +182,13 @@ struct ActiveCompaction {
10:list<IteratorSetting> iterators;
}
+struct WriterOptions {
+ 1:i64 maxMemory
+ 2:i64 latencyMs
+ 3:i64 timeoutMs
+ 4:i32 threads
+}
+
enum IteratorScope {
MINC,
MAJC,
@@ -318,7 +325,7 @@ service AccumuloProxy
// writing
void updateAndFlush(1:UserPass userpass, 2:string tableName, 3:map<binary,
list<ColumnUpdate>> cells) throws(1:AccumuloException outch1,
2:AccumuloSecurityException ouch2);
- string createWriter(1:UserPass userpass, 2:string tableName)
throws(1:AccumuloException outch1,
2:AccumuloSecurityException ouch2);
+ string createWriter(1:UserPass userpass, 2:string tableName, 3:WriterOptions
opts) throws(1:AccumuloException outch1,
2:AccumuloSecurityException ouch2);
// use the writer
oneway void writer_update(1:string writer, 2:map<binary, list<ColumnUpdate>>
cells);
Modified:
accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java?rev=1438121&r1=1438120&r2=1438121&view=diff
==============================================================================
---
accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
(original)
+++
accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
Thu Jan 24 18:37:18 2013
@@ -268,7 +268,7 @@ public class TestProxyReadWrite {
int maxInserts = 1000000;
Map<ByteBuffer,List<ColumnUpdate>> mutations = new
HashMap<ByteBuffer,List<ColumnUpdate>>();
String format = "%1$06d";
- String writer = tpc.proxy().createWriter(userpass, testtable);
+ String writer = tpc.proxy().createWriter(userpass, testtable, null);
for (int i = 0; i < maxInserts; i++) {
addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i,
Util.randString(10));
@@ -308,7 +308,7 @@ public class TestProxyReadWrite {
int maxInserts = 10000;
Map<ByteBuffer,List<ColumnUpdate>> mutations = new
HashMap<ByteBuffer,List<ColumnUpdate>>();
String format = "%1$05d";
- String writer = tpc.proxy().createWriter(userpass, testtable);
+ String writer = tpc.proxy().createWriter(userpass, testtable, null);
for (int i = 0; i < maxInserts; i++) {
addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i,
Util.randString(10));
@@ -358,7 +358,7 @@ public class TestProxyReadWrite {
int maxInserts = 10000;
Map<ByteBuffer,List<ColumnUpdate>> mutations = new
HashMap<ByteBuffer,List<ColumnUpdate>>();
String format = "%1$05d";
- String writer = tpc.proxy().createWriter(userpass, testtable);
+ String writer = tpc.proxy().createWriter(userpass, testtable, null);
for (int i = 0; i < maxInserts; i++) {
if (i % 2 == 0)
addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i,
"even", Util.randString(10));