Skip to content

Commit 8c9a6e3

Browse files
brido4125jhpark816
authored andcommitted
INTERNAL: Remove redudant operation type RW.
1 parent a3bd40e commit 8c9a6e3

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/main/java/net/spy/memcached/ConnectionFactoryBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ public ConnectionFactoryBuilder setReadPriority(ReadPriority priority) {
392392
public ConnectionFactoryBuilder setAPIReadPriority(APIType apiType, ReadPriority readPriority) {
393393
OperationType type = apiType.getAPIOpType();
394394

395-
if (type == OperationType.READ || type == OperationType.RW) {
395+
if (type == OperationType.READ) {
396396
this.apiReadPriorityList.put(apiType, readPriority);
397397
}
398398

@@ -404,7 +404,7 @@ public ConnectionFactoryBuilder setAPIReadPriority(Map<APIType, ReadPriority> ap
404404

405405
for (Map.Entry<APIType, ReadPriority> entry : apiList.entrySet()) {
406406
OperationType type = entry.getKey().getAPIOpType();
407-
if (type == OperationType.READ || type == OperationType.RW) {
407+
if (type == OperationType.READ) {
408408
this.apiReadPriorityList.put(entry.getKey(), entry.getValue());
409409
}
410410
}

src/main/java/net/spy/memcached/ops/APIType.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ public enum APIType {
3030
LOP_CREATE(OperationType.WRITE),
3131
LOP_INSERT(OperationType.WRITE),
3232
LOP_DELETE(OperationType.WRITE),
33-
LOP_GET(OperationType.RW),
33+
LOP_GET(OperationType.READ),
3434

3535
// Set API Type
3636
SOP_CREATE(OperationType.WRITE),
3737
SOP_INSERT(OperationType.WRITE),
3838
SOP_DELETE(OperationType.WRITE),
3939
SOP_EXIST(OperationType.READ),
40-
SOP_GET(OperationType.RW),
40+
SOP_GET(OperationType.READ),
4141

4242
// Map API Type
4343
MOP_CREATE(OperationType.WRITE),
4444
MOP_INSERT(OperationType.WRITE),
4545
MOP_UPSERT(OperationType.WRITE),
4646
MOP_UPDATE(OperationType.WRITE),
4747
MOP_DELETE(OperationType.WRITE),
48-
MOP_GET(OperationType.RW),
48+
MOP_GET(OperationType.READ),
4949

5050
// B+Tree API Type
5151
BOP_CREATE(OperationType.WRITE),
@@ -54,7 +54,7 @@ public enum APIType {
5454
BOP_UPDATE(OperationType.WRITE),
5555
BOP_INCR(OperationType.WRITE), BOP_DECR(OperationType.WRITE),
5656
BOP_COUNT(OperationType.READ),
57-
BOP_GET(OperationType.RW),
57+
BOP_GET(OperationType.READ),
5858
BOP_SMGET(OperationType.READ),
5959
BOP_POSITION(OperationType.READ),
6060
BOP_GBP(OperationType.READ),
@@ -72,7 +72,7 @@ public enum APIType {
7272
// undefined API
7373
UNDEFINED(OperationType.UNDEFINED);
7474

75-
private final OperationType apiOpType;
75+
private OperationType apiOpType;
7676

7777
APIType(OperationType t) {
7878
this.apiOpType = t;
@@ -81,4 +81,8 @@ public enum APIType {
8181
public OperationType getAPIOpType() {
8282
return this.apiOpType;
8383
}
84+
85+
public void setAPIOpType(OperationType t) {
86+
this.apiOpType = t;
87+
}
8488
}

src/main/java/net/spy/memcached/ops/OperationType.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ public enum OperationType {
4444
*/
4545
READ,
4646

47-
/* for Collection Get API (with delete, dropIfEmpty) */
48-
RW,
49-
5047
/*
5148
* StatsOperationImpl (getStats)
5249
* VersionOperationImpl (getVersions)

src/main/java/net/spy/memcached/protocol/ascii/CollectionGetOperationImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,9 @@ public CollectionGetOperationImpl(String key, CollectionGet collectionGet,
101101
setAPIType(APIType.BOP_GET);
102102
}
103103
if (collectionGet.isDelete()) {
104-
setOperationType(OperationType.WRITE);
105-
} else {
106-
setOperationType(OperationType.READ);
104+
getAPIType().setAPIOpType(OperationType.WRITE);
107105
}
106+
setOperationType(getAPIType().getAPIOpType());
108107
}
109108

110109
public void handleLine(String line) {

0 commit comments

Comments
 (0)