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

Reimplement server.rs with warp #20

Merged
merged 12 commits into from
Nov 13, 2019
Merged

Reimplement server.rs with warp #20

merged 12 commits into from
Nov 13, 2019

Conversation

shuni64
Copy link
Contributor

@shuni64 shuni64 commented Nov 11, 2019

This should make Lucid significantly faster than when using nickel. The results are pretty impressive, so I guess warp lives up to it's name.
Warp:
image
Nickel:
image

It should also make it easier to implement WebSocket or SSE later because warp has built-in support for both.
The API changes very slightly (PUT requests to /api/kv are required to have a Content-Length header), but this should allow warp to reject big requests immediately instead of waiting for them to arrive and is trivial to implement for clients.

This is just a proposal though, and there's still some work to be done to reach parity with the current implementation.

@imclint21 imclint21 added core Core development enhancement New feature or request labels Nov 12, 2019
@imclint21
Copy link
Member

imclint21 commented Nov 12, 2019

Hey,

Impressive, I think we will opt for warp, it's an excellent idea.

The limit of object length with filters::body::content_length_limit(self.configuration.store.max_limit) is brilliant and I think adding Content-Length header is not a problem.

If SSE (or WebSocket) integration can be facilitated it's good, also I found your code lighter and cleaner.

Very nice

@imclint21 imclint21 marked this pull request as ready for review November 12, 2019 02:21
@imclint21 imclint21 mentioned this pull request Nov 12, 2019
24 tasks
@shuni64
Copy link
Contributor Author

shuni64 commented Nov 12, 2019

This should be done now, please let me know if anything is missing/wrong.
The request size limit is now separate from the value size limit, and the request size limit is applied to all api requests.

There's still more to be done for logging (almost no logging right now), but I'm likely going to do that in another PR because it requires migrating to the log crate.

@shuni64 shuni64 requested a review from imclint21 November 12, 2019 23:21
Copy link
Member

@imclint21 imclint21 left a comment

Choose a reason for hiding this comment

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

Hey,

Awesome job, I approved your modifications, and I will merge it into a new branch named warp-migration.

PS: and yes for the logging we need to refactor some stuff.

Thank you

pub bind_address: String,
pub port: i32,
pub port_ssl: i32,
pub bind_address: IpAddr,
Copy link
Member

Choose a reason for hiding this comment

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

You changed the type of bind_address, is it not a problem for the YAML configuration file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Serde implements Deserialize for IpAddr, and it seems like it just uses the appropriate from_str function internally (or at least it parses the previous configuration correctly).

Copy link
Member

Choose a reason for hiding this comment

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

Okey great

@imclint21 imclint21 changed the base branch from development to warp-migration November 13, 2019 01:16
store: Arc<RwLock<KvStore>>,
configuration: Configuration
}
let auth = warp::header::optional::<String>("authorization")
Copy link
Member

Choose a reason for hiding this comment

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

Could you enable JWT authentication only if it's enabled in the configuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it should be easy to add a check if it's enabled in verify_auth and accept all requests if it's not.

@imclint21
Copy link
Member

Very good work, I merge it 👌

@imclint21 imclint21 merged commit 6439a95 into lucid-kv:warp-migration Nov 13, 2019
@imclint21 imclint21 mentioned this pull request Nov 13, 2019
@shuni64 shuni64 deleted the warp branch November 13, 2019 15:24
@imclint21
Copy link
Member

@CephalonRho If you need to continue your implementation, feel free to use the new warp-migration branch!

@imclint21
Copy link
Member

@CephalonRho think also make a gracefully exit for ctrl-C with warp!

error: process didn't exit successfully: `target\debug\lucid.exe server` (exit code: 0xc000013a, STATUS_CONTROL_C_EXIT)

@imclint21
Copy link
Member

Closed #18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core development enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants