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

Refactor discovery system #29

Merged
merged 1 commit into from
Nov 5, 2015
Merged

Refactor discovery system #29

merged 1 commit into from
Nov 5, 2015

Conversation

adamhjk
Copy link
Contributor

@adamhjk adamhjk commented Nov 5, 2015

  • Adds the Census for global coordination
  • Topologies now use the Census rather than discovery directly
  • Configuration loading moved to the servic_config module
  • Main event loop now processes more things between states; config
    updates, census updates, process restarting.
  • Watches are now universally supported.
  • Standalone topology now mocks etcd
  • No longer depends on inotify, several other crates
  • No longer restarts a service if the toml has changed but the
    configuration files are identical
  • No more need for the 'toml' directory
  • last.toml renamed config.toml

And more! Think of the glorious future!

pub struct CensusEntry {
id: Uuid,
hostname: String,
ip: String,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We may want to consider using the SocketAddrV4 struct instead of a string representation here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's stringy because it's only real purpose in life is to be serialized. I haven't looked at whether the actual socket types serialize into something useful, in terms of how you write configuration templates.

@reset
Copy link
Collaborator

reset commented Nov 5, 2015

@adamhjk this is a massive improvement and exactly in line with what I expected/hoped for. Things are very much easier to understand and work with after this PR.

A few minor overall notes:

  • The new modules are lacking licenses at the top of the files. Do we put a license at the top of each file in this project or do we not mind?
  • New modules/types/funs are lacking documentation. Is this something you did intentionally, something you plan to do later, or something we don't mind about since these are largely changes to internal components?

@adamhjk
Copy link
Contributor Author

adamhjk commented Nov 5, 2015

I'm going to have another PR soon with updated docs. I didn't want to block on it, since the cahnge was already so massive that it's a merge-nightmare waiting to happen for you and fletcher.

I'll add license files as well as a few cleanups you suggested. Nice review!

@reset
Copy link
Collaborator

reset commented Nov 5, 2015

@adamhjk sounds great to me 😄

* Adds the Census for global coordination
* Topologies now use the Census rather than discovery directly
* Configuration loading moved to the servic_config module
* Main event loop now processes more things between states; config
  updates, census updates, process restarting.
* Watches are now universally supported.
* Standalone topology now mocks etcd
* No longer depends on inotify, several other crates
* No longer restarts a service if the toml has changed but the
  configuration files are identical
* No more need for the 'toml' directory
* last.toml renamed config.toml
* Adds missing license headers

And more! Think of the glorious future!
@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

CensusEntry {
id: Uuid::new_v4(),
hostname: util::sys::hostname().unwrap_or(String::from("unknown")),
ip: util::sys::ip().unwrap_or(String::from("127.0.0.1")),
Copy link
Collaborator

Choose a reason for hiding this comment

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

wow, Ohai in Rust would be crazy nice if there's more like this around…

Copy link
Collaborator

Choose a reason for hiding this comment

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

Dude, I was talking to @jtimberman tonight and we got on a tangent but I was about to tell him all about how Ohai is great but the worst part about it is that it's not a systems app and it requires Ruby. There's a version of Ohai that exists which leverages a proper systems level language and real-time updates servers as we go - I know it.

@fnichol
Copy link
Collaborator

fnichol commented Nov 5, 2015

@delivery approve

chef-delivery added a commit that referenced this pull request Nov 5, 2015
Merged change 3742a92a-7588-403e-b33e-18934930a5e6

From review branch BLDR-20 into master

Signed-off-by: fnichol <[email protected]>
@chef-delivery chef-delivery merged commit edb2bd2 into master Nov 5, 2015
@chef-delivery chef-delivery deleted the BLDR-20 branch November 5, 2015 19:10
@chef-delivery
Copy link
Contributor

Change: 3742a92a-7588-403e-b33e-18934930a5e6 approved by: @fnichol

suitability: u64,
port: Option<String>,
exposes: Option<Vec<String>>,
pub leader: Option<bool>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these pub to get the reader benefit? I would think we'd want any mutation to happen via fn leader(…) (etc.), correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, reader.

}
HandleResult::Reply(Message::Ok, Some(ENTRY_TIMEOUT_MS))
},
Message::Ok => HandleResult::Stop(StopReason::Fatal(format!("You don't send me Ok! I send YOU Ok!")), Some(Message::Ok)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Enums and match in action, nice

@chef-delivery
Copy link
Contributor

This PR has passed 'Acceptance' and is ready to be delivered!
Use: '@delivery deliver' when validated in acceptance.

@reset
Copy link
Collaborator

reset commented Nov 6, 2015

@adamhjk awesome work in this pr!

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.

4 participants