@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + KEY_FIELD_NUMBER; hash = (53 * hash) + getKey().hashCode(); hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + KEY_FIELD_NUMBER; hash = (53 * hash) + getKey().hashCode(); hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.webank.ai.fate.api.eggroll.storage.Kv.Operand)) { return super.equals(obj); } com.webank.ai.fate.api.eggroll.storage.Kv.Operand other = (com.webank.ai.fate.api.eggroll.storage.Kv.Operand) obj; boolean result = true; result = result && getKey() .equals(other.getKey()); result = result && getValue() .equals(other.getValue()); result = result && unknownFields.equals(other.unknownFields); return result; }
++count; bytesCount += operand.getKey().size(); bytesCount += operand.getValue().size(); if (bytesCount >= threshold) { break;
byte[] value = response.getValue().toByteArray();
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.webank.ai.fate.api.eggroll.storage.Kv.Operand)) { return super.equals(obj); } com.webank.ai.fate.api.eggroll.storage.Kv.Operand other = (com.webank.ai.fate.api.eggroll.storage.Kv.Operand) obj; boolean result = true; result = result && getKey() .equals(other.getKey()); result = result && getValue() .equals(other.getValue()); result = result && unknownFields.equals(other.unknownFields); return result; }
/** * */ public void putIfAbsent(Kv.Operand request, StreamObserver<Kv.Operand> responseObserver) { KeyValueStore<Bytes, byte[]> store = getStore(); byte[] oldValue = store.putIfAbsent(Bytes.wrap(request.getKey().toByteArray()), request.getValue().toByteArray()); Kv.Operand.Builder builder = Kv.Operand.newBuilder().setKey(request.getKey()); if (oldValue != null) { builder.setValue(ByteString.copyFrom(oldValue)); } responseObserver.onNext(builder.buildPartial()); responseObserver.onCompleted(); }
@Override public byte[] putIfAbsent(Bytes key, byte[] value) { Objects.requireNonNull(key, "key cannot be null"); byte[] rtn; if (value == null) { rtn = blockingStub.delete(POJOUtils.buildOperand(key, new byte[0])).getValue().toByteArray(); } else { rtn = blockingStub.putIfAbsent(POJOUtils.buildOperand(key, value)).getValue().toByteArray(); } if (null == rtn || rtn.length == 0) { return null; } return rtn; }
public static KeyValue<Bytes, byte[]> buildKeyValue(Kv.Operand op) { return KeyValue.pair(Bytes.wrap(op.getKey().toByteArray()), op.getValue().toByteArray()); }
@Override public void put(Kv.Operand request, StreamObserver<Kv.Empty> responseObserver) { LMDBStore store = getStore(); LOGGER.info("{} receive put request. keyLength: {}, valueLength: {}", store, request.getKey().size(), request.getValue().size()); store.put(Bytes.wrap(request.getKey()), request.getValue().toByteArray()); responseObserver.onNext(Kv.Empty.newBuilder().build()); responseObserver.onCompleted(); }
/** * <code>bytes value = 2;</code> */ public Builder clearValue() { value_ = getDefaultInstance().getValue(); onChanged(); return this; } @java.lang.Override
public Builder mergeFrom(com.webank.ai.fate.api.eggroll.storage.Kv.Operand other) { if (other == com.webank.ai.fate.api.eggroll.storage.Kv.Operand.getDefaultInstance()) return this; if (other.getKey() != com.google.protobuf.ByteString.EMPTY) { setKey(other.getKey()); } if (other.getValue() != com.google.protobuf.ByteString.EMPTY) { setValue(other.getValue()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
public Builder mergeFrom(com.webank.ai.fate.api.eggroll.storage.Kv.Operand other) { if (other == com.webank.ai.fate.api.eggroll.storage.Kv.Operand.getDefaultInstance()) return this; if (other.getKey() != com.google.protobuf.ByteString.EMPTY) { setKey(other.getKey()); } if (other.getValue() != com.google.protobuf.ByteString.EMPTY) { setValue(other.getValue()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Override public byte[] delete(Bytes key) { Objects.requireNonNull(key, "key cannot be null"); byte[] rtn = blockingStub.delete(POJOUtils.buildOperand(key, new byte[0])).getValue().toByteArray(); if (null == rtn || rtn.length == 0) { return null; } return rtn; }
/** * <code>bytes value = 2;</code> */ public Builder clearValue() { value_ = getDefaultInstance().getValue(); onChanged(); return this; } @java.lang.Override
@Override public void putIfAbsent(Kv.Operand request, StreamObserver<Kv.Operand> responseObserver) { LMDBStore store = getStore(); byte[] oldValue = store.putIfAbsent(Bytes.wrap(request.getKey()), request.getValue().toByteArray()); Kv.Operand.Builder builder = Kv.Operand.newBuilder().setKey(request.getKey()); if (oldValue != null) { builder.setValue(ByteString.copyFrom(oldValue)); } responseObserver.onNext(builder.buildPartial()); responseObserver.onCompleted(); }
@Override public byte[] get(Bytes key) { Objects.requireNonNull(key, "key cannot be null"); byte[] rtn = blockingStub.get(POJOUtils.buildOperand(key, new byte[0])).getValue().toByteArray(); if (null == rtn || rtn.length == 0) { return null; } return rtn; }
@Override public void put(Kv.Operand request, StreamObserver<Kv.Empty> responseObserver) { KeyValueStore<Bytes, byte[]> store = getStore(); store.put(Bytes.wrap(request.getKey().toByteArray()), request.getValue().toByteArray()); responseObserver.onNext(Kv.Empty.newBuilder().build()); responseObserver.onCompleted(); }