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

changed protobuf schema and stub methods #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions api/protos/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ enum Op {
Remove = 4;
// Returns bool
SafeToRemove = 5;
// Sets to maintenance mode. Returns OpResult
SetMaintenance = 7;
// Unsets maintenance mode Returns OpResult
UnsetMaintenance = 8;
}

// Datacenter related API's
Expand Down
32 changes: 32 additions & 0 deletions src/disk_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,43 @@ fn listen(
}
};
}

Op::SetMaintenance => {
match set_maintenance_mode(&mut responder) {
Ok(_) => {
info!("Set maintenance operation finished");
}
Err(e) => {
error!("Error when setting to maintenance mode: {:?}", e);
}
};
}

Op::UnsetMaintenance => {
match unset_maintenance_mode(&mut responder) {
Ok(_) => {
info!("Unset maintenance operation finished");
}
Err(e) => {
error!("Error when unsetting the maintenance mode: {:?}", e);
}
};
}
};
thread::sleep(Duration::from_millis(10));
}
}

fn set_maintenance_mode(sock: &mut Socket) -> BynarResult<()> {
//TODO implement the feature
Ok(())
}

fn unset_maintenance_mode(sock: &mut Socket) -> BynarResult<()> {
//TODO implement the feature
Ok(())
}

fn respond_to_client(result: &OpResult, s: &mut Socket) -> BynarResult<()> {
let encoded = result.write_to_bytes()?;
let msg = Message::from_slice(&encoded)?;
Expand Down