From 4d495185a62affb50fae771129eb28a9fad2fb08 Mon Sep 17 00:00:00 2001 From: oliviarla Date: Mon, 9 Feb 2026 11:44:46 +0900 Subject: [PATCH] DOC: Fix example for pipe async methods --- docs/user-guide/04-list-API.md | 31 +++++++++++---------------- docs/user-guide/05-set-API.md | 37 ++++++++++++--------------------- docs/user-guide/06-map-API.md | 36 ++++++++++++-------------------- docs/user-guide/07-btree-API.md | 34 ++++++++++++------------------ 4 files changed, 51 insertions(+), 87 deletions(-) diff --git a/docs/user-guide/04-list-API.md b/docs/user-guide/04-list-API.md index 6e42643bb..fdbd6cf19 100644 --- a/docs/user-guide/04-list-API.md +++ b/docs/user-guide/04-list-API.md @@ -343,7 +343,7 @@ Future > asyncLopInsertBulk(List keyList, int index, Object value, CollectionAttributes attributesForCreate) ``` -keyList로 지정된 모든 key에 대해 하나의 element를 삽입니다. +keyList로 지정된 모든 key에 대해 하나의 element를 삽입한다. - key: 삽입 대상 list들의 key list - index: 삽입 위치로 0-based index로 지정 @@ -359,18 +359,13 @@ keyList로 지정된 모든 key에 대해 하나의 element를 삽입니다. ```java String key = "Sample:ListBulk"; -List bulkData = getBulkData(); +List bulkData = Arrays.asList("value1", "value2", "value3"); int index = -1; // List의 제일 뒤에 insert한다. CollectionAttributes attributesForCreate = new CollectionAttributes(); -if (bulkData.size() > client.getMaxPipedItemCount()) { // (1) - System.out.println("insert 할 아이템 개수는 client.getMaxPipedItemCount개를 초과할 수 없다."); - return; -} - CollectionFuture> future = null; try { - future = client.asyncLopPipedInsertBulk(key, index, bulkData, attributesForCreate); // (2) + future = client.asyncLopPipedInsertBulk(key, index, bulkData, attributesForCreate); // (1) } catch (Exception e) { // handle exception } @@ -379,12 +374,12 @@ if (future == null) return; try { - Map result = future.get(1000L, TimeUnit.MILLISECONDS); // (3) - if (!result.isEmpty()) { // (4) + Map result = future.get(1000L, TimeUnit.MILLISECONDS); // (2) + if (!result.isEmpty()) { // (3) System.out.println("일부 item이 insert 실패 하였음."); - for (Entry entry : result.entrySet()) { // (5) + for (Entry entry : result.entrySet()) { // (4) System.out.print("실패한 아이템=" + bulkData.get(entry.getKey())); - System.out.println(", 실패원인=" + entry.getValue().getResponse()); // (6) + System.out.println(", 실패원인=" + entry.getValue().getResponse()); // (5) } } else { System.out.println("모두 insert 성공함."); @@ -398,17 +393,15 @@ try { } ``` -1. 한꺼번에 insert할 아이템은 client.getMaxPipedItemCount()개를 초과할 수 없다. (기본값은 500개 이다.) - 만약 개수를 초과하면 IllegalArguementException이 발생한다. -2. Key에 저장된 List에 bulkData를 한꺼번에 insert하고 그 결과를 담은 future객체를 반환한다. +1. Key에 저장된 List에 bulkData를 한꺼번에 insert하고 그 결과를 담은 future객체를 반환한다. 이 future로부터 각 아이템의 insert성공 실패 여부를 조회할 수 있다. 여기에서는 attributesForCreate값을 지정하여 bulk insert하기 전에 key가 없으면 생성하고 element를 insert되도록 하였다. -3. delete timeout은 1초로 지정했다. +2. timeout은 1초로 지정했다. 지정한 시간에 모든 아이템의 insert 결과가 넘어 오지 않거나 JVM의 과부하로 operation queue에서 처리되지 않을 경우 TimeoutException이 발생한다. -4. 모든 아이템이 insert에 성공하면 empty map이 반환된다. +3. 모든 아이템이 insert에 성공하면 empty map이 반환된다. - 반환된 Map의 Key= insert한 값(bulkData)를 iteration했을 때의 index값. - 반환된 Map의 Value= insert 실패사유 -5. 일부 실패한 아이템의 실패 원인을 조회하려면 insert할 때 사용된 값(bulkData)의 iteration 순서에 따라 결과 +4. 일부 실패한 아이템의 실패 원인을 조회하려면 insert할 때 사용된 값(bulkData)의 iteration 순서에 따라 결과 Map을 조회하면 된다. -6. Future로부터 얻은 Map의 Key가 입력된 값(bulkData)의 index이기 때문에 위와 같은 방법으로 실패 원인을 조회하면 된다. +5. Future로부터 얻은 Map의 Key가 입력된 값(bulkData)의 index이기 때문에 위와 같은 방법으로 실패 원인을 조회하면 된다. diff --git a/docs/user-guide/05-set-API.md b/docs/user-guide/05-set-API.md index 2bd96ced8..39c49ba89 100644 --- a/docs/user-guide/05-set-API.md +++ b/docs/user-guide/05-set-API.md @@ -390,17 +390,12 @@ asyncSopInsertBulk(List keyList, Object value, CollectionAttributes attr ```java String key = "Sample:SetBulk"; -List bulkData = getBulkData(); +List bulkData = Arrays.asList("value1", "value2", "value3"); CollectionAttributes attributesForCreate = new CollectionAttributes(); -if (bulkData.size() > client.getMaxPipedItemCount()) { // (1) - System.out.println("insert 할 아이템 개수는 client.getMaxPipedItemCount개를 초과할 수 없다."); - return; -} - CollectionFuture> future = null; try { - future = client.asyncSopPipedInsertBulk(key, bulkData, attributesForCreate); // (2) + future = client.asyncSopPipedInsertBulk(key, bulkData, attributesForCreate); // (1) } catch (Exception e) { // handle exception } @@ -409,12 +404,12 @@ if (future == null) return; try { - Map result = future.get(1000L, TimeUnit.MILLISECONDS); // (3) - if (!result.isEmpty()) { // (4) + Map result = future.get(1000L, TimeUnit.MILLISECONDS); // (2) + if (!result.isEmpty()) { // (3) System.out.println("일부 item이 insert 실패 하였음."); - for (Entry entry : result.entrySet()) { // (5) + for (Entry entry : result.entrySet()) { // (4) System.out.print("실패한 아이템=" + bulkData.get(entry.getKey())); - System.out.println(", 실패원인=" + entry.getValue().getResponse()); // (6) + System.out.println(", 실패원인=" + entry.getValue().getResponse()); // (5) } } else { System.out.println("모두 insert 성공함."); @@ -428,20 +423,18 @@ try { } ``` -1. 한꺼번에 insert할 아이템은 client.getMaxPipedItemCount()개를 초과할 수 없다. (기본값은 500개 이다.) - 만약 개수를 초과하면 IllegalArguementException이 발생한다. -2. Key에 저장된 Set에 bulkData를 한꺼번에 insert하고 그 결과를 담은 future객체를 반환한다. +1. Key에 저장된 Set에 bulkData를 한꺼번에 insert하고 그 결과를 담은 future객체를 반환한다. 이 future로부터 각 아이템의 insert성공 실패 여부를 조회할 수 있다. 여기에서는 attributesForCreate 값을 지정하여 bulk insert하기 전에 key가 없으면 생성하고 element를 insert되도록 하였다. -3. timeout은 1초로 지정했다. +2. timeout은 1초로 지정했다. 지정한 시간에 모든 아이템의 insert 결과가 넘어 오지 않거나 JVM의 과부하로 operation queue에서 처리되지 않을 경우 TimeoutException이 발생한다. -4. 모든 아이템이 insert에 성공하면 empty map이 반환된다. +3. 모든 아이템이 insert에 성공하면 empty map이 반환된다. - 반환된 Map의 Key= insert한 값(bulkData)를 iteration했을 때의 index 값. - 반환된 Map의 Value= insert 실패사유 -5. 일부 실패한 아이템의 실패 원인을 조회하려면 insert할 때 사용된 값(bulkData)의 iteration 순서에 따라 결과 +4. 일부 실패한 아이템의 실패 원인을 조회하려면 insert할 때 사용된 값(bulkData)의 iteration 순서에 따라 결과 Map을 조회하면 된다. -6. Future로부터 얻은 Map의 Key가 입력된 값(bulkData)의 index이기 때문에 위와 같은 방법으로 실패 원인을 조회하면 된다. +5. Future로부터 얻은 Map의 Key가 입력된 값(bulkData)의 index이기 때문에 위와 같은 방법으로 실패 원인을 조회하면 된다. @@ -480,16 +473,12 @@ getValue() | Boolean | value의 존재 유무 ```java String key = "Sample:Set"; -List valueList = new ArrayList(); -valueList.add("value1"); -valueList.add("value2"); -valueList.add("value3"); -valueList.add("value4"); +List valueList = Arrays.asList("value1", "value2", "value3", "value4"); CollectionFuture future = null; try { future = client.asyncSopPipedExistBulk(key, valueList); // (1) -} catch (IllegalStateException e) { +} catch (Exception e) { // handle exception } diff --git a/docs/user-guide/06-map-API.md b/docs/user-guide/06-map-API.md index 8242e0f90..ca0ed4bc8 100644 --- a/docs/user-guide/06-map-API.md +++ b/docs/user-guide/06-map-API.md @@ -472,22 +472,15 @@ asyncMopInsertBulk(List keyList, String mkey, Object value, CollectionAt ```java String key = "Sample:MapBulk"; Map elements = new HashMap(); - elements.put("mkey1", "value1"); elements.put("mkey2", "value2"); elements.put("mkey3", "value3"); - -if (elements.size() > mc.getMaxPipedItemCount()) { // (1) - System.out.println("insert 할 아이템 개수는 mc.getMaxPipedItemCount개를 초과할 수 없다."); - return; -} - CollectionFuture> future = null; try { - future = mc.asyncMopPipedInsertBulk(key, elements, new CollectionAttributes()); // (2) + future = mc.asyncMopPipedInsertBulk(key, elements, new CollectionAttributes()); // (1) -} catch (IllegalStateException e) { +} catch (Exception e) { // handle exception } @@ -495,14 +488,13 @@ if (future == null) return; try { - Map result = future.get(1000L, TimeUnit.MILLISECONDS); // (3) - - if (!result.isEmpty()) { // (4) + Map result = future.get(1000L, TimeUnit.MILLISECONDS); // (2) + if (!result.isEmpty()) { // (3) System.out.println("일부 item이 insert 실패 하였음."); - for (Map.Entry entry : result.entrySet()) { + for (Map.Entry entry : result.entrySet()) { // (4) System.out.print("실패한 아이템=" + elements.get(entry.getKey())); - System.out.println(", 실패원인=" + entry.getValue().getResponse()); + System.out.println(", 실패원인=" + entry.getValue().getResponse()); // (5) } } else { System.out.println("모두 insert 성공함."); @@ -516,19 +508,17 @@ try { } ``` -1. 한꺼번에 insert할 아이템은 client.getMaxPipedItemCount()개를 초과할 수 없다. (기본값은 500개 이다.) - 만약 개수를 초과하면 IllegalArguementException이 발생한다. -2. Key에 저장된 map에 bulkData를 한꺼번에 insert하고 그 결과를 담은 future객체를 반환한다. +1. Key에 저장된 map에 elements를 한꺼번에 insert하고 그 결과를 담은 future객체를 반환한다. 이 future로부터 각 아이템의 insert성공 실패 여부를 조회할 수 있다. 여기에서는 attributesForCreate값을 지정하여 bulk insert하기 전에 key가 없으면 생성하고 element를 insert되도록 하였다. -3. delete timeout은 1초로 지정했다. 지정한 시간에 모든 아이템의 insert 결과가 넘어 오지 않거나 - JVM의 과부하로 operation queue에서 처리되지 않을 경우 TimeoutException이 발생한다. -4. 모든 아이템이 insert에 성공하면 empty map이 반환된다. - - 반환된 Map의 Key= insert한 값(bulkData)를 iteration했을 때의 index값. +2. timeout은 1초로 지정했다. 지정한 시간에 모든 아이템의 insert 결과가 넘어 오지 않거나 JVM의 과부하로 operation queue에서 처리되지 않을 경우 + TimeoutException이 발생한다. +3. 모든 아이템이 insert에 성공하면 empty map이 반환된다. + - 반환된 Map의 Key= insert한 값(elements)를 iteration했을 때의 index값. - 반환된 Map의 Value= insert실패사유 -5. 일부 실패한 아이템의 실패 원인을 조회하려면 insert할 때 사용된 값(bulkData)의 iteration 순서에 따라 +4. 일부 실패한 아이템의 실패 원인을 조회하려면 insert할 때 사용된 값(elements)의 iteration 순서에 따라 결과 Map을 조회하면 된다. -6. Future로부터 얻은 Map의 Key가 입력된 값(bulkData)의 mapKey이기 때문에 위와 같은 방법으로 실패 원인을 조회하면 된다. +5. Future로부터 얻은 Map의 Key가 입력된 값(elements)의 mapKey이기 때문에 위와 같은 방법으로 실패 원인을 조회하면 된다. diff --git a/docs/user-guide/07-btree-API.md b/docs/user-guide/07-btree-API.md index 8d74b5402..8c3f92fb9 100644 --- a/docs/user-guide/07-btree-API.md +++ b/docs/user-guide/07-btree-API.md @@ -1007,22 +1007,15 @@ asyncBopInsertBulk(List keyList, byte[] bkey, byte[] eFlag, Object value ```java String key = "Sample:BTreeBulk"; List> elements = new ArrayList>(); - elements.add(new Element(1L, "VALUE1", new byte[] { 1, 1 })); elements.add(new Element(2L, "VALUE2", new byte[] { 1, 1 })); elements.add(new Element(3L, "VALUE3", new byte[] { 1, 1 })); - -if (elements.size() > mc.getMaxPipedItemCount()) { // (1) - System.out.println("insert 할 아이템 개수는 mc.getMaxPipedItemCount개를 초과할 수 없다."); - return; -} - CollectionFuture> future = null; try { - future = mc.asyncBopPipedInsertBulk(key, elements, new CollectionAttributes()); // (2) + future = mc.asyncBopPipedInsertBulk(key, elements, new CollectionAttributes()); // (1) -} catch (IllegalStateException e) { +} catch (Exception e) { // handle exception } @@ -1030,14 +1023,14 @@ if (future == null) return; try { - Map result = future.get(1000L, TimeUnit.MILLISECONDS); // (3) + Map result = future.get(1000L, TimeUnit.MILLISECONDS); // (2) - if (!result.isEmpty()) { // (4) + if (!result.isEmpty()) { // (3) System.out.println("일부 item이 insert 실패 하였음."); - for (Map.Entry entry : result.entrySet()) { + for (Map.Entry entry : result.entrySet()) { // (4) System.out.print("실패한 아이템=" + elements.get(entry.getKey())); - System.out.println(", 실패원인=" + entry.getValue().getResponse()); + System.out.println(", 실패원인=" + entry.getValue().getResponse()); // (5) } } else { System.out.println("모두 insert 성공함."); @@ -1051,19 +1044,18 @@ try { } ``` -1. 한꺼번에 insert할 아이템은 client.getMaxPipedItemCount()개를 초과할 수 없다. (기본값은 500개 이다.) - 만약 개수를 초과하면 IllegalArguementException이 발생한다. -2. Key에 저장된 b+ tree에 bulkData를 한꺼번에 insert하고 그 결과를 담은 future객체를 반환한다. +1. Key에 저장된 b+tree에 elements를 한꺼번에 insert하고 그 결과를 담은 future객체를 반환한다. 이 future로부터 각 아이템의 insert성공 실패 여부를 조회할 수 있다. 여기에서는 attributesForCreate값을 지정하여 bulk insert하기 전에 key가 없으면 생성하고 element를 insert되도록 하였다. -3. delete timeout은 1초로 지정했다. 지정한 시간에 모든 아이템의 insert 결과가 넘어 오지 않거나 - JVM의 과부하로 operation queue에서 처리되지 않을 경우 TimeoutException이 발생한다. +3. timeout은 1초로 지정했다. + 지정한 시간에 모든 아이템의 insert 결과가 넘어 오지 않거나 JVM의 과부하로 operation queue에서 처리되지 않을 경우 + TimeoutException이 발생한다. 4. 모든 아이템이 insert에 성공하면 empty map이 반환된다. - - 반환된 Map의 Key= insert한 값(bulkData)를 iteration했을 때의 index값. + - 반환된 Map의 Key= insert한 값(elements)를 iteration했을 때의 index값. - 반환된 Map의 Value= insert실패사유 -5. 일부 실패한 아이템의 실패 원인을 조회하려면 insert할 때 사용된 값(bulkData)의 iteration 순서에 따라 +5. 일부 실패한 아이템의 실패 원인을 조회하려면 insert할 때 사용된 값(elements)의 iteration 순서에 따라 결과 Map을 조회하면 된다. -6. Future로부터 얻은 Map의 Key가 입력된 값(bulkData)의 index이기 때문에 위와 같은 방법으로 실패 원인을 조회하면 된다. +6. Future로부터 얻은 Map의 Key가 입력된 값(elements)의 index이기 때문에 위와 같은 방법으로 실패 원인을 조회하면 된다.