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

fl server #62

Merged
merged 16 commits into from
Oct 20, 2024
Merged

fl server #62

merged 16 commits into from
Oct 20, 2024

Conversation

rawdaGastan
Copy link
Contributor

@rawdaGastan rawdaGastan marked this pull request as draft July 16, 2024 10:30
@rawdaGastan rawdaGastan marked this pull request as ready for review July 29, 2024 13:43
Copy link
Member

@muhamadazmy muhamadazmy left a comment

Choose a reason for hiding this comment

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

Beside the comments I left on the code, why do you always assume that the user database is a Vec. I mean what if we wanna change this to use a redis or other kind of db .

I think this part of code can be abstracted with a UserDB trait or something. First implementation can hold a vec of users from the configuraiton.

fl-server/src/auth.rs Outdated Show resolved Hide resolved
fl-server/src/auth.rs Outdated Show resolved Hide resolved
fl-server/src/handlers.rs Outdated Show resolved Hide resolved
fl-server/src/serve_flists.rs Outdated Show resolved Hide resolved
fl-server/src/handlers.rs Show resolved Hide resolved
Copy link
Member

@muhamadazmy muhamadazmy left a comment

Choose a reason for hiding this comment

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

Good work @rawdaGastan :)

I left few comments on the code below, please check them out

Cargo.toml Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
fl-server/src/config.rs Outdated Show resolved Hide resolved
fl-server/src/config.rs Outdated Show resolved Hide resolved
fl-server/src/config.rs Outdated Show resolved Hide resolved
fl-server/src/handlers.rs Show resolved Hide resolved
fl-server/src/response.rs Outdated Show resolved Hide resolved
fl-server/src/response.rs Show resolved Hide resolved
fl-server/src/response.rs Outdated Show resolved Hide resolved
fl-server/src/serve_flists.rs Show resolved Hide resolved
Copy link
Member

@muhamadazmy muhamadazmy left a comment

Choose a reason for hiding this comment

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

I left few minor comments

anyhow::bail!("host '{}' is invalid", c.host)
}

if c.port > 65535 {
Copy link
Member

Choose a reason for hiding this comment

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

If you make the port of u16 type instead of usize unwill not need this check since u16 MAX is 65535


#[derive(Debug, ToSchema)]
pub struct MapDB {
users: Mutex<HashMap<String, User>>,
Copy link
Member

Choose a reason for hiding this comment

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

Why do u need the Mutex ? I can see that the DB api only needs a shared ref

Comment on lines 26 to 29
.to_vec()
.iter()
.map(|u| (u.username.clone(), u.to_owned()))
.collect(),
Copy link
Member

Choose a reason for hiding this comment

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

users.iter().cloned().collect()

fl-server/src/handlers.rs Show resolved Hide resolved
@rawdaGastan rawdaGastan merged commit 5262463 into master Oct 20, 2024
2 checks passed
@rawdaGastan rawdaGastan deleted the development_fl_server branch October 20, 2024 10:41
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