Skip to content

[Auth restructure 1] Separate http into a new crate - #213

Merged
ramsayleung merged 45 commits into
separate-cratesfrom
auth-rewrite-part1
Jul 8, 2021
Merged

ramsayleung merged 45 commits into
separate-cratesfrom
auth-rewrite-part1

Conversation

@marioortizmanero

@marioortizmanero marioortizmanero commented Jun 19, 2021 •

Copy link
Copy Markdown
Collaborator

Part 1 of splitting up #207.

This moves the http logic into its own crate. It should be able to compile by itself (but not rspotify itself)

@marioortizmanero marioortizmanero changed the title Separate http into a new crate ]Auth restructure 1] Separate http into a new crate Jun 19, 2021
@marioortizmanero marioortizmanero changed the title ]Auth restructure 1] Separate http into a new crate [Auth restructure 1] Separate http into a new crate Jun 19, 2021
@ramsayleung

Copy link
Copy Markdown
Owner

This moves the http logic into its own crate. It should be able to compile by itself (but not rspotify itself)

As for this point, http crate should be able to compile by itself, isn't possible to separate the GitHub Action CI flow by crate instead of put them all into one CI flow? Then in this PR, the http crate should pass the CI check

@marioortizmanero

Copy link
Copy Markdown
Collaborator Author

It's a bit complicated/cumbersome to do so... For now I guess you can just run the tests locally for the http crate?

Can we first talk about how cross-compilation isn't really necessary for the CI? I don't see what could possibly cause a fail in one architecture that doesn't happen in another; we don't have architecture-specific code. If we simplify that then we might be able to have a flow per crate as you suggest, but otherwise with 4 crates, 3 architectures and 2 possible configurations (ureq and reqwest) we would have a total of 4 * 3 * 2 = 24 CI flows just for the tests... Which would grow even bigger if we added more HTTP clients.

@ramsayleung

Copy link
Copy Markdown
Owner

Can we first talk about how cross-compilation isn't really necessary for the CI?

Yeah, cross-compilation isn't high priority, so it's ok to move these cross-compilation CI flow, and doesn't need to compile for different architectures.

@marioortizmanero marioortizmanero mentioned this pull request Jul 2, 2021

@ramsayleung ramsayleung left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Beside the nitpick I mentioned, everything looks good to me.

Finally, the reviews of all PR are done :)

Comment thread rspotify-http/src/common.rs Outdated
Io(#[from] std::io::Error),
}

pub type Result<T> = std::result::Result<T, Error>;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Is it a better choice to have new names instead Error and Result, since it's conflicting with the type defined in standard library, might cause a bit of confusion.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Most libraries also use Error, you can then use it as http::Error to avoid ambiguity wherever needed. The thing is that we'd have to change ClientError to be rspotify::Error as well for consistency. But seeing that we have ApiError as well it might be more clear by using a prefix. I'll change it to HttpError, but if you think the other option is better let me know and I'll undo it.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

HttpError is good enough :)

@ramsayleung
ramsayleung merged commit 0fee50a into separate-crates Jul 8, 2021
@ramsayleung
ramsayleung deleted the auth-rewrite-part1 branch July 8, 2021 03:40
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