Skip to content

Commit

Permalink
INTERNAL: Remove redudant operation type RW.
Browse files Browse the repository at this point in the history
  • Loading branch information
brido4125 authored and jhpark816 committed Feb 21, 2025
1 parent a3bd40e commit 8c9a6e3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/main/java/net/spy/memcached/ConnectionFactoryBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public ConnectionFactoryBuilder setReadPriority(ReadPriority priority) {
public ConnectionFactoryBuilder setAPIReadPriority(APIType apiType, ReadPriority readPriority) {
OperationType type = apiType.getAPIOpType();

if (type == OperationType.READ || type == OperationType.RW) {
if (type == OperationType.READ) {
this.apiReadPriorityList.put(apiType, readPriority);
}

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

for (Map.Entry<APIType, ReadPriority> entry : apiList.entrySet()) {
OperationType type = entry.getKey().getAPIOpType();
if (type == OperationType.READ || type == OperationType.RW) {
if (type == OperationType.READ) {
this.apiReadPriorityList.put(entry.getKey(), entry.getValue());
}
}
Expand Down
14 changes: 9 additions & 5 deletions src/main/java/net/spy/memcached/ops/APIType.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ public enum APIType {
LOP_CREATE(OperationType.WRITE),
LOP_INSERT(OperationType.WRITE),
LOP_DELETE(OperationType.WRITE),
LOP_GET(OperationType.RW),
LOP_GET(OperationType.READ),

// Set API Type
SOP_CREATE(OperationType.WRITE),
SOP_INSERT(OperationType.WRITE),
SOP_DELETE(OperationType.WRITE),
SOP_EXIST(OperationType.READ),
SOP_GET(OperationType.RW),
SOP_GET(OperationType.READ),

// Map API Type
MOP_CREATE(OperationType.WRITE),
MOP_INSERT(OperationType.WRITE),
MOP_UPSERT(OperationType.WRITE),
MOP_UPDATE(OperationType.WRITE),
MOP_DELETE(OperationType.WRITE),
MOP_GET(OperationType.RW),
MOP_GET(OperationType.READ),

// B+Tree API Type
BOP_CREATE(OperationType.WRITE),
Expand All @@ -54,7 +54,7 @@ public enum APIType {
BOP_UPDATE(OperationType.WRITE),
BOP_INCR(OperationType.WRITE), BOP_DECR(OperationType.WRITE),
BOP_COUNT(OperationType.READ),
BOP_GET(OperationType.RW),
BOP_GET(OperationType.READ),
BOP_SMGET(OperationType.READ),
BOP_POSITION(OperationType.READ),
BOP_GBP(OperationType.READ),
Expand All @@ -72,7 +72,7 @@ public enum APIType {
// undefined API
UNDEFINED(OperationType.UNDEFINED);

private final OperationType apiOpType;
private OperationType apiOpType;

APIType(OperationType t) {
this.apiOpType = t;
Expand All @@ -81,4 +81,8 @@ public enum APIType {
public OperationType getAPIOpType() {
return this.apiOpType;
}

public void setAPIOpType(OperationType t) {
this.apiOpType = t;
}
}
3 changes: 0 additions & 3 deletions src/main/java/net/spy/memcached/ops/OperationType.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ public enum OperationType {
*/
READ,

/* for Collection Get API (with delete, dropIfEmpty) */
RW,

/*
* StatsOperationImpl (getStats)
* VersionOperationImpl (getVersions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,9 @@ public CollectionGetOperationImpl(String key, CollectionGet collectionGet,
setAPIType(APIType.BOP_GET);
}
if (collectionGet.isDelete()) {
setOperationType(OperationType.WRITE);
} else {
setOperationType(OperationType.READ);
getAPIType().setAPIOpType(OperationType.WRITE);
}
setOperationType(getAPIType().getAPIOpType());
}

public void handleLine(String line) {
Expand Down

0 comments on commit 8c9a6e3

Please sign in to comment.