Skip to content

Commit

Permalink
INTERNAL: Add eflag parameter in collectionGetOperation callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
brido4125 committed Aug 2, 2023
1 parent 6998801 commit 5870ca0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
21 changes: 7 additions & 14 deletions src/main/java/net/spy/memcached/ArcusClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,7 @@ public void complete() {
latch.countDown();
}

public void gotData(String key, int flags, String subkey, byte[] data) {
assert key.equals(k) : "Wrong key returned";
public void gotData(int flags, String subkey, byte[] data, byte[] eflag) {
list.add(tc.decode(new CachedData(flags, data, tc.getMaxSize())));
}
});
Expand Down Expand Up @@ -607,8 +606,7 @@ public void complete() {
latch.countDown();
}

public void gotData(String key, int flags, String subkey, byte[] data) {
assert key.equals(k) : "Wrong key returned";
public void gotData(int flags, String subkey, byte[] data, byte[] eflag) {
set.add(tc.decode(new CachedData(flags, data, tc.getMaxSize())));
}
});
Expand Down Expand Up @@ -674,12 +672,10 @@ public void complete() {
latch.countDown();
}

public void gotData(String key, int flags, String bkey, byte[] data) {
assert key.equals(k) : "Wrong key returned";
public void gotData(int flags, String bkey, byte[] data, byte[] eflag) {
long longBkey = Long.parseLong(bkey);
map.put(longBkey, new Element<T>(longBkey,
tc.decode(new CachedData(flags, data, tc.getMaxSize())),
collectionGet.getElementFlag()));
tc.decode(new CachedData(flags, data, tc.getMaxSize())), eflag));
}
});
rv.setOperation(op);
Expand Down Expand Up @@ -740,8 +736,7 @@ public void complete() {
latch.countDown();
}

public void gotData(String key, int flags, String mkey, byte[] data) {
assert key.equals(k) : "Wrong key returned";
public void gotData(int flags, String mkey, byte[] data, byte[] eflag) {
map.put(mkey, tc.decode(new CachedData(flags, data, tc.getMaxSize())));
}
});
Expand Down Expand Up @@ -2980,12 +2975,10 @@ public void complete() {
latch.countDown();
}

public void gotData(String key, int flags, String bkey, byte[] data) {
assert key.equals(k) : "Wrong key returned";
public void gotData(int flags, String bkey, byte[] data, byte[] eflag) {
byte[] byteBkey = BTreeUtil.hexStringToByteArrays(bkey);
Element<T> element = new Element<T>(byteBkey,
tc.decode(new CachedData(flags, data, tc.getMaxSize())),
collectionGet.getElementFlag());
tc.decode(new CachedData(flags, data, tc.getMaxSize())), eflag);
map.put(new ByteArrayBKey(byteBkey), element);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public interface CollectionGetOperation extends KeyedOperation {
CollectionGet getGet();

interface Callback extends OperationCallback {
void gotData(String key, int flags, String subkey, byte[] data);
void gotData(int flags, String subkey, byte[] data, byte[] eflag);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public final void handleRead(ByteBuffer bb) {
if (lookingFor == '\0' && readOffset == data.length) {
CollectionGetOperation.Callback cb =
(CollectionGetOperation.Callback) getCallback();
cb.gotData(key, flags, collectionGet.getSubkey(), data);
cb.gotData(flags, collectionGet.getSubkey(), data, collectionGet.getElementFlag());
lookingFor = '\r';
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/manual/net/spy/memcached/MultibyteKeyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void decodeItemHeader(String itemHeader) {
}
}, new CollectionGetOperation.Callback() {
@Override
public void gotData(String key, int flags, String subkey, byte[] data) {
public void gotData(int flags, String subkey, byte[] data, byte[] eflag) {
}

@Override
Expand Down Expand Up @@ -425,7 +425,7 @@ public void ExtendedBTreeGetOperationImplTest() {
new BTreeGet(from, to, 0, 0, false, false, ElementFlagFilter.DO_NOT_FILTER),
new CollectionGetOperation.Callback() {
@Override
public void gotData(String key, int flags, String subkey, byte[] data) {
public void gotData(int flags, String subkey, byte[] data, byte[] eflag) {
}

@Override
Expand Down

0 comments on commit 5870ca0

Please sign in to comment.