Skip to content

Conversation

@rrichardson
Copy link

This is a proposal for how to manage configuring a client with the static address of a server. It builds, but I haven't tested it. I want to make sure this is a sane approach before I go further.

I had to create a run() function so that I could statically dispatch based on the type of Authority. I was unable to Box SyncControllerHandle without editing the noria code.

.short("h")
.takes_value(true)
.required_unless("zk_addr")
.conflicts_with("zk_addr")
Copy link
Collaborator

Choose a reason for hiding this comment

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

These should probably also be added to the zk_addr argument

@jonhoo
Copy link
Collaborator

jonhoo commented Oct 24, 2019

Ah, that's an interesting to this. I'm a little worried about constructing a LocalAuthority this way, since it's not intended to be used in this fashion. Its impl Authority assumes that everyone shares the same LocalAuthority instance. In this particular case, it doesn't matter too much, since the client doesn't actually use the Authority part for anything except "discovering" the leader, but it's definitely an abuse of the API that might bite us later. I wonder whether a better approach here would be to write a new type, DirectClientAuthority, which implements Authority but is constructed by giving a controller address, yields that address when asked, and apart from that returns panic!("DirectClientAuthority can only be used by Noria clients, not by workers").

@rrichardson
Copy link
Author

@jonhoo - I agree that using LocalAuthority in this way is an abuse. It was suggested in the ticket that there be a ConfigAuthority which makes a bit of sense.. it would be a read-only authority.

What about breaking the Authority trait into two traits:

  1. An "authority" (Readable) portion.
  2. A "collaborator" portion.. involving the elections and consensus.

So the ZookeeperAuthority struct would actually implement both, but the ConfigAuthority would only implement the read portion (being directly initialized with a Map of some sort )

@jonhoo
Copy link
Collaborator

jonhoo commented Oct 25, 2019

Sure, that seems like a reasonable way to do it. Maybe Discover (for finding the controller) and Participate (for becoming a worker)?

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.

2 participants