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

configuration message versioning #240

Closed
Geal opened this issue Sep 5, 2017 · 1 comment
Closed

configuration message versioning #240

Geal opened this issue Sep 5, 2017 · 1 comment

Comments

@Geal
Copy link
Member

Geal commented Sep 5, 2017

Configuration messages hold a version number, that should be used when parsing messages, since people might use an older tool with a new version of sozu.

The solution would be based on serde's tagged enum feature: serde-rs/serde#745 (a PR is currently in progress for this: serde-rs/serde#973 )

Here's how the code would change in command/src/data.rs:

first define a ConfigMessageWrapper enum:

#[derive(Debug,Clone,PartialEq,Eq,Hash,Serialize,Deserialize)]
#[serde(tag = "version")]
pub enum ConfigMessageWrapper {
  #[serde(rename = "0")]
  V0(ConfigMessageV0),
  #[serde(rename = "1")]
  V1(ConfigMessage),
}

The latest version is always the currently used ConfigMessage. ConfigMessageWrapperimplements Into<ConfigMessage>, so we need a way to transform a V0 message in a V1 one. It also has a function to get the version number.

Duplicate the assets in command/assets, so that we have subfolders for v0, v1, etc.

When the master parses messages, it will get the version number and hold onto it in the Client structure, to answer with the same version number.

Until the version 1.0 of sozu is released, the message format will have breaking changes, so for now the version number stays at 0.

@Geal Geal added this to the needed for the release milestone Sep 5, 2017
@Geal Geal self-assigned this Sep 5, 2017
@Geal
Copy link
Member Author

Geal commented Dec 21, 2017

closing as duplicate of #104

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant