Skip to content

Commit

Permalink
changed protobuf schema and stub methods
Browse files Browse the repository at this point in the history
  • Loading branch information
lcao0319 committed Mar 19, 2019
1 parent 5dab43a commit a2282a3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
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

0 comments on commit a2282a3

Please sign in to comment.