Skip to content

Commit

Permalink
lesson15 start
Browse files Browse the repository at this point in the history
  • Loading branch information
alembiq committed Jun 26, 2024
1 parent 5d3bef5 commit b722279
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
[14](https://www.dropbox.com/scl/fi/u3dttgbaxgqdf8kh6fx3g/Lecture-14.MP4?rlkey=sbkut7t8m3xc45ppwsymv7zuj&st=xon10nni&dl=0&authuser=0)
[15](https://www.dropbox.com/scl/fi/qpdeda3kx646jnwaf8j1s/Lecture-15.MP4?rlkey=b4ng5msydqt5zpm3pz05lqmm7&st=edb0in9i&dl=0&authuser=0)
[16](https://www.dropbox.com/scl/fi/3hf3ystbijpvu57f48yua/Lecture-16.MP4?rlkey=qntbm0gmjrt5xr3hjom3drktl&st=t3t5gzuj&dl=0&authuser=0)
17 18 19 20
[17](https://www.dropbox.com/scl/fi/m182zj2hjvn95dckx3616/Lecture-17.MP4?rlkey=9k5f1qub18fkme81v6x1jzozk&st=pg3833ad&dl=0&authuser=0)
18 19 20

- **DevStreams**:
[1](https://www.dropbox.com/scl/fi/t7wfwubrl0361bjwxd5vx/DevStream-1.MP4?rlkey=4i319jzky1eqa3omcbpziuqum&st=t93zhcji&dl=0&authuser=0)
Expand Down
26 changes: 26 additions & 0 deletions lesson15/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
This assignment takes your client-server chat application to the next level by rewriting it to use the asynchronous paradigm with Tokio. Additionally, you'll start integrating a database to store chat and user data, marking a significant advancement in your application's complexity and functionality.
Description:

Asynchronous Rewriting Using Tokio:
Refactor both the client and server components of your application to work asynchronously, using Tokio as the foundation.
Ensure all I/O operations, network communications, and other latency-sensitive tasks are handled using Tokio's asynchronous capabilities.

Database Integration:
Choose a database framework like sqlx, diesel, or any other of your preference to integrate into the server for data persistence.
Design the database to store chat messages and user data effectively.

User Identification:
Implement a mechanism for clients to identify themselves to the server. This can range from a simple identifier to a more secure authentication process, depending on your preference and the complexity you wish to introduce.
Ensure that the identification process is seamlessly integrated into the asynchronous workflow of the client-server communication.

Security Considerations:
While focusing on the asynchronous model and database integration, keep in mind basic security practices for user identification and data storage.
Decide on the level of security you want to implement at this stage and ensure it is appropriately documented.

Refactoring for Asynchronous and Database Functionality:
Thoroughly test all functionalities to ensure they work as expected in the new asynchronous setup.
Ensure the server's interactions with the database are efficient and error-handled correctly.

Documentation and Comments:
Update your README.md to reflect the shift to asynchronous programming and the introduction of database functionality.
Document how to set up and run the modified application, especially any new requirements for the database setup.
16 changes: 16 additions & 0 deletions lesson16/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
For this week's task, we'll focus on enhancing your chat application with some essential practices in software development: adding documentation and tests. This assignment is more open-ended, allowing you to decide the extent and depth of documentation and testing based on your discretion and the application's needs.
Description:

Doc-Comments:
Add doc-comments to key functions and modules in your client and server code.
Focus on providing clear, concise descriptions that explain what each function or module does.
You don't need to document every function, but aim to cover the main ones, especially those that are complex or not immediately obvious.

Basic Testing:
Write a few tests for parts of your application. You can choose which aspects to test based on what you think is most crucial or interesting.
Consider including a couple of unit tests for individual functions or components and maybe an integration test if applicable.
Use Rust's built-in testing framework to add these tests to your project.

Flexibility in Testing:
There's no requirement for comprehensive test coverage for this assignment. Just a few tests to demonstrate your understanding of testing principles in Rust will suffice.
Feel free to explore and test parts of the application you're most curious about or consider most critical.
18 changes: 18 additions & 0 deletions lesson17/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
The next step in advancing your chat application is to develop a web frontend for the server. This web interface will provide functionalities like viewing all stored messages and managing user data. This task will deepen your understanding of web frameworks in Rust and their integration with asynchronous back-end systems.
Description:

Web Frontend Development:
Create a web frontend for your server application. This interface should allow users to view all messages stored on the server. Consider implementing a feature to filter messages by user.

User and Message Management:
The web frontend should provide functionality to delete users and all associated messages. This adds an important aspect of user and data management to your application.

Choosing a Web Framework:
Select a web framework for your frontend. You can choose from options like Axum, Rocket, actix-web, or warp.
Given that your chat application is asynchronous, using an async-compatible web framework (like Axum or actix-web) might simplify integration.

Integration with the Backend:
Ensure that the frontend seamlessly interacts with your existing asynchronous server backend. The frontend should effectively display data from and send requests to the server.

Interface Design:
Design the user interface to be intuitive and user-friendly. While sophisticated UI design isn't the focus, aim for a clean and navigable layout. Considering this course is not about nice web design, it can be as plain visually as you want, you don't need to be a CSS expert :)
22 changes: 22 additions & 0 deletions lesson18/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
In this assignment, you will add monitoring capabilities to the server part of your chat application using Prometheus. Monitoring is a crucial aspect of maintaining and understanding the health and performance of applications, especially in production environments.
Description:

Integrate Prometheus:
Add Prometheus to your chat application's server.
Ensure that Prometheus is set up correctly to gather metrics from your server.

Metrics Implementation:
Implement at least one metric using Prometheus. At a minimum, add a counter to track the number of messages sent through your server.
Optionally, consider adding a gauge to monitor the number of active connections to your server. This can provide insights into user engagement and server load.

Metrics Endpoint:
Set up an endpoint within your server application to expose these metrics to Prometheus. This typically involves creating a /metrics endpoint.
Ensure that the endpoint correctly exposes the metrics in a format that Prometheus can scrape.

Typically, this means using the TextEncoder: https://docs.rs/prometheus/0.13.3/prometheus/struct.TextEncoder.html

You can refer to the Hyper example: https://github.com/tikv/rust-prometheus/blob/master/examples/example_hyper.rs

Documentation and Testing:
Document the new metrics feature in your README.md, including how to access the metrics endpoint and interpret the exposed data.
Test to make sure that the metrics are accurately recorded and exposed. Verify that Prometheus can successfully scrape these metrics from your server.

0 comments on commit b722279

Please sign in to comment.