HBASE-2609 Harmonize the Get and Delete operations
This commit is contained in:
parent
34f9962618
commit
1d6c4678bb
|
@ -43,15 +43,15 @@ import org.apache.hadoop.hbase.util.Bytes;
|
|||
* to delete. To further define the scope of what to delete, perform
|
||||
* additional methods as outlined below.
|
||||
* <p>
|
||||
* To delete specific families, execute {@link #deleteFamily(byte[]) deleteFamily}
|
||||
* To delete specific families, execute {@link #addFamily(byte[]) deleteFamily}
|
||||
* for each family to delete.
|
||||
* <p>
|
||||
* To delete multiple versions of specific columns, execute
|
||||
* {@link #deleteColumns(byte[], byte[]) deleteColumns}
|
||||
* {@link #addColumns(byte[], byte[]) deleteColumns}
|
||||
* for each column to delete.
|
||||
* <p>
|
||||
* To delete specific versions of specific columns, execute
|
||||
* {@link #deleteColumn(byte[], byte[], long) deleteColumn}
|
||||
* {@link #addColumn(byte[], byte[], long) deleteColumn}
|
||||
* for each column version to delete.
|
||||
* <p>
|
||||
* Specifying timestamps, deleteFamily and deleteColumns will delete all
|
||||
|
@ -185,8 +185,22 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||
* specified family.
|
||||
* @param family family name
|
||||
* @return this for invocation chaining
|
||||
* @deprecated Since 1.0.0. Use {@link #addFamily(byte[])}
|
||||
*/
|
||||
@Deprecated
|
||||
public Delete deleteFamily(byte [] family) {
|
||||
return addFamily(family);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all versions of all columns of the specified family.
|
||||
* <p>
|
||||
* Overrides previous calls to deleteColumn and deleteColumns for the
|
||||
* specified family.
|
||||
* @param family family name
|
||||
* @return this for invocation chaining
|
||||
*/
|
||||
public Delete addFamily(final byte [] family) {
|
||||
this.deleteFamily(family, this.ts);
|
||||
return this;
|
||||
}
|
||||
|
@ -200,9 +214,24 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||
* @param family family name
|
||||
* @param timestamp maximum version timestamp
|
||||
* @return this for invocation chaining
|
||||
* @deprecated Since 1.0.0. Use {@link #addFamily(byte[], long)}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Deprecated
|
||||
public Delete deleteFamily(byte [] family, long timestamp) {
|
||||
return addFamily(family, timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all columns of the specified family with a timestamp less than
|
||||
* or equal to the specified timestamp.
|
||||
* <p>
|
||||
* Overrides previous calls to deleteColumn and deleteColumns for the
|
||||
* specified family.
|
||||
* @param family family name
|
||||
* @param timestamp maximum version timestamp
|
||||
* @return this for invocation chaining
|
||||
*/
|
||||
public Delete addFamily(final byte [] family, final long timestamp) {
|
||||
if (timestamp < 0) {
|
||||
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + timestamp);
|
||||
}
|
||||
|
@ -226,6 +255,19 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||
* @return this for invocation chaining
|
||||
*/
|
||||
public Delete deleteFamilyVersion(byte [] family, long timestamp) {
|
||||
return addFamilyVersion(family, timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all columns of the specified family with a timestamp equal to
|
||||
* the specified timestamp.
|
||||
* @param family family name
|
||||
* @param timestamp version timestamp
|
||||
* @return this for invocation chaining
|
||||
* @deprecated Since hbase-1.0.0. Use {@link #addFamilyVersion(byte[], long)}
|
||||
*/
|
||||
@Deprecated
|
||||
public Delete addFamilyVersion(final byte [] family, final long timestamp) {
|
||||
List<Cell> list = familyMap.get(family);
|
||||
if(list == null) {
|
||||
list = new ArrayList<Cell>();
|
||||
|
@ -236,6 +278,17 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all versions of the specified column.
|
||||
* @param family family name
|
||||
* @param qualifier column qualifier
|
||||
* @return this for invocation chaining
|
||||
* @deprecated Since hbase-1.0.0. Use {@link #addColumns(byte[], byte[])}
|
||||
*/
|
||||
@Deprecated
|
||||
public Delete deleteColumns(byte [] family, byte [] qualifier) {
|
||||
return addColumns(family, qualifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all versions of the specified column.
|
||||
|
@ -243,8 +296,8 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||
* @param qualifier column qualifier
|
||||
* @return this for invocation chaining
|
||||
*/
|
||||
public Delete deleteColumns(byte [] family, byte [] qualifier) {
|
||||
this.deleteColumns(family, qualifier, this.ts);
|
||||
public Delete addColumns(final byte [] family, final byte [] qualifier) {
|
||||
addColumns(family, qualifier, this.ts);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -255,9 +308,22 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||
* @param qualifier column qualifier
|
||||
* @param timestamp maximum version timestamp
|
||||
* @return this for invocation chaining
|
||||
* @deprecated Since hbase-1.0.0. Use {@link #addColumns(byte[], byte[], long)}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Deprecated
|
||||
public Delete deleteColumns(byte [] family, byte [] qualifier, long timestamp) {
|
||||
return addColumns(family, qualifier, timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all versions of the specified column with a timestamp less than
|
||||
* or equal to the specified timestamp.
|
||||
* @param family family name
|
||||
* @param qualifier column qualifier
|
||||
* @param timestamp maximum version timestamp
|
||||
* @return this for invocation chaining
|
||||
*/
|
||||
public Delete addColumns(final byte [] family, final byte [] qualifier, final long timestamp) {
|
||||
if (timestamp < 0) {
|
||||
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + timestamp);
|
||||
}
|
||||
|
@ -279,8 +345,23 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||
* @param family family name
|
||||
* @param qualifier column qualifier
|
||||
* @return this for invocation chaining
|
||||
* @deprecated Since hbase-1.0.0. Use {@link #addColumn(byte[], byte[])}
|
||||
*/
|
||||
@Deprecated
|
||||
public Delete deleteColumn(byte [] family, byte [] qualifier) {
|
||||
return addColumn(family, qualifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the latest version of the specified column.
|
||||
* This is an expensive call in that on the server-side, it first does a
|
||||
* get to find the latest versions timestamp. Then it adds a delete using
|
||||
* the fetched cells timestamp.
|
||||
* @param family family name
|
||||
* @param qualifier column qualifier
|
||||
* @return this for invocation chaining
|
||||
*/
|
||||
public Delete addColumn(final byte [] family, final byte [] qualifier) {
|
||||
this.deleteColumn(family, qualifier, this.ts);
|
||||
return this;
|
||||
}
|
||||
|
@ -291,9 +372,21 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||
* @param qualifier column qualifier
|
||||
* @param timestamp version timestamp
|
||||
* @return this for invocation chaining
|
||||
* @deprecated Since hbase-1.0.0. Use {@link #addColumn(byte[], byte[], long)}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Deprecated
|
||||
public Delete deleteColumn(byte [] family, byte [] qualifier, long timestamp) {
|
||||
return addColumn(family, qualifier, timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the specified version of the specified column.
|
||||
* @param family family name
|
||||
* @param qualifier column qualifier
|
||||
* @param timestamp version timestamp
|
||||
* @return this for invocation chaining
|
||||
*/
|
||||
public Delete addColumn(byte [] family, byte [] qualifier, long timestamp) {
|
||||
if (timestamp < 0) {
|
||||
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + timestamp);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue