|
92 | 92 | import net.spy.memcached.collection.CollectionPipedUpdate;
|
93 | 93 | import net.spy.memcached.collection.CollectionPipedUpdate.BTreePipedUpdate;
|
94 | 94 | import net.spy.memcached.collection.CollectionPipedUpdate.MapPipedUpdate;
|
| 95 | +import net.spy.memcached.collection.CollectionPipedUpsert; |
| 96 | +import net.spy.memcached.collection.CollectionPipedUpsert.BTreePipedUpsert; |
| 97 | +import net.spy.memcached.collection.CollectionPipedUpsert.ByteArrayBTreePipedUpsert; |
95 | 98 | import net.spy.memcached.collection.CollectionResponse;
|
96 | 99 | import net.spy.memcached.collection.CollectionUpdate;
|
97 | 100 | import net.spy.memcached.collection.Element;
|
@@ -2734,6 +2737,64 @@ public void complete() {
|
2734 | 2737 | return rv;
|
2735 | 2738 | }
|
2736 | 2739 |
|
| 2740 | + @Override |
| 2741 | + public CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncBopPipedUpsertBulk( |
| 2742 | + String key, Map<Long, Object> elements, |
| 2743 | + CollectionAttributes attributesForCreate) { |
| 2744 | + return asyncBopPipedUpsertBulk(key, elements, attributesForCreate, collectionTranscoder); |
| 2745 | + } |
| 2746 | + |
| 2747 | + @Override |
| 2748 | + public CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncBopPipedUpsertBulk( |
| 2749 | + String key, List<Element<Object>> elements, CollectionAttributes collectionAttributes) { |
| 2750 | + return asyncBopPipedUpsertBulk(key, elements, collectionAttributes, collectionTranscoder); |
| 2751 | + } |
| 2752 | + |
| 2753 | + @Override |
| 2754 | + public <T> CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncBopPipedUpsertBulk( |
| 2755 | + String key, Map<Long, T> elements, CollectionAttributes attributesForCreate, Transcoder<T> tc) { |
| 2756 | + |
| 2757 | + if (elements.isEmpty()) { |
| 2758 | + throw new IllegalArgumentException("The number of piped operations must be larger than 0."); |
| 2759 | + } |
| 2760 | + |
| 2761 | + List<CollectionPipedInsert<T>> upsertList = new ArrayList<CollectionPipedInsert<T>>(); |
| 2762 | + |
| 2763 | + if (elements.size() <= CollectionPipedUpsert.MAX_PIPED_ITEM_COUNT) { |
| 2764 | + upsertList.add(new BTreePipedUpsert<T>(key, elements, attributesForCreate, tc)); |
| 2765 | + } else { |
| 2766 | + PartitionedMap<Long, T> list = new PartitionedMap<Long, T>( |
| 2767 | + elements, CollectionPipedUpsert.MAX_PIPED_ITEM_COUNT); |
| 2768 | + for (Map<Long, T> elementMap : list) { |
| 2769 | + upsertList.add(new BTreePipedUpsert<T>(key, elementMap, attributesForCreate, tc)); |
| 2770 | + } |
| 2771 | + } |
| 2772 | + return asyncCollectionPipedInsert(key, upsertList); |
| 2773 | + } |
| 2774 | + |
| 2775 | + @Override |
| 2776 | + public <T> CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncBopPipedUpsertBulk( |
| 2777 | + String key, List<Element<T>> elements, CollectionAttributes attributesForCreate, Transcoder<T> tc) { |
| 2778 | + |
| 2779 | + if (elements.isEmpty()) { |
| 2780 | + throw new IllegalArgumentException("The number of piped operations must be larger than 0."); |
| 2781 | + } |
| 2782 | + |
| 2783 | + List<CollectionPipedInsert<T>> upsertList = new ArrayList<CollectionPipedInsert<T>>(); |
| 2784 | + |
| 2785 | + |
| 2786 | + if (elements.size() <= CollectionPipedUpsert.MAX_PIPED_ITEM_COUNT) { |
| 2787 | + upsertList.add(new ByteArrayBTreePipedUpsert<T>(key, elements, attributesForCreate, tc)); |
| 2788 | + } else { |
| 2789 | + PartitionedList<Element<T>> list = new PartitionedList<Element<T>>( |
| 2790 | + elements, CollectionPipedInsert.MAX_PIPED_ITEM_COUNT); |
| 2791 | + for (List<Element<T>> elementList : list) { |
| 2792 | + upsertList.add(new ByteArrayBTreePipedUpsert<T>(key, elementList, attributesForCreate, tc)); |
| 2793 | + } |
| 2794 | + } |
| 2795 | + return asyncCollectionPipedInsert(key, upsertList); |
| 2796 | + } |
| 2797 | + |
2737 | 2798 | @Override
|
2738 | 2799 | public CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncBopPipedUpdateBulk(
|
2739 | 2800 | String key, List<Element<Object>> elements) {
|
|
0 commit comments