byte[] label = visLabel.getLabel().toByteArray(); labels.add(label);
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel)) { return super.equals(obj); } org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel other = (org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel) obj; boolean result = true; result = result && (hasLabel() == other.hasLabel()); if (hasLabel()) { result = result && getLabel() .equals(other.getLabel()); } result = result && (hasOrdinal() == other.hasOrdinal()); if (hasOrdinal()) { result = result && (getOrdinal() == other.getOrdinal()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
/** * Creates the labels data to be written to zookeeper. * @param existingLabels * @return Bytes form of labels and their ordinal details to be written to zookeeper. */ public static byte[] getDataToWriteToZooKeeper(Map<String, Integer> existingLabels) { VisibilityLabelsRequest.Builder visReqBuilder = VisibilityLabelsRequest.newBuilder(); for (Entry<String, Integer> entry : existingLabels.entrySet()) { VisibilityLabel.Builder visLabBuilder = VisibilityLabel.newBuilder(); visLabBuilder.setLabel(ByteString.copyFrom(Bytes.toBytes(entry.getKey()))); visLabBuilder.setOrdinal(entry.getValue()); visReqBuilder.addVisLabel(visLabBuilder.build()); } return ProtobufUtil.prependPBMagic(visReqBuilder.build().toByteArray()); }
byte[] label = visLabel.getLabel().toByteArray(); labels.add(label);
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel)) { return super.equals(obj); } org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel other = (org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel) obj; boolean result = true; result = result && (hasLabel() == other.hasLabel()); if (hasLabel()) { result = result && getLabel() .equals(other.getLabel()); } result = result && (hasOrdinal() == other.hasOrdinal()); if (hasOrdinal()) { result = result && (getOrdinal() == other.getOrdinal()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel)) { return super.equals(obj); } org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel other = (org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel) obj; boolean result = true; result = result && (hasLabel() == other.hasLabel()); if (hasLabel()) { result = result && getLabel() .equals(other.getLabel()); } result = result && (hasOrdinal() == other.hasOrdinal()); if (hasOrdinal()) { result = result && (getOrdinal() == other.getOrdinal()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel)) { return super.equals(obj); } org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel other = (org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel) obj; boolean result = true; result = result && (hasLabel() == other.hasLabel()); if (hasLabel()) { result = result && getLabel() .equals(other.getLabel()); } result = result && (hasOrdinal() == other.hasOrdinal()); if (hasOrdinal()) { result = result && (getOrdinal() == other.getOrdinal()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
public void refreshLabelsCache(byte[] data) throws IOException { List<VisibilityLabel> visibilityLabels = null; try { visibilityLabels = VisibilityUtils.readLabelsFromZKData(data); } catch (DeserializationException dse) { throw new IOException(dse); } this.lock.writeLock().lock(); try { labels.clear(); ordinalVsLabels.clear(); for (VisibilityLabel visLabel : visibilityLabels) { String label = Bytes.toString(visLabel.getLabel().toByteArray()); labels.put(label, visLabel.getOrdinal()); ordinalVsLabels.put(visLabel.getOrdinal(), label); } } finally { this.lock.writeLock().unlock(); } }
public org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel buildPartial() { org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel result = new org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.label_ = label_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.ordinal_ = ordinal_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasLabel()) { hash = (37 * hash) + LABEL_FIELD_NUMBER; hash = (53 * hash) + getLabel().hashCode(); } if (hasOrdinal()) { hash = (37 * hash) + ORDINAL_FIELD_NUMBER; hash = (53 * hash) + getOrdinal(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; }
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.facebook.presto.hbase.$internal.com.google.protobuf.CodedOutputStream .computeBytesSize(1, label_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.facebook.presto.hbase.$internal.com.google.protobuf.CodedOutputStream .computeUInt32Size(2, ordinal_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasLabel()) { hash = (37 * hash) + LABEL_FIELD_NUMBER; hash = (53 * hash) + getLabel().hashCode(); } if (hasOrdinal()) { hash = (37 * hash) + ORDINAL_FIELD_NUMBER; hash = (53 * hash) + getOrdinal(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; }
public org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel buildPartial() { org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel result = new org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.label_ = label_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.ordinal_ = ordinal_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasLabel()) { hash = (37 * hash) + LABEL_FIELD_NUMBER; hash = (53 * hash) + getLabel().hashCode(); } if (hasOrdinal()) { hash = (37 * hash) + ORDINAL_FIELD_NUMBER; hash = (53 * hash) + getOrdinal(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; }
public org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel buildPartial() { org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel result = new org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.label_ = label_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.ordinal_ = ordinal_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
public Builder toBuilder() { return newBuilder(this); }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabel prototype) {
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, label_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(2, ordinal_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; }