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

Updating with StaticVersionType #188

Merged
merged 4 commits into from
Mar 14, 2024
Merged

Conversation

nyospe
Copy link
Contributor

@nyospe nyospe commented Mar 12, 2024

One positive here is, I've figured out how to bind the version from the sequencer to HotShot, such that we can schedule updates without changing HotShot if we need to.

@nyospe nyospe requested a review from jbearer March 12, 2024 21:23
@nyospe nyospe marked this pull request as ready for review March 12, 2024 21:23
@nyospe nyospe requested a review from ss-es March 13, 2024 13:45
@@ -39,11 +43,11 @@ impl From<RequestError> for HelloError {
}

async fn serve(port: u16) -> io::Result<()> {
let mut app = App::<_, HelloError, 0, 1>::with_state(RwLock::new("Hello".to_string()));
let mut app = App::<_, HelloError, Ver01>::with_state(RwLock::new("Hello".to_string()));
Copy link

Choose a reason for hiding this comment

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

I'm not really familiar with the code in this repo, but it looks like there are multiple different names for the same thing. Is this intentional?

There's Ver01 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 not so much intentional as the inevitable consequence of how rust's doctest works. Each doctest instance is basically its own isolated sandbox. Likewise for examples. There's nothing special about these aliases, they're just convent for illustrating that, in real usage, you would be using something external rather than hardcoding StaticVersion<0, 1> as a parameter.

/// # const MINOR: u16 = 1;
/// # fn ex(api: &mut tide_disco::Api<(), (), MAJOR, MINOR>) {
/// # use versioned_binary_serialization::version::StaticVersion;
/// # type StaticVer01 = StaticVersion<0, 1>;
Copy link

Choose a reason for hiding this comment

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

StaticVer01 here

src/api.rs Outdated
@@ -1376,7 +1386,7 @@ mod test {

#[async_std::test]
async fn test_socket_endpoint() {
let mut app = App::<_, ServerError, 0, 1>::with_state(RwLock::new(()));
let mut app = App::<_, ServerError, StaticVersion01>::with_state(RwLock::new(()));
Copy link

Choose a reason for hiding this comment

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

StaticVersion01 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.

Just three different contexts, each with a local alias...

@nyospe nyospe requested a review from ss-es March 13, 2024 21:06
@nyospe nyospe merged commit d0d2bfb into main Mar 14, 2024
3 checks passed
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.

3 participants