Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTERNAL: tidy operation codes #846

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void handleLine(String line) {
}

@Override
public final void handleRead(ByteBuffer bb) {
public void handleRead(ByteBuffer bb) {
if (lookingFor == '\0' && data == null) {
while (bb.hasRemaining()) {
byte b = bb.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void handleLine(String line) {
}

@Override
public final void handleRead(ByteBuffer bb) {
public void handleRead(ByteBuffer bb) {
switch (readState) {
case VALUE:
readValue(bb);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public final class CollectionCreateOperationImpl extends OperationImpl
true, "CREATED", CollectionResponse.CREATED);
private static final OperationStatus EXISTS = new CollectionOperationStatus(
false, "EXISTS", CollectionResponse.EXISTS);
private static final OperationStatus SERVER_ERROR = new CollectionOperationStatus(
false, "SERVER_ERROR", CollectionResponse.SERVER_ERROR);

private final String key;
private final CollectionCreate collectionCreate;
Expand Down Expand Up @@ -92,7 +90,7 @@ assert getState() == OperationState.READING
return;
}
/* ENABLE_MIGRATION end */
getCallback().receivedStatus(matchStatus(line, CREATED, EXISTS, SERVER_ERROR));
getCallback().receivedStatus(matchStatus(line, CREATED, EXISTS));
transitionState(OperationState.COMPLETE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void handleLine(String line) {
}

@Override
public final void handleRead(ByteBuffer bb) {
public void handleRead(ByteBuffer bb) {
// Decode a collection data header.
if (lookingFor == '\0' && data == null) {
while (bb.hasRemaining()) {
Expand All @@ -166,10 +166,9 @@ public final void handleRead(ByteBuffer bb) {
tokens.add(byteBuffer.toString());
byteBuffer.reset();

if (eFlagIndex >= 0) {
if (tokens.size() == eFlagIndex + 1 && tokens.get(eFlagIndex).startsWith("0x")) {
eHeadCount++;
}
if (eFlagIndex >= 0 &&
tokens.size() == eFlagIndex + 1 && tokens.get(eFlagIndex).startsWith("0x")) {
eHeadCount++;
}
if (tokens.size() == eHeadCount) {
collectionGet.decodeElemHeader(tokens);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ public final class CollectionPipedUpdateOperationImpl extends OperationImpl impl
false, "BKEY_MISMATCH", CollectionResponse.BKEY_MISMATCH);
private static final OperationStatus EFLAG_MISMATCH = new CollectionOperationStatus(
false, "EFLAG_MISMATCH", CollectionResponse.EFLAG_MISMATCH);
private static final OperationStatus SERVER_ERROR = new CollectionOperationStatus(
false, "SERVER_ERROR", CollectionResponse.SERVER_ERROR);

private final String key;
private final CollectionPipedUpdate<?> update;
Expand Down Expand Up @@ -114,7 +112,7 @@ assert getState() == OperationState.READING : "Read ``" + line
if (update.isNotPiped()) {
OperationStatus status = matchStatus(line, UPDATED, NOT_FOUND,
NOT_FOUND_ELEMENT, NOTHING_TO_UPDATE, TYPE_MISMATCH,
BKEY_MISMATCH, EFLAG_MISMATCH, SERVER_ERROR);
BKEY_MISMATCH, EFLAG_MISMATCH);
if (status.isSuccess()) {
cb.receivedStatus((successAll) ? END : FAILED_END);
} else {
Expand Down Expand Up @@ -154,7 +152,7 @@ assert getState() == OperationState.READING : "Read ``" + line
} else {
OperationStatus status = matchStatus(line, UPDATED, NOT_FOUND,
NOT_FOUND_ELEMENT, NOTHING_TO_UPDATE, TYPE_MISMATCH,
BKEY_MISMATCH, EFLAG_MISMATCH, SERVER_ERROR);
BKEY_MISMATCH, EFLAG_MISMATCH);

if (!status.isSuccess()) {
cb.gotStatus(index, status);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ public final class CollectionUpdateOperationImpl extends OperationImpl implement
false, "BKEY_MISMATCH", CollectionResponse.BKEY_MISMATCH);
private static final OperationStatus EFLAG_MISMATCH = new CollectionOperationStatus(
false, "EFLAG_MISMATCH", CollectionResponse.EFLAG_MISMATCH);
private static final OperationStatus SERVER_ERROR = new CollectionOperationStatus(
false, "SERVER_ERROR", CollectionResponse.SERVER_ERROR);

private final String key;
private final String subkey; // e.g.) 0 or 0x00
Expand Down Expand Up @@ -104,7 +102,7 @@ assert getState() == OperationState.READING : "Read ``" + line
/* ENABLE_MIGRATION end */
OperationStatus status = matchStatus(line, UPDATED, NOT_FOUND, NOT_FOUND_ELEMENT,
NOTHING_TO_UPDATE, TYPE_MISMATCH, BKEY_MISMATCH,
EFLAG_MISMATCH, SERVER_ERROR);
EFLAG_MISMATCH);
getCallback().receivedStatus(status);
transitionState(OperationState.COMPLETE);
}
Expand Down