Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 617 Bytes

KeyVal.adoc

File metadata and controls

28 lines (22 loc) · 617 Bytes

KeyVal

  • Examples:

    Retrieve All Keys
    ByteSequence key = ByteSequence.fromString("\0");
    
    GetOption option = GetOption.newBuilder()
        .withSortField(GetOption.SortTarget.KEY)
        .withSortOrder(GetOption.SortOrder.DESCEND)
        .withRange(key)
        .build();
    
    CompletableFuture<GetResponse> futureResponse = client.getKVClient().get(key, option);
    
    GetResponse response = futureResponse.get();
    Map<String, String> keyValueMap = new HashMap<>();
    
    for (KeyValue kv : response.getKvs()) {
        keyValueMap.put(
            kv.getKey().toStringUtf8(),
            kv.getValue().toStringUtf8()
        );
    }