diff --git a/src/main/java/net/spy/memcached/ArcusClient.java b/src/main/java/net/spy/memcached/ArcusClient.java index 89ee5cea0..4a2b4df17 100644 --- a/src/main/java/net/spy/memcached/ArcusClient.java +++ b/src/main/java/net/spy/memcached/ArcusClient.java @@ -655,7 +655,7 @@ public void complete() { latch.countDown(); } - public void gotData(String subkey, int flags, byte[] data, byte[] eflag) { + public void gotData(String elementKey, int flags, byte[] data, byte[] eflag) { cachedDataList.add(new CachedData(flags, data, tc.getMaxSize())); } }); @@ -711,7 +711,7 @@ public void complete() { latch.countDown(); } - public void gotData(String subkey, int flags, byte[] data, byte[] eflag) { + public void gotData(String elementKey, int flags, byte[] data, byte[] eflag) { cachedDataSet.add(new CachedData(flags, data, tc.getMaxSize())); } }); @@ -814,18 +814,18 @@ public void gotData(String mkey, int flags, byte[] data, byte[] eflag) { * Public methods for collection items call this method. * * @param key collection item's key - * @param subkey element key (list index, b+tree bkey) + * @param elementKey element key (list index, b+tree bkey) * @param collectionInsert operation parameters (value, eflags, attributes, and so on) * @param tc transcoder to serialize and unserialize value * @return future holding the success/failure of the operation */ private CollectionFuture asyncCollectionInsert(String key, - String subkey, + String elementKey, CollectionInsert collectionInsert, Transcoder tc) { CachedData co = tc.encode(collectionInsert.getValue()); collectionInsert.setFlags(co.getFlags()); - return asyncCollectionInsert(key, subkey, collectionInsert, co); + return asyncCollectionInsert(key, elementKey, collectionInsert, co); } /** @@ -833,30 +833,30 @@ private CollectionFuture asyncCollectionInsert(String key, * Public methods for collection items call this method. * * @param key collection item's key - * @param subkey element key (list index, b+tree bkey) + * @param elementKey element key (list index, b+tree bkey) * @param collectionInsert operation parameters (value, eflags, attributes, and so on) * @param co transcoded value * @return future holding the success/failure of the operation */ CollectionFuture asyncCollectionInsert(final String key, - final String subkey, + final String elementKey, final CollectionInsert collectionInsert, final CachedData co) { final CountDownLatch latch = new CountDownLatch(1); final CollectionFuture rv = new CollectionFuture<>( latch, operationTimeout); - Operation op = opFact.collectionInsert(key, subkey, collectionInsert, + Operation op = opFact.collectionInsert(key, elementKey, collectionInsert, co.getData(), new OperationCallback() { public void receivedStatus(OperationStatus status) { CollectionOperationStatus cstatus = toCollectionOperationStatus(status); rv.set(cstatus.isSuccess(), cstatus); if (!cstatus.isSuccess()) { getLogger().debug( - "Insertion to the collection failed : %s (type=%s, key=%s, subkey=%s, value=%s)", + "Insertion to the collection failed : %s (type=%s, key=%s, elementKey=%s, value=%s)", cstatus.getMessage(), collectionInsert.getClass().getName(), key, - subkey, + elementKey, collectionInsert.getValue()); } } @@ -910,27 +910,27 @@ public void complete() { * Public methods for collection items call this method. * * @param key collection item's key - * @param subkey element key (list index, b+tree bkey) + * @param elementKey element key (list index, b+tree bkey) * @param collectionExist operation parameters (element value and so on) * @return future holding the success/failure of the operation */ - private CollectionFuture asyncCollectionExist(final String key, final String subkey, + private CollectionFuture asyncCollectionExist(final String key, final String elementKey, final CollectionExist collectionExist) { final CountDownLatch latch = new CountDownLatch(1); final CollectionFuture rv = new CollectionFuture<>( latch, operationTimeout); - Operation op = opFact.collectionExist(key, subkey, collectionExist, + Operation op = opFact.collectionExist(key, elementKey, collectionExist, new OperationCallback() { public void receivedStatus(OperationStatus status) { CollectionOperationStatus cstatus = toCollectionOperationStatus(status); boolean isExist = CollectionResponse.EXIST == cstatus.getResponse(); rv.set(isExist, cstatus); if (!cstatus.isSuccess()) { - getLogger().debug("Exist command to the collection failed : %s (type=%s, key=%s, subkey=%s)", + getLogger().debug("Exist command to the collection failed : %s (type=%s, key=%s, elementKey=%s)", cstatus.getMessage(), collectionExist.getClass().getName(), key, - subkey); + elementKey); } } @@ -1986,13 +1986,13 @@ public CollectionFuture asyncMopUpdate(String key, String mkey, * Public methods for collection items call this method. * * @param key collection item's key - * @param subkey element key (list index, b+tree bkey) + * @param elementKey element key (list index, b+tree bkey) * @param collectionUpdate operation parameters (element value and so on) * @param tc transcoder to serialize and unserialize value * @return future holding the success/failure of the operation */ private CollectionFuture asyncCollectionUpdate( - final String key, final String subkey, + final String key, final String elementKey, final CollectionUpdate collectionUpdate, Transcoder tc) { CachedData co = null; @@ -2005,18 +2005,18 @@ private CollectionFuture asyncCollectionUpdate( final CollectionFuture rv = new CollectionFuture<>( latch, operationTimeout); - Operation op = opFact.collectionUpdate(key, subkey, collectionUpdate, + Operation op = opFact.collectionUpdate(key, elementKey, collectionUpdate, ((co == null) ? null : co.getData()), new OperationCallback() { public void receivedStatus(OperationStatus status) { CollectionOperationStatus cstatus = toCollectionOperationStatus(status); rv.set(cstatus.isSuccess(), cstatus); if (!cstatus.isSuccess()) { getLogger().debug( - "Insertion to the collection failed : %s (type=%s, key=%s, subkey=%s, value=%s)", + "Insertion to the collection failed : %s (type=%s, key=%s, elementKey=%s, value=%s)", cstatus.getMessage(), collectionUpdate.getClass().getName(), key, - subkey, + elementKey, collectionUpdate.getNewValue()); } } @@ -3233,18 +3233,18 @@ public CollectionFuture asyncBopDecr(String key, byte[] bkey, * Generic increment/decrement operation for b+tree items. Public methods call this method. * * @param k b+tree item's key - * @param subkey element key + * @param elementKey element key * @param collectionMutate operation parameters (increment amount and so on) * @return future holding the incremented or decremented value */ - private CollectionFuture asyncCollectionMutate(final String k, final String subkey, + private CollectionFuture asyncCollectionMutate(final String k, final String elementKey, final CollectionMutate collectionMutate) { final CountDownLatch latch = new CountDownLatch(1); final CollectionFuture rv = new CollectionFuture<>(latch, operationTimeout); - Operation op = opFact.collectionMutate(k, subkey, collectionMutate, + Operation op = opFact.collectionMutate(k, elementKey, collectionMutate, new OperationCallback() { @Override @@ -3256,14 +3256,14 @@ public void receivedStatus(OperationStatus status) { } catch (NumberFormatException e) { rv.set(null, new CollectionOperationStatus(false, status.getMessage(), CollectionResponse.EXCEPTION)); - getLogger().debug("Key(%s), Bkey(%s) Unknown response : %s", k, subkey, status); + getLogger().debug("Key(%s), Bkey(%s) Unknown response : %s", k, elementKey, status); } return; } rv.set(null, new CollectionOperationStatus(status)); - getLogger().debug("Key(%s), Bkey(%s) Unknown response : %s", k, subkey, status); + getLogger().debug("Key(%s), Bkey(%s) Unknown response : %s", k, elementKey, status); } @Override diff --git a/src/main/java/net/spy/memcached/OperationFactory.java b/src/main/java/net/spy/memcached/OperationFactory.java index 7a64b6cb3..ec9b4583d 100644 --- a/src/main/java/net/spy/memcached/OperationFactory.java +++ b/src/main/java/net/spy/memcached/OperationFactory.java @@ -289,13 +289,13 @@ CASOperation cas(StoreType t, String key, long casId, int flags, * Insert operation for collection items. * * @param key collection item's key - * @param subkey element key (list index, b+tree bkey) + * @param elementKey element key (list index, b+tree bkey) * @param collectionInsert operation parameters (value, eflags, attributes, and so on) * @param data the serialized value * @param cb the status callback * @return a new CollectionInsertOperation */ - CollectionInsertOperation collectionInsert(String key, String subkey, + CollectionInsertOperation collectionInsert(String key, String elementKey, CollectionInsert collectionInsert, byte[] data, OperationCallback cb); @@ -339,12 +339,12 @@ CollectionDeleteOperation collectionDelete(String key, * Existence operation for collection items. * * @param key collection item's key - * @param subkey element key (list index, b+tree bkey) + * @param elementKey element key (list index, b+tree bkey) * @param collectionExist operation parameters (element value and so on) * @param cb the callback that will contain the results * @return a new CollectionExistOperation */ - CollectionExistOperation collectionExist(String key, String subkey, + CollectionExistOperation collectionExist(String key, String elementKey, CollectionExist collectionExist, OperationCallback cb); /** @@ -421,13 +421,13 @@ CollectionCountOperation collectionCount(String key, * Update operation for collection items. * * @param key collection item's key - * @param subkey element key (list index, b+tree bkey) + * @param elementKey element key (list index, b+tree bkey) * @param collectionUpdate (element value and so on) * @param data the serialized value * @param cb the status callback * @return a new CollectionUpdateOperation */ - CollectionUpdateOperation collectionUpdate(String key, String subkey, + CollectionUpdateOperation collectionUpdate(String key, String elementKey, CollectionUpdate collectionUpdate, byte[] data, OperationCallback cb); @@ -447,12 +447,12 @@ CollectionPipedUpdateOperation collectionPipedUpdate(String key, * Increment/Decrement operation for collection items (b+tree items). * * @param key b+tree item's key - * @param subkey element key + * @param elementKey element key (b+tree bkey) * @param collectionMutate operation parameters (increment/decrement amount and so on) * @param cb the callback that will contain the incremented/decremented result * @return a new CollectionMutateOperation */ - CollectionMutateOperation collectionMutate(String key, String subkey, + CollectionMutateOperation collectionMutate(String key, String elementKey, CollectionMutate collectionMutate, OperationCallback cb); diff --git a/src/main/java/net/spy/memcached/collection/BTreeFindPositionWithGet.java b/src/main/java/net/spy/memcached/collection/BTreeFindPositionWithGet.java index ca7ba5baa..735cf67c5 100644 --- a/src/main/java/net/spy/memcached/collection/BTreeFindPositionWithGet.java +++ b/src/main/java/net/spy/memcached/collection/BTreeFindPositionWithGet.java @@ -106,11 +106,11 @@ public byte[] getAdditionalArgs() { */ @Override public void decodeElemHeader(List tokens) { - subkey = tokens.get(0); - if (subkey.startsWith("0x")) { - bkey = new BKeyObject(BTreeUtil.hexStringToByteArrays(subkey.substring(2))); + elementKey = tokens.get(0); + if (elementKey.startsWith("0x")) { + bkey = new BKeyObject(BTreeUtil.hexStringToByteArrays(elementKey.substring(2))); } else { - bkey = new BKeyObject(Long.parseLong(subkey)); + bkey = new BKeyObject(Long.parseLong(elementKey)); } if (tokens.size() == 2) { dataLength = Integer.parseInt(tokens.get(1)); diff --git a/src/main/java/net/spy/memcached/collection/BTreeGet.java b/src/main/java/net/spy/memcached/collection/BTreeGet.java index 8729d8cad..2b643ad98 100644 --- a/src/main/java/net/spy/memcached/collection/BTreeGet.java +++ b/src/main/java/net/spy/memcached/collection/BTreeGet.java @@ -114,7 +114,7 @@ public byte[] getAdditionalArgs() { @Override public void decodeElemHeader(List tokens) { - subkey = tokens.get(0); + elementKey = tokens.get(0); if (tokens.size() == 2) { dataLength = Integer.parseInt(tokens.get(1)); } else { diff --git a/src/main/java/net/spy/memcached/collection/BTreeGetByPosition.java b/src/main/java/net/spy/memcached/collection/BTreeGetByPosition.java index 02373c70a..e75577338 100644 --- a/src/main/java/net/spy/memcached/collection/BTreeGetByPosition.java +++ b/src/main/java/net/spy/memcached/collection/BTreeGetByPosition.java @@ -99,11 +99,11 @@ public byte[] getAdditionalArgs() { */ @Override public void decodeElemHeader(List tokens) { - subkey = tokens.get(0); - if (subkey.startsWith("0x")) { - bkey = new BKeyObject(BTreeUtil.hexStringToByteArrays(subkey.substring(2))); + elementKey = tokens.get(0); + if (elementKey.startsWith("0x")) { + bkey = new BKeyObject(BTreeUtil.hexStringToByteArrays(elementKey.substring(2))); } else { - bkey = new BKeyObject(Long.parseLong(subkey)); + bkey = new BKeyObject(Long.parseLong(elementKey)); } if (tokens.size() == 2) { dataLength = Integer.parseInt(tokens.get(1)); diff --git a/src/main/java/net/spy/memcached/collection/BTreeInsertAndGet.java b/src/main/java/net/spy/memcached/collection/BTreeInsertAndGet.java index 40cc5dafe..c69de142a 100644 --- a/src/main/java/net/spy/memcached/collection/BTreeInsertAndGet.java +++ b/src/main/java/net/spy/memcached/collection/BTreeInsertAndGet.java @@ -68,11 +68,11 @@ private BTreeInsertAndGet(BKeyObject bKey, byte[] eFlag, T value, boolean update @Override public void decodeElemHeader(List tokens) { - subkey = tokens.get(0); - if (subkey.startsWith("0x")) { - bKey = new BKeyObject(BTreeUtil.hexStringToByteArrays(subkey.substring(2))); + elementKey = tokens.get(0); + if (elementKey.startsWith("0x")) { + bKey = new BKeyObject(BTreeUtil.hexStringToByteArrays(elementKey.substring(2))); } else { - bKey = new BKeyObject(Long.parseLong(subkey)); + bKey = new BKeyObject(Long.parseLong(elementKey)); } if (tokens.size() == 2) { dataLength = Integer.parseInt(tokens.get(1)); diff --git a/src/main/java/net/spy/memcached/collection/CollectionGet.java b/src/main/java/net/spy/memcached/collection/CollectionGet.java index 6680d63d4..b93553d89 100644 --- a/src/main/java/net/spy/memcached/collection/CollectionGet.java +++ b/src/main/java/net/spy/memcached/collection/CollectionGet.java @@ -25,7 +25,7 @@ public abstract class CollectionGet { protected String range; protected String str; - protected String subkey; + protected String elementKey; protected int dataLength; protected byte[] elementFlag; @@ -40,8 +40,8 @@ public boolean isDropIfEmpty() { return dropIfEmpty; } - public String getSubkey() { - return subkey; + public String getElementKey() { + return elementKey; } public int getDataLength() { diff --git a/src/main/java/net/spy/memcached/collection/MapGet.java b/src/main/java/net/spy/memcached/collection/MapGet.java index e8c7a954e..7c89b2812 100644 --- a/src/main/java/net/spy/memcached/collection/MapGet.java +++ b/src/main/java/net/spy/memcached/collection/MapGet.java @@ -98,7 +98,7 @@ public String getCommand() { @Override public void decodeElemHeader(List tokens) { - this.subkey = tokens.get(0); + this.elementKey = tokens.get(0); this.dataLength = Integer.parseInt(tokens.get(1)); } } diff --git a/src/main/java/net/spy/memcached/ops/BaseOperationFactory.java b/src/main/java/net/spy/memcached/ops/BaseOperationFactory.java index 3fc20215f..5cf494e74 100644 --- a/src/main/java/net/spy/memcached/ops/BaseOperationFactory.java +++ b/src/main/java/net/spy/memcached/ops/BaseOperationFactory.java @@ -93,7 +93,7 @@ public Collection clone(KeyedOperation op) { (GetAttrOperation.Callback) c.getCallback())); } else if (op instanceof CollectionInsertOperation) { CollectionInsertOperation c = (CollectionInsertOperation) op; - rv.add(collectionInsert(first(c.getKeys()), c.getSubKey(), + rv.add(collectionInsert(first(c.getKeys()), c.getElementKey(), c.getInsert(), c.getData(), c.getCallback())); } else if (op instanceof CollectionGetOperation) { CollectionGetOperation c = (CollectionGetOperation) op; @@ -105,7 +105,7 @@ public Collection clone(KeyedOperation op) { c.getCallback())); } else if (op instanceof CollectionExistOperation) { CollectionExistOperation c = (CollectionExistOperation) op; - rv.add(collectionExist(first(c.getKeys()), c.getSubKey(), + rv.add(collectionExist(first(c.getKeys()), c.getElementKey(), c.getExist(), c.getCallback())); } else { assert false : "Unhandled operation type: " + op.getClass(); diff --git a/src/main/java/net/spy/memcached/ops/CollectionExistOperation.java b/src/main/java/net/spy/memcached/ops/CollectionExistOperation.java index 1242b73e9..27c7ac7df 100644 --- a/src/main/java/net/spy/memcached/ops/CollectionExistOperation.java +++ b/src/main/java/net/spy/memcached/ops/CollectionExistOperation.java @@ -23,7 +23,7 @@ */ public interface CollectionExistOperation extends KeyedOperation { - String getSubKey(); + String getElementKey(); CollectionExist getExist(); diff --git a/src/main/java/net/spy/memcached/ops/CollectionGetOperation.java b/src/main/java/net/spy/memcached/ops/CollectionGetOperation.java index f61706da3..c05ad54e0 100644 --- a/src/main/java/net/spy/memcached/ops/CollectionGetOperation.java +++ b/src/main/java/net/spy/memcached/ops/CollectionGetOperation.java @@ -26,6 +26,6 @@ public interface CollectionGetOperation extends KeyedOperation { CollectionGet getGet(); interface Callback extends OperationCallback { - void gotData(String subkey, int flags, byte[] data, byte[] eflag); + void gotData(String elementKey, int flags, byte[] data, byte[] eflag); } } diff --git a/src/main/java/net/spy/memcached/ops/CollectionInsertOperation.java b/src/main/java/net/spy/memcached/ops/CollectionInsertOperation.java index 7abb1d05b..6794c7584 100644 --- a/src/main/java/net/spy/memcached/ops/CollectionInsertOperation.java +++ b/src/main/java/net/spy/memcached/ops/CollectionInsertOperation.java @@ -23,7 +23,7 @@ */ public interface CollectionInsertOperation extends KeyedOperation { - String getSubKey(); + String getElementKey(); CollectionInsert getInsert(); diff --git a/src/main/java/net/spy/memcached/ops/CollectionUpdateOperation.java b/src/main/java/net/spy/memcached/ops/CollectionUpdateOperation.java index b7bc0e700..d33d814cc 100644 --- a/src/main/java/net/spy/memcached/ops/CollectionUpdateOperation.java +++ b/src/main/java/net/spy/memcached/ops/CollectionUpdateOperation.java @@ -23,7 +23,7 @@ */ public interface CollectionUpdateOperation extends KeyedOperation { - String getSubKey(); + String getElementKey(); CollectionUpdate getUpdate(); diff --git a/src/main/java/net/spy/memcached/protocol/ascii/AsciiOperationFactory.java b/src/main/java/net/spy/memcached/protocol/ascii/AsciiOperationFactory.java index 5ea9e226b..71afc961f 100644 --- a/src/main/java/net/spy/memcached/protocol/ascii/AsciiOperationFactory.java +++ b/src/main/java/net/spy/memcached/protocol/ascii/AsciiOperationFactory.java @@ -196,10 +196,10 @@ public GetAttrOperation getAttr(String key, GetAttrOperation.Callback cb) { } @Override - public CollectionInsertOperation collectionInsert(String key, String subkey, + public CollectionInsertOperation collectionInsert(String key, String elementKey, CollectionInsert collectionInsert, byte[] data, OperationCallback cb) { - return new CollectionInsertOperationImpl(key, subkey, + return new CollectionInsertOperationImpl(key, elementKey, collectionInsert, data, cb); } @@ -225,10 +225,10 @@ public CollectionDeleteOperation collectionDelete(String key, } @Override - public CollectionExistOperation collectionExist(String key, String subkey, + public CollectionExistOperation collectionExist(String key, String elementKey, CollectionExist collectionExist, OperationCallback cb) { - return new CollectionExistOperationImpl(key, subkey, collectionExist, cb); + return new CollectionExistOperationImpl(key, elementKey, collectionExist, cb); } @Override @@ -258,11 +258,11 @@ public BTreeSortMergeGetOperation bopsmget(BTreeSMGet smGet, @Override public CollectionUpdateOperation collectionUpdate(String key, - String subkey, + String elementKey, CollectionUpdate collectionUpdate, byte[] data, OperationCallback cb) { - return new CollectionUpdateOperationImpl(key, subkey, collectionUpdate, + return new CollectionUpdateOperationImpl(key, elementKey, collectionUpdate, data, cb); } @@ -294,10 +294,10 @@ public BTreeGetBulkOperation bopGetBulk(BTreeGetBulk getBulk, @Override public CollectionMutateOperation collectionMutate(String key, - String subkey, + String elementKey, CollectionMutate collectionMutate, OperationCallback cb) { - return new CollectionMutateOperationImpl(key, subkey, collectionMutate, cb); + return new CollectionMutateOperationImpl(key, elementKey, collectionMutate, cb); } @Override diff --git a/src/main/java/net/spy/memcached/protocol/ascii/CollectionExistOperationImpl.java b/src/main/java/net/spy/memcached/protocol/ascii/CollectionExistOperationImpl.java index ed008d3b7..745992125 100644 --- a/src/main/java/net/spy/memcached/protocol/ascii/CollectionExistOperationImpl.java +++ b/src/main/java/net/spy/memcached/protocol/ascii/CollectionExistOperationImpl.java @@ -54,14 +54,14 @@ public final class CollectionExistOperationImpl extends OperationImpl false, "UNREADABLE", CollectionResponse.UNREADABLE); private final String key; - private final String subkey; + private final String elementKey; private final CollectionExist collectionExist; - public CollectionExistOperationImpl(String key, String subkey, + public CollectionExistOperationImpl(String key, String elementKey, CollectionExist collectionExist, OperationCallback cb) { super(cb); this.key = key; - this.subkey = subkey; + this.elementKey = elementKey; this.collectionExist = collectionExist; if (this.collectionExist instanceof SetExist) { setAPIType(APIType.SOP_EXIST); @@ -91,10 +91,10 @@ public void initialize() { byte[] additionalArgs = collectionExist.getAdditionalArgs(); ByteBuffer bb = ByteBuffer.allocate((null == additionalArgs ? 0 : additionalArgs.length) + KeyUtil.getKeyBytes(key).length - + KeyUtil.getKeyBytes(subkey).length + + KeyUtil.getKeyBytes(elementKey).length + args.length() + OVERHEAD); - setArguments(bb, collectionExist.getCommand(), key, subkey, args); + setArguments(bb, collectionExist.getCommand(), key, elementKey, args); if (null != additionalArgs) { bb.put(additionalArgs); @@ -114,8 +114,8 @@ public Collection getKeys() { return Collections.singleton(key); } - public String getSubKey() { - return subkey; + public String getElementKey() { + return elementKey; } public CollectionExist getExist() { diff --git a/src/main/java/net/spy/memcached/protocol/ascii/CollectionGetOperationImpl.java b/src/main/java/net/spy/memcached/protocol/ascii/CollectionGetOperationImpl.java index 0dd944aae..1da003212 100644 --- a/src/main/java/net/spy/memcached/protocol/ascii/CollectionGetOperationImpl.java +++ b/src/main/java/net/spy/memcached/protocol/ascii/CollectionGetOperationImpl.java @@ -213,7 +213,7 @@ public void handleRead(ByteBuffer bb) { if (lookingFor == '\0' && readOffset == data.length) { CollectionGetOperation.Callback cb = (CollectionGetOperation.Callback) getCallback(); - cb.gotData(collectionGet.getSubkey(), flags, data, collectionGet.getElementFlag()); + cb.gotData(collectionGet.getElementKey(), flags, data, collectionGet.getElementFlag()); lookingFor = '\r'; } diff --git a/src/main/java/net/spy/memcached/protocol/ascii/CollectionInsertOperationImpl.java b/src/main/java/net/spy/memcached/protocol/ascii/CollectionInsertOperationImpl.java index e445eae6e..af88f65c9 100644 --- a/src/main/java/net/spy/memcached/protocol/ascii/CollectionInsertOperationImpl.java +++ b/src/main/java/net/spy/memcached/protocol/ascii/CollectionInsertOperationImpl.java @@ -67,16 +67,16 @@ public final class CollectionInsertOperationImpl extends OperationImpl false, "BKEY_MISMATCH", CollectionResponse.BKEY_MISMATCH); private final String key; - private final String subkey; // e.g.) 0 or 0x00 + private final String elementKey; // e.g.) 0 or 0x00 private final CollectionInsert collectionInsert; private final byte[] data; - public CollectionInsertOperationImpl(String key, String subkey, + public CollectionInsertOperationImpl(String key, String elementKey, CollectionInsert collectionInsert, byte[] data, OperationCallback cb) { super(cb); this.key = key; - this.subkey = subkey; + this.elementKey = elementKey; this.collectionInsert = collectionInsert; this.data = data; if (this.collectionInsert instanceof ListInsert) { @@ -124,11 +124,11 @@ public void initialize() { String args = collectionInsert.stringify(); ByteBuffer bb = ByteBuffer.allocate(data.length + KeyUtil.getKeyBytes(key).length - + KeyUtil.getKeyBytes(subkey).length + + KeyUtil.getKeyBytes(elementKey).length + KeyUtil.getKeyBytes(collectionInsert.getElementFlagByHex()).length + args.length() + OVERHEAD); - setArguments(bb, collectionInsert.getCommand(), key, subkey, + setArguments(bb, collectionInsert.getCommand(), key, elementKey, collectionInsert.getElementFlagByHex(), data.length, args); bb.put(data); bb.put(CRLF); @@ -145,8 +145,8 @@ public Collection getKeys() { return Collections.singleton(key); } - public String getSubKey() { - return subkey; + public String getElementKey() { + return elementKey; } public CollectionInsert getInsert() { diff --git a/src/main/java/net/spy/memcached/protocol/ascii/CollectionMutateOperationImpl.java b/src/main/java/net/spy/memcached/protocol/ascii/CollectionMutateOperationImpl.java index d2f4f4397..ae889d480 100644 --- a/src/main/java/net/spy/memcached/protocol/ascii/CollectionMutateOperationImpl.java +++ b/src/main/java/net/spy/memcached/protocol/ascii/CollectionMutateOperationImpl.java @@ -57,14 +57,14 @@ public final class CollectionMutateOperationImpl extends OperationImpl implement false, "OUT_OF_RANGE", CollectionResponse.OUT_OF_RANGE); private final String key; - private final String subkey; + private final String elementKey; private final CollectionMutate collectionMutate; - public CollectionMutateOperationImpl(String key, String subkey, + public CollectionMutateOperationImpl(String key, String elementKey, CollectionMutate collectionMutate, OperationCallback cb) { super(cb); this.key = key; - this.subkey = subkey; + this.elementKey = elementKey; this.collectionMutate = collectionMutate; if (this.collectionMutate instanceof BTreeMutate) { if (((BTreeMutate) this.collectionMutate).getMutator() == Mutator.incr) { @@ -111,10 +111,10 @@ public void initialize() { String cmd = collectionMutate.getCommand(); String args = collectionMutate.stringify(); ByteBuffer bb = ByteBuffer.allocate(KeyUtil.getKeyBytes(key).length - + KeyUtil.getKeyBytes(subkey).length + + KeyUtil.getKeyBytes(elementKey).length + cmd.length() + args.length() + 16); - setArguments(bb, cmd, key, subkey, args); + setArguments(bb, cmd, key, elementKey, args); ((Buffer) bb).flip(); setBuffer(bb); @@ -128,8 +128,8 @@ public Collection getKeys() { return Collections.singleton(key); } - public String getSubKey() { - return subkey; + public String getElementKey() { + return elementKey; } @Override diff --git a/src/main/java/net/spy/memcached/protocol/ascii/CollectionUpdateOperationImpl.java b/src/main/java/net/spy/memcached/protocol/ascii/CollectionUpdateOperationImpl.java index e4f9da1cd..74524a040 100644 --- a/src/main/java/net/spy/memcached/protocol/ascii/CollectionUpdateOperationImpl.java +++ b/src/main/java/net/spy/memcached/protocol/ascii/CollectionUpdateOperationImpl.java @@ -60,16 +60,16 @@ public final class CollectionUpdateOperationImpl extends OperationImpl implement false, "EFLAG_MISMATCH", CollectionResponse.EFLAG_MISMATCH); private final String key; - private final String subkey; // e.g.) 0 or 0x00 + private final String elementKey; // e.g.) 0 or 0x00 private final CollectionUpdate collectionUpdate; private final byte[] data; - public CollectionUpdateOperationImpl(String key, String subkey, + public CollectionUpdateOperationImpl(String key, String elementKey, CollectionUpdate collectionUpdate, byte[] data, OperationCallback cb) { super(cb); this.key = key; - this.subkey = subkey; + this.elementKey = elementKey; this.collectionUpdate = collectionUpdate; this.data = data; if (this.collectionUpdate instanceof BTreeUpdate) { @@ -121,11 +121,11 @@ public void initialize() { ByteBuffer bb = ByteBuffer .allocate(((data != null) ? data.length : 0) + KeyUtil.getKeyBytes(key).length - + KeyUtil.getKeyBytes(subkey).length + + KeyUtil.getKeyBytes(elementKey).length + eflagStr.length() + args.length() + OVERHEAD); - setArguments(bb, collectionUpdate.getCommand(), key, subkey, + setArguments(bb, collectionUpdate.getCommand(), key, elementKey, eflagStr, (data != null ? data.length : "-1"), args); if (data != null) { @@ -146,8 +146,8 @@ public Collection getKeys() { return Collections.singleton(key); } - public String getSubKey() { - return subkey; + public String getElementKey() { + return elementKey; } public CollectionUpdate getUpdate() { diff --git a/src/main/java/net/spy/memcached/protocol/binary/BinaryOperationFactory.java b/src/main/java/net/spy/memcached/protocol/binary/BinaryOperationFactory.java index 361442cb8..2fde05eb7 100644 --- a/src/main/java/net/spy/memcached/protocol/binary/BinaryOperationFactory.java +++ b/src/main/java/net/spy/memcached/protocol/binary/BinaryOperationFactory.java @@ -219,7 +219,7 @@ public GetAttrOperation getAttr(String key, } @Override - public CollectionInsertOperation collectionInsert(String key, String subkey, + public CollectionInsertOperation collectionInsert(String key, String elementKey, CollectionInsert collectionInsert, byte[] data, OperationCallback cb) { @@ -252,7 +252,7 @@ public CollectionDeleteOperation collectionDelete(String key, } @Override - public CollectionExistOperation collectionExist(String key, String subkey, + public CollectionExistOperation collectionExist(String key, String elementKey, CollectionExist collectionExist, OperationCallback cb) { throw new RuntimeException( @@ -290,7 +290,7 @@ public BTreeSortMergeGetOperation bopsmget(BTreeSMGet smGet, @Override public CollectionUpdateOperation collectionUpdate(String key, - String subkey, + String elementKey, CollectionUpdate collectionUpdate, byte[] data, OperationCallback cb) { @@ -308,7 +308,7 @@ public CollectionPipedUpdateOperation collectionPipedUpdate(String key, @Override public CollectionMutateOperation collectionMutate(String key, - String subkey, + String elementKey, CollectionMutate collectionMutate, OperationCallback cb) { throw new RuntimeException( diff --git a/src/main/java/net/spy/memcached/v2/AsyncArcusCommands.java b/src/main/java/net/spy/memcached/v2/AsyncArcusCommands.java index 9cd98846f..d10d23303 100644 --- a/src/main/java/net/spy/memcached/v2/AsyncArcusCommands.java +++ b/src/main/java/net/spy/memcached/v2/AsyncArcusCommands.java @@ -770,7 +770,7 @@ public void complete() { } @Override - public void gotData(String subKey, int flags, byte[] data, byte[] eFlag) { + public void gotData(String elementKey, int flags, byte[] data, byte[] eFlag) { result.set(new CachedData(flags, data, tcForCollection.getMaxSize())); } }; @@ -815,7 +815,7 @@ public void complete() { } @Override - public void gotData(String subKey, int flags, byte[] data, byte[] eFlag) { + public void gotData(String elementKey, int flags, byte[] data, byte[] eFlag) { result.get().add(new CachedData(flags, data, tcForCollection.getMaxSize())); } }; @@ -870,7 +870,7 @@ public ArcusFuture> sopGet(String key, int count, GetMode mode) { CollectionGetOperation.Callback cb = new CollectionGetOperation.Callback() { @Override - public void gotData(String subKey, int flags, byte[] data, byte[] eFlag) { + public void gotData(String elementKey, int flags, byte[] data, byte[] eFlag) { result.get().add(new CachedData(flags, data, tcForCollection.getMaxSize())); } diff --git a/src/test/manual/net/spy/memcached/MultibyteKeyTest.java b/src/test/manual/net/spy/memcached/MultibyteKeyTest.java index 6134c7957..19efee07a 100644 --- a/src/test/manual/net/spy/memcached/MultibyteKeyTest.java +++ b/src/test/manual/net/spy/memcached/MultibyteKeyTest.java @@ -163,7 +163,7 @@ public void decodeElemHeader(List tokens) { } }, new CollectionGetOperation.Callback() { @Override - public void gotData(String subkey, int flags, byte[] data, byte[] eflag) { + public void gotData(String elementKey, int flags, byte[] data, byte[] eflag) { } @Override