Skip to content

Commit

Permalink
MAP_COLLECTION: refactor map collection, remove MapElement...
Browse files Browse the repository at this point in the history
  • Loading branch information
MinWooJin committed Oct 7, 2016
1 parent 936ddf6 commit 5b4864b
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 482 deletions.
12 changes: 5 additions & 7 deletions docs/07-map-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Map을 Java의 Map 자료형을 저장하는 용도로 사용하길 권장한다
**제약 조건**
- 저장 가능한 최대 element 개수 : 디폴트 4,000개 (attribute 설정으로 최대 50,000개 확장 가능)
- 각 element에서 value 최대 크기 : 4KB
- mkey의 입력, Java map type에서 key는 string type만 가능하다. mkey 최대 길이는 key의 최대 길이와 같고, 하나의 map 내에서 mkey간의 중복은 허용하지 않는다.
- mkey의 입력, Java map type에서 key는 string type만 가능하다. mkey 최대 길이는 250 바이트 이고, 하나의 map에 중복된 mkey는 허용하지 않는다.

Map item에 대해 수행가능한 기본 연산은 다음과 같다.

Expand Down Expand Up @@ -269,14 +269,14 @@ Map element를 조회하는 함수는 세 유형이 있다.

```java
CollectionFuture<Map<String, Object>>
asyncMopGet(String key, boolean withDelete, Boolean dropIfEmpty)
asyncMopGet(String key, boolean withDelete, boolean dropIfEmpty)
```

둘째, 해당 Map에서 주어진 mkey 하나의 element를 조회한다.

```java
CollectionFuture<Map<String, Object>>
asyncMopGet(String key, String mkey, boolean withDelete, Boolean dropIfEmpty)
asyncMopGet(String key, String mkey, boolean withDelete, boolean dropIfEmpty)
```

셋째, Map에서 주어진 mkeyList의 element를 조회한다.
Expand Down Expand Up @@ -364,8 +364,6 @@ Map에 여러 element를 한번에 삽입하는 함수는 두 유형이 있다.
```java
CollectionFuture<Map<Integer, CollectionOperationStatus>>
asyncMopPipedInsertBulk(String key, Map<String, Object> elements, CollectionAttributes attributesForCreate)
CollectionFuture<Map<Integer, CollectionOperationStatus>>
asyncMopPipedInsertBulk(String key, List<MapElement<Object> elements, CollectionAttributes attributesForCreate)
```

- key: 삽입 대상 map의 key
Expand Down Expand Up @@ -463,7 +461,7 @@ Map에서 주어진 elements에 해당하는 모든 element의 value를 일괄

```java
CollectionFuture<Map<Integer, CollectionOperationStatus>>
asyncMopPipedUpdateBulk(String key, List<MapElement<Object>> mapElements)
asyncMopPipedUpdateBulk(String key, Map<String, Object>> elements)
```
- key: 변경 대상 map의 key
- mapElements: 변경 대상 map에 대해 mkey, new value를 가진다.
- elements: 변경 대상 map에 대해 mkey, new value를 가진다.
28 changes: 0 additions & 28 deletions install-arcus-memcached.sh

This file was deleted.

59 changes: 8 additions & 51 deletions src/main/java/net/spy/memcached/ArcusClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
import net.spy.memcached.collection.MapGet;
import net.spy.memcached.collection.MapStore;
import net.spy.memcached.collection.MapUpdate;
import net.spy.memcached.collection.MapElement;
import net.spy.memcached.collection.SetCreate;
import net.spy.memcached.collection.SetDelete;
import net.spy.memcached.collection.SetExist;
Expand Down Expand Up @@ -3039,25 +3038,25 @@ public <T> CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncBopPip
* (non-Javadoc)
*
* @see net.spy.memcached.ArcusClientIF#asyncMopUpdate(java.lang.String,
* net.spy.memcached.collection.MapElement, net.spy.memcached.transcoders.Transcoder)
* java.util.Map, net.spy.memcached.transcoders.Transcoder)
*/
@Override
public CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncMopPipedUpdateBulk(
String key, List<MapElement<Object>> mapElements) {
return asyncMopPipedUpdateBulk(key, mapElements, collectionTranscoder);
String key, Map<String, Object> elements) {
return asyncMopPipedUpdateBulk(key, elements, collectionTranscoder);
}

@Override
public <T> CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncMopPipedUpdateBulk(
String key, List<MapElement<T>> mapElements, Transcoder<T> tc) {
String key, Map<String, T> elements, Transcoder<T> tc) {

if (mapElements.size() <= CollectionPipedUpdate.MAX_PIPED_ITEM_COUNT) {
if (elements.size() <= CollectionPipedUpdate.MAX_PIPED_ITEM_COUNT) {
CollectionPipedUpdate<T> collectionPipedUpdate = new MapPipedUpdate<T>(
key, mapElements, tc);
key, elements, tc);
return asyncCollectionPipedUpdate(key, collectionPipedUpdate);
} else {
PartitionedList<MapElement<T>> list = new PartitionedList<MapElement<T>>(
mapElements, CollectionPipedUpdate.MAX_PIPED_ITEM_COUNT);
PartitionedMap<String, T> list = new PartitionedMap<String, T>(
elements, CollectionPipedUpdate.MAX_PIPED_ITEM_COUNT);

List<CollectionPipedUpdate<T>> collectionPipedUpdateList = new ArrayList<CollectionPipedUpdate<T>>(
list.size());
Expand Down Expand Up @@ -3928,48 +3927,6 @@ public void gotStatus(Integer index, OperationStatus status) {
return rv;
}

/*
* (non-Javadoc)
* @see net.spy.memcached.ArcusClientIF#asyncMopPipedInsertBulk(java.lang.String, java.util.List, boolean, net.spy.memcached.collection.CollectionAttributes)
*/
@Override
public CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncMopPipedInsertBulk(
String key, List<MapElement<Object>> mapElements,
CollectionAttributes attributesForCreate) {
return asyncMopPipedInsertBulk(key, mapElements, attributesForCreate,
collectionTranscoder);
}

/*
* (non-Javadoc)
* @see net.spy.memcached.ArcusClientIF#asyncMopPipedInsertBulk(java.lang.String, java.util.List, boolean, net.spy.memcached.collection.CollectionAttributes, net.spy.memcached.transcoders.Transcoder)
*/
@Override
public <T> CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncMopPipedInsertBulk(
String key, List<MapElement<T>> mapElements,
CollectionAttributes attributesForCreate, Transcoder<T> tc) {
if (mapElements.size() <= CollectionPipedStore.MAX_PIPED_ITEM_COUNT) {
CollectionPipedStore<T> store = new CollectionPipedStore.MapElementsPipedStore<T>(
key, mapElements, (attributesForCreate != null),
attributesForCreate, tc);
return asyncCollectionPipedStore(key, store);
} else {
PartitionedList<MapElement<T>> list = new PartitionedList<MapElement<T>>(
mapElements, CollectionPipedStore.MAX_PIPED_ITEM_COUNT);

List<CollectionPipedStore<T>> storeList = new ArrayList<CollectionPipedStore<T>>(
list.size());

for (int i = 0; i < list.size(); i++) {
storeList.add(new CollectionPipedStore.MapElementsPipedStore<T>(key,
list.get(i), (attributesForCreate != null),
attributesForCreate, tc));
}

return asyncCollectionPipedStore(key, storeList);
}
}

/*
* (non-Javadoc)
* @see net.spy.memcached.ArcusClientIF#asyncBopPipedInsertBulk(java.lang.String, java.util.List, boolean, net.spy.memcached.collection.CollectionAttributes)
Expand Down
Loading

0 comments on commit 5b4864b

Please sign in to comment.