@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; }
@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 protected KeyValue<Bytes, byte[]> makeNext() { if (iter == null || !iter.hasNext()) { Kv.Range.Builder rangeBuilder = Kv.Range.newBuilder(); if (next != null) { rangeBuilder.setStart(ByteString.copyFrom(next.key.get())); } else if (from != null) { rangeBuilder.setStart(ByteString.copyFrom(from.get())); } iter = blockingStub.iterate(rangeBuilder.buildPartial()); if (!iter.hasNext()) { return allDone(); } } next = POJOUtils.buildKeyValue(iter.next()); if (to == null || next.key.compareTo(to) < 0) { return next; } return allDone(); } }
@Override protected KeyValue<Bytes, byte[]> makeNext() { if (iter == null || !iter.hasNext()) { if (next == null) { iter = blockingStub.iterate(Kv.Range.newBuilder().buildPartial()); } else { iter = blockingStub.iterate(Kv.Range.newBuilder().setStart(ByteString.copyFrom(next.key.get())).buildPartial()); } if (!iter.hasNext()) { return allDone(); } } next = POJOUtils.buildKeyValue(iter.next()); return next; } }
@java.lang.Override protected KVServiceBlockingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new KVServiceBlockingStub(channel, callOptions); }
/** * Creates a new blocking-style stub that supports unary and streaming output calls on the service */ public static KVServiceBlockingStub newBlockingStub( io.grpc.Channel channel) { return new KVServiceBlockingStub(channel); }
@java.lang.Override protected KVServiceBlockingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new KVServiceBlockingStub(channel, callOptions); }
@Override public synchronized void destroy() { blockingStub.destroy(Kv.Empty.newBuilder().build()); close(); this.channel = null; this.blockingStub = null; this.stub = null; }
@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; }
/** * <pre> * put an entry to table if absent * </pre> */ public com.webank.ai.fate.api.eggroll.storage.Kv.Operand putIfAbsent(com.webank.ai.fate.api.eggroll.storage.Kv.Operand request) { return blockingUnaryCall( getChannel(), getPutIfAbsentMethod(), getCallOptions(), request); }
/** * <pre> * put an entry to table * </pre> */ public com.webank.ai.fate.api.eggroll.storage.Kv.Empty put(com.webank.ai.fate.api.eggroll.storage.Kv.Operand request) { return blockingUnaryCall( getChannel(), getPutMethod(), getCallOptions(), request); }
/** * <pre> * create a table * </pre> */ public com.webank.ai.fate.api.eggroll.storage.Kv.CreateTableInfo createIfAbsent(com.webank.ai.fate.api.eggroll.storage.Kv.CreateTableInfo request) { return blockingUnaryCall( getChannel(), getCreateIfAbsentMethod(), getCallOptions(), request); }
@Override public long count() { Kv.Count result = blockingStub.count(ModelConstants.EMPTY); return result.getValue(); }
/** * <pre> * delete an entry from table * </pre> */ public com.webank.ai.fate.api.eggroll.storage.Kv.Operand delete(com.webank.ai.fate.api.eggroll.storage.Kv.Operand request) { return blockingUnaryCall( getChannel(), getDeleteMethod(), getCallOptions(), request); }
/** * <pre> * count record amount of a table * </pre> */ public com.webank.ai.fate.api.eggroll.storage.Kv.Count count(com.webank.ai.fate.api.eggroll.storage.Kv.Empty request) { return blockingUnaryCall( getChannel(), getCountMethod(), getCallOptions(), request); } }
/** * <pre> * get an entry from table * </pre> */ public com.webank.ai.fate.api.eggroll.storage.Kv.Operand get(com.webank.ai.fate.api.eggroll.storage.Kv.Operand request) { return blockingUnaryCall( getChannel(), getGetMethod(), getCallOptions(), request); }
/** * <pre> * put an entry to table * </pre> */ public com.webank.ai.fate.api.eggroll.storage.Kv.Empty put(com.webank.ai.fate.api.eggroll.storage.Kv.Operand request) { return blockingUnaryCall( getChannel(), getPutMethod(), getCallOptions(), request); }
/** * <pre> * destroy a table * </pre> */ public com.webank.ai.fate.api.eggroll.storage.Kv.Empty destroy(com.webank.ai.fate.api.eggroll.storage.Kv.Empty request) { return blockingUnaryCall( getChannel(), getDestroyMethod(), getCallOptions(), request); }
/** * <pre> * iterate through a table. Response entries are ordered * </pre> */ public java.util.Iterator<com.webank.ai.fate.api.eggroll.storage.Kv.Operand> iterate( com.webank.ai.fate.api.eggroll.storage.Kv.Range request) { return blockingServerStreamingCall( getChannel(), getIterateMethod(), getCallOptions(), request); }