HBASE-5670 Have Mutation implement the Row interface.

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1306959 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
larsh 2012-03-29 16:21:41 +00:00
parent 67ded34626
commit ea77247c82
9 changed files with 15 additions and 15 deletions

View File

@ -45,8 +45,7 @@ import org.apache.hadoop.io.Writable;
*/ */
@InterfaceAudience.Public @InterfaceAudience.Public
@InterfaceStability.Stable @InterfaceStability.Stable
public class Append extends Mutation implements Row { public class Append extends Mutation {
// TODO: refactor to derive from Put?
private static final String RETURN_RESULTS = "_rr_"; private static final String RETURN_RESULTS = "_rr_";
private static final byte APPEND_VERSION = (byte)1; private static final byte APPEND_VERSION = (byte)1;

View File

@ -69,7 +69,7 @@ import java.util.Map;
@InterfaceAudience.Public @InterfaceAudience.Public
@InterfaceStability.Stable @InterfaceStability.Stable
public class Delete extends Mutation public class Delete extends Mutation
implements Writable, Row, Comparable<Row> { implements Writable, Comparable<Row> {
private static final byte DELETE_VERSION = (byte)3; private static final byte DELETE_VERSION = (byte)3;
/** Constructor for Writable. DO NOT USE */ /** Constructor for Writable. DO NOT USE */

View File

@ -700,7 +700,7 @@ public class HTable implements HTableInterface {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public synchronized void batch(final List<Row> actions, final Object[] results) public synchronized void batch(final List<?extends Row> actions, final Object[] results)
throws InterruptedException, IOException { throws InterruptedException, IOException {
connection.processBatch(actions, tableName, pool, results); connection.processBatch(actions, tableName, pool, results);
} }
@ -709,7 +709,7 @@ public class HTable implements HTableInterface {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public synchronized Object[] batch(final List<Row> actions) throws InterruptedException, IOException { public synchronized Object[] batch(final List<? extends Row> actions) throws InterruptedException, IOException {
Object[] results = new Object[actions.size()]; Object[] results = new Object[actions.size()];
connection.processBatch(actions, tableName, pool, results); connection.processBatch(actions, tableName, pool, results);
return results; return results;

View File

@ -92,7 +92,7 @@ public interface HTableInterface extends Closeable {
* @throws IOException * @throws IOException
* @since 0.90.0 * @since 0.90.0
*/ */
void batch(final List<Row> actions, final Object[] results) throws IOException, InterruptedException; void batch(final List<?extends Row> actions, final Object[] results) throws IOException, InterruptedException;
/** /**
* Same as {@link #batch(List, Object[])}, but returns an array of * Same as {@link #batch(List, Object[])}, but returns an array of
@ -104,7 +104,7 @@ public interface HTableInterface extends Closeable {
* @throws IOException * @throws IOException
* @since 0.90.0 * @since 0.90.0
*/ */
Object[] batch(final List<Row> actions) throws IOException, InterruptedException; Object[] batch(final List<? extends Row> actions) throws IOException, InterruptedException;
/** /**
* Extracts certain cells from a given row. * Extracts certain cells from a given row.

View File

@ -354,13 +354,13 @@ public class HTablePool implements Closeable {
} }
@Override @Override
public void batch(List<Row> actions, Object[] results) throws IOException, public void batch(List<? extends Row> actions, Object[] results) throws IOException,
InterruptedException { InterruptedException {
table.batch(actions, results); table.batch(actions, results);
} }
@Override @Override
public Object[] batch(List<Row> actions) throws IOException, public Object[] batch(List<? extends Row> actions) throws IOException,
InterruptedException { InterruptedException {
return table.batch(actions); return table.batch(actions);
} }

View File

@ -35,7 +35,7 @@ import org.apache.hadoop.hbase.util.Bytes;
@InterfaceAudience.Public @InterfaceAudience.Public
@InterfaceStability.Evolving @InterfaceStability.Evolving
public abstract class Mutation extends OperationWithAttributes { public abstract class Mutation extends OperationWithAttributes implements Row {
// Attribute used in Mutations to indicate the originating cluster. // Attribute used in Mutations to indicate the originating cluster.
private static final String CLUSTER_ID_ATTR = "_c.id_"; private static final String CLUSTER_ID_ATTR = "_c.id_";
@ -152,6 +152,7 @@ public abstract class Mutation extends OperationWithAttributes {
* Method for retrieving the delete's row * Method for retrieving the delete's row
* @return row * @return row
*/ */
@Override
public byte [] getRow() { public byte [] getRow() {
return this.row; return this.row;
} }

View File

@ -48,7 +48,7 @@ import java.util.TreeMap;
@InterfaceAudience.Public @InterfaceAudience.Public
@InterfaceStability.Stable @InterfaceStability.Stable
public class Put extends Mutation public class Put extends Mutation
implements HeapSize, Writable, Row, Comparable<Row> { implements HeapSize, Writable, Comparable<Row> {
private static final byte PUT_VERSION = (byte)2; private static final byte PUT_VERSION = (byte)2;
private static final long OVERHEAD = ClassSize.align( private static final long OVERHEAD = ClassSize.align(

View File

@ -470,13 +470,13 @@ public abstract class CoprocessorHost<E extends CoprocessorEnvironment> {
} }
@Override @Override
public void batch(List<Row> actions, Object[] results) public void batch(List<? extends Row> actions, Object[] results)
throws IOException, InterruptedException { throws IOException, InterruptedException {
table.batch(actions, results); table.batch(actions, results);
} }
@Override @Override
public Object[] batch(List<Row> actions) public Object[] batch(List<? extends Row> actions)
throws IOException, InterruptedException { throws IOException, InterruptedException {
return table.batch(actions); return table.batch(actions);
} }

View File

@ -616,12 +616,12 @@ public class RemoteHTable implements HTableInterface {
} }
@Override @Override
public void batch(List<Row> actions, Object[] results) throws IOException { public void batch(List<? extends Row> actions, Object[] results) throws IOException {
throw new IOException("batch not supported"); throw new IOException("batch not supported");
} }
@Override @Override
public Object[] batch(List<Row> actions) throws IOException { public Object[] batch(List<? extends Row> actions) throws IOException {
throw new IOException("batch not supported"); throw new IOException("batch not supported");
} }