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

Binary! #14

Merged
merged 11 commits into from
Oct 20, 2016
Merged

Binary! #14

merged 11 commits into from
Oct 20, 2016

Conversation

ChrisMacNaughton
Copy link
Collaborator

This adds in a basic binary that will convert between json and binary formats for the CrushMap

@cholcombe973 cholcombe973 self-assigned this Oct 19, 2016
Copy link
Owner

@cholcombe973 cholcombe973 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like where this is going.

Firefly,
Hammer,
Jewel,
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we going to support the intermediate versions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are currently only used for setting the tunables


pub fn id(&self) -> i32 {
match *self {
BucketTypes::Unknown => 65536,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be set to i32::max_value()

@@ -307,3 +343,97 @@ pub struct CrushMap {
/// device fails.
pub chooseleaf_stable: Option<u8>,
}

impl CrushMap {
pub fn with_tunables(mut self, version: CephVersion) -> Self {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this! Nice

}
#[derive(Clone, Debug, Eq, PartialEq, RustcDecodable, RustcEncodable)]
pub struct CephDisk {
pub name: Option<String>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these fields optional? I would think they shouldn't be

Copy link
Collaborator Author

@ChrisMacNaughton ChrisMacNaughton Oct 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can change that but the crushmap itself has them as optional


#[derive(Clone, Debug, Eq, PartialEq, RustcDecodable, RustcEncodable)]
pub struct CephHost {
pub hostname: Option<String>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. If you make a host shouldn't be required that it have a name? I can see disks being optional if the host will be used for rgw or something

}
}

fn main() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a general comment, could you remove the unwraps so we fail cleaner?

match mode {
Mode::compile => {
let mut input = String::new();
io::stdin().read_to_string(&mut input).unwrap();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably fine. I doubt we'll ever get a crushmap input that is bigger than the heap size on the machine.

@coveralls
Copy link

Coverage Status

Coverage decreased (-9.7%) to 76.619% when pulling 2c826aa on ChrisMacNaughton:binary! into 6e0d1a8 on cholcombe973:master.

@cholcombe973 cholcombe973 merged commit 1708575 into cholcombe973:master Oct 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants