|
91 | 91 | import net.spy.memcached.collection.CollectionPipedUpdate;
|
92 | 92 | import net.spy.memcached.collection.CollectionPipedUpdate.BTreePipedUpdate;
|
93 | 93 | import net.spy.memcached.collection.CollectionPipedUpdate.MapPipedUpdate;
|
| 94 | +import net.spy.memcached.collection.CollectionPipedUpsert; |
| 95 | +import net.spy.memcached.collection.CollectionPipedUpsert.BTreePipedUpsert; |
| 96 | +import net.spy.memcached.collection.CollectionPipedUpsert.ByteArrayBTreePipedUpsert; |
94 | 97 | import net.spy.memcached.collection.CollectionResponse;
|
95 | 98 | import net.spy.memcached.collection.CollectionUpdate;
|
96 | 99 | import net.spy.memcached.collection.Element;
|
@@ -2707,6 +2710,64 @@ public void complete() {
|
2707 | 2710 | return rv;
|
2708 | 2711 | }
|
2709 | 2712 |
|
| 2713 | + @Override |
| 2714 | + public CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncBopPipedUpsertBulk( |
| 2715 | + String key, Map<Long, Object> elements, |
| 2716 | + CollectionAttributes attributesForCreate) { |
| 2717 | + return asyncBopPipedUpsertBulk(key, elements, attributesForCreate, collectionTranscoder); |
| 2718 | + } |
| 2719 | + |
| 2720 | + @Override |
| 2721 | + public CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncBopPipedUpsertBulk( |
| 2722 | + String key, List<Element<Object>> elements, CollectionAttributes collectionAttributes) { |
| 2723 | + return asyncBopPipedUpsertBulk(key, elements, collectionAttributes, collectionTranscoder); |
| 2724 | + } |
| 2725 | + |
| 2726 | + @Override |
| 2727 | + public <T> CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncBopPipedUpsertBulk( |
| 2728 | + String key, Map<Long, T> elements, CollectionAttributes attributesForCreate, Transcoder<T> tc) { |
| 2729 | + |
| 2730 | + if (elements.isEmpty()) { |
| 2731 | + throw new IllegalArgumentException("The number of piped operations must be larger than 0."); |
| 2732 | + } |
| 2733 | + |
| 2734 | + List<CollectionPipedInsert<T>> upsertList = new ArrayList<CollectionPipedInsert<T>>(); |
| 2735 | + |
| 2736 | + if (elements.size() <= CollectionPipedUpsert.MAX_PIPED_ITEM_COUNT) { |
| 2737 | + upsertList.add(new BTreePipedUpsert<T>(key, elements, attributesForCreate, tc)); |
| 2738 | + } else { |
| 2739 | + PartitionedMap<Long, T> list = new PartitionedMap<Long, T>( |
| 2740 | + elements, CollectionPipedUpsert.MAX_PIPED_ITEM_COUNT); |
| 2741 | + for (Map<Long, T> elementMap : list) { |
| 2742 | + upsertList.add(new BTreePipedUpsert<T>(key, elementMap, attributesForCreate, tc)); |
| 2743 | + } |
| 2744 | + } |
| 2745 | + return asyncCollectionPipedInsert(key, upsertList); |
| 2746 | + } |
| 2747 | + |
| 2748 | + @Override |
| 2749 | + public <T> CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncBopPipedUpsertBulk( |
| 2750 | + String key, List<Element<T>> elements, CollectionAttributes attributesForCreate, Transcoder<T> tc) { |
| 2751 | + |
| 2752 | + if (elements.isEmpty()) { |
| 2753 | + throw new IllegalArgumentException("The number of piped operations must be larger than 0."); |
| 2754 | + } |
| 2755 | + |
| 2756 | + List<CollectionPipedInsert<T>> upsertList = new ArrayList<CollectionPipedInsert<T>>(); |
| 2757 | + |
| 2758 | + |
| 2759 | + if (elements.size() <= CollectionPipedUpsert.MAX_PIPED_ITEM_COUNT) { |
| 2760 | + upsertList.add(new ByteArrayBTreePipedUpsert<T>(key, elements, attributesForCreate, tc)); |
| 2761 | + } else { |
| 2762 | + PartitionedList<Element<T>> list = new PartitionedList<Element<T>>( |
| 2763 | + elements, CollectionPipedInsert.MAX_PIPED_ITEM_COUNT); |
| 2764 | + for (List<Element<T>> elementList : list) { |
| 2765 | + upsertList.add(new ByteArrayBTreePipedUpsert<T>(key, elementList, attributesForCreate, tc)); |
| 2766 | + } |
| 2767 | + } |
| 2768 | + return asyncCollectionPipedInsert(key, upsertList); |
| 2769 | + } |
| 2770 | + |
2710 | 2771 | @Override
|
2711 | 2772 | public CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncBopPipedUpdateBulk(
|
2712 | 2773 | String key, List<Element<Object>> elements) {
|
|
0 commit comments