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

Support the STATS RESET command #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 @@ -35,7 +35,8 @@
final class StatsOperationImpl extends OperationImpl implements StatsOperation {

private static final OperationStatus END = new OperationStatus(true, "END");

private static final OperationStatus RESET = new OperationStatus(true, "RESET");

private static final byte[] MSG = "stats\r\n".getBytes();

private final byte[] msg;
Expand All @@ -56,6 +57,10 @@ public void handleLine(String line) {
if (line.equals("END")) {
cb.receivedStatus(END);
transitionState(OperationState.COMPLETE);
} else if (line.equals("RESET")) {
// The server responds to "stats reset" with "RESET"
cb.receivedStatus(RESET);
transitionState(OperationState.COMPLETE);
} else {
String[] parts = line.split(" ", 3);
assert parts.length == 3;
Expand Down