Index: hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java =================================================================== --- hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java (revision 1426405) +++ hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java (working copy) @@ -1661,6 +1661,30 @@ return new KeyValue(newBuffer); } + @Override + public byte[] getTagsArray() { + // TODO + return null; + } + + @Override + public int getNumTags() { + // TODO + return 0; + } + + @Override + public int getTagsOffset() { + // TODO + return 0; + } + + @Override + public int getTagsLength() { + // TODO + return 0; + } + /** * Splits a column in family:qualifier form into separate byte arrays. *

Index: hbase-common/src/main/java/org/apache/hadoop/hbase/util/PairOfSameType.java =================================================================== --- hbase-common/src/main/java/org/apache/hadoop/hbase/util/PairOfSameType.java (revision 0) +++ hbase-common/src/main/java/org/apache/hadoop/hbase/util/PairOfSameType.java (revision 0) @@ -0,0 +1,115 @@ +/** + * + * 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. + */ + +package org.apache.hadoop.hbase.util; + +import java.util.Iterator; + +import org.apache.commons.lang.NotImplementedException; +import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.classification.InterfaceStability; + +/** + * A generic, immutable class for pairs of objects both of type T. + * @param + * @see Pair if Types differ. + */ +@InterfaceAudience.Public +@InterfaceStability.Stable +public class PairOfSameType implements Iterable { + private final T first; + private final T second; + + /** + * Constructor + * @param a operand + * @param b operand + */ + public PairOfSameType(T a, T b) { + this.first = a; + this.second = b; + } + + /** + * Return the first element stored in the pair. + * @return T + */ + public T getFirst() { + return first; + } + + /** + * Return the second element stored in the pair. + * @return T + */ + public T getSecond() { + return second; + } + + private static boolean equals(Object x, Object y) { + return (x == null && y == null) || (x != null && x.equals(y)); + } + + @Override + @SuppressWarnings("unchecked") + public boolean equals(Object other) { + return other instanceof PairOfSameType && + equals(first, ((PairOfSameType)other).first) && + equals(second, ((PairOfSameType)other).second); + } + + @Override + public int hashCode() { + if (first == null) + return (second == null) ? 0 : second.hashCode() + 1; + else if (second == null) + return first.hashCode() + 2; + else + return first.hashCode() * 17 + second.hashCode(); + } + + @Override + public String toString() { + return "{" + getFirst() + "," + getSecond() + "}"; + } + + @Override + public Iterator iterator() { + return new Iterator() { + private int returned = 0; + + @Override + public boolean hasNext() { + return this.returned < 2; + } + + @Override + public T next() { + if (++this.returned == 1) return getFirst(); + else if (this.returned == 2) return getSecond(); + else throw new IllegalAccessError("this.returned=" + this.returned); + } + + @Override + public void remove() { + throw new NotImplementedException(); + } + }; + } +} Index: hbase-common/src/main/java/org/apache/hadoop/hbase/util/Pair.java =================================================================== --- hbase-common/src/main/java/org/apache/hadoop/hbase/util/Pair.java (revision 0) +++ hbase-common/src/main/java/org/apache/hadoop/hbase/util/Pair.java (revision 0) @@ -0,0 +1,135 @@ +/** + * + * 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. + */ + +package org.apache.hadoop.hbase.util; + +import java.io.Serializable; + +import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.classification.InterfaceStability; + +/** + * A generic class for pairs. + * @param + * @param + */ +@InterfaceAudience.Public +@InterfaceStability.Stable +public class Pair implements Serializable +{ + private static final long serialVersionUID = -3986244606585552569L; + protected T1 first = null; + protected T2 second = null; + + /** + * Default constructor. + */ + public Pair() + { + } + + /** + * Constructor + * @param a operand + * @param b operand + */ + public Pair(T1 a, T2 b) + { + this.first = a; + this.second = b; + } + + /** + * Constructs a new pair, inferring the type via the passed arguments + * @param type for first + * @param type for second + * @param a first element + * @param b second element + * @return a new pair containing the passed arguments + */ + public static Pair newPair(T1 a, T2 b) { + return new Pair(a, b); + } + + /** + * Replace the first element of the pair. + * @param a operand + */ + public void setFirst(T1 a) + { + this.first = a; + } + + /** + * Replace the second element of the pair. + * @param b operand + */ + public void setSecond(T2 b) + { + this.second = b; + } + + /** + * Return the first element stored in the pair. + * @return T1 + */ + public T1 getFirst() + { + return first; + } + + /** + * Return the second element stored in the pair. + * @return T2 + */ + public T2 getSecond() + { + return second; + } + + private static boolean equals(Object x, Object y) + { + return (x == null && y == null) || (x != null && x.equals(y)); + } + + @Override + @SuppressWarnings("unchecked") + public boolean equals(Object other) + { + return other instanceof Pair && equals(first, ((Pair)other).first) && + equals(second, ((Pair)other).second); + } + + @Override + public int hashCode() + { + if (first == null) + return (second == null) ? 0 : second.hashCode() + 1; + else if (second == null) + return first.hashCode() + 2; + else + return first.hashCode() * 17 + second.hashCode(); + } + + @Override + public String toString() + { + return "{" + getFirst() + "," + getSecond() + "}"; + } +} Index: hbase-common/src/main/java/org/apache/hbase/cell/CellTool.java =================================================================== --- hbase-common/src/main/java/org/apache/hbase/cell/CellTool.java (revision 1426405) +++ hbase-common/src/main/java/org/apache/hbase/cell/CellTool.java (working copy) @@ -23,6 +23,7 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.hbase.util.ByteRange; +import org.apache.hadoop.hbase.util.Pair; import org.apache.hbase.Cell; @InterfaceAudience.Private @@ -115,4 +116,8 @@ return buffer; } + public static Iterable> getTagsIterator(Cell cell) { + // TODO + return null; + } } Index: hbase-common/src/main/java/org/apache/hbase/Cell.java =================================================================== --- hbase-common/src/main/java/org/apache/hbase/Cell.java (revision 1426405) +++ hbase-common/src/main/java/org/apache/hbase/Cell.java (working copy) @@ -169,4 +169,23 @@ */ int getValueLength(); + /** + * @return Contiguous raw bytes that contain the tags for the cell + */ + byte[] getTagsArray(); + + /** + * @return The number of tags. Must be >= 0. + */ + int getNumTags(); + + /** + * @return Array index of the first byte of tag data + */ + int getTagsOffset(); + + /** + * @return Number of tag data bytes + */ + int getTagsLength(); } Index: hbase-server/src/main/java/org/apache/hadoop/hbase/util/Pair.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/util/Pair.java (revision 1426405) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/util/Pair.java (working copy) @@ -1,135 +0,0 @@ -/** - * - * 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. - */ - -package org.apache.hadoop.hbase.util; - -import java.io.Serializable; - -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.classification.InterfaceStability; - -/** - * A generic class for pairs. - * @param - * @param - */ -@InterfaceAudience.Public -@InterfaceStability.Stable -public class Pair implements Serializable -{ - private static final long serialVersionUID = -3986244606585552569L; - protected T1 first = null; - protected T2 second = null; - - /** - * Default constructor. - */ - public Pair() - { - } - - /** - * Constructor - * @param a operand - * @param b operand - */ - public Pair(T1 a, T2 b) - { - this.first = a; - this.second = b; - } - - /** - * Constructs a new pair, inferring the type via the passed arguments - * @param type for first - * @param type for second - * @param a first element - * @param b second element - * @return a new pair containing the passed arguments - */ - public static Pair newPair(T1 a, T2 b) { - return new Pair(a, b); - } - - /** - * Replace the first element of the pair. - * @param a operand - */ - public void setFirst(T1 a) - { - this.first = a; - } - - /** - * Replace the second element of the pair. - * @param b operand - */ - public void setSecond(T2 b) - { - this.second = b; - } - - /** - * Return the first element stored in the pair. - * @return T1 - */ - public T1 getFirst() - { - return first; - } - - /** - * Return the second element stored in the pair. - * @return T2 - */ - public T2 getSecond() - { - return second; - } - - private static boolean equals(Object x, Object y) - { - return (x == null && y == null) || (x != null && x.equals(y)); - } - - @Override - @SuppressWarnings("unchecked") - public boolean equals(Object other) - { - return other instanceof Pair && equals(first, ((Pair)other).first) && - equals(second, ((Pair)other).second); - } - - @Override - public int hashCode() - { - if (first == null) - return (second == null) ? 0 : second.hashCode() + 1; - else if (second == null) - return first.hashCode() + 2; - else - return first.hashCode() * 17 + second.hashCode(); - } - - @Override - public String toString() - { - return "{" + getFirst() + "," + getSecond() + "}"; - } -} Index: hbase-server/src/main/java/org/apache/hadoop/hbase/util/PairOfSameType.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/util/PairOfSameType.java (revision 1426405) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/util/PairOfSameType.java (working copy) @@ -1,115 +0,0 @@ -/** - * - * 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. - */ - -package org.apache.hadoop.hbase.util; - -import java.util.Iterator; - -import org.apache.commons.lang.NotImplementedException; -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.classification.InterfaceStability; - -/** - * A generic, immutable class for pairs of objects both of type T. - * @param - * @see Pair if Types differ. - */ -@InterfaceAudience.Public -@InterfaceStability.Stable -public class PairOfSameType implements Iterable { - private final T first; - private final T second; - - /** - * Constructor - * @param a operand - * @param b operand - */ - public PairOfSameType(T a, T b) { - this.first = a; - this.second = b; - } - - /** - * Return the first element stored in the pair. - * @return T - */ - public T getFirst() { - return first; - } - - /** - * Return the second element stored in the pair. - * @return T - */ - public T getSecond() { - return second; - } - - private static boolean equals(Object x, Object y) { - return (x == null && y == null) || (x != null && x.equals(y)); - } - - @Override - @SuppressWarnings("unchecked") - public boolean equals(Object other) { - return other instanceof PairOfSameType && - equals(first, ((PairOfSameType)other).first) && - equals(second, ((PairOfSameType)other).second); - } - - @Override - public int hashCode() { - if (first == null) - return (second == null) ? 0 : second.hashCode() + 1; - else if (second == null) - return first.hashCode() + 2; - else - return first.hashCode() * 17 + second.hashCode(); - } - - @Override - public String toString() { - return "{" + getFirst() + "," + getSecond() + "}"; - } - - @Override - public Iterator iterator() { - return new Iterator() { - private int returned = 0; - - @Override - public boolean hasNext() { - return this.returned < 2; - } - - @Override - public T next() { - if (++this.returned == 1) return getFirst(); - else if (this.returned == 2) return getSecond(); - else throw new IllegalAccessError("this.returned=" + this.returned); - } - - @Override - public void remove() { - throw new NotImplementedException(); - } - }; - } -}