{"id":16688039,"url":"https://github.com/simlay/line-server-exercise","last_synced_at":"2026-04-27T09:31:02.895Z","repository":{"id":172065290,"uuid":"648801754","full_name":"simlay/line-server-exercise","owner":"simlay","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-17T05:37:23.000Z","size":178,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-29T04:18:29.142Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simlay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-02T21:11:35.000Z","updated_at":"2024-06-28T23:10:46.000Z","dependencies_parsed_at":"2023-07-03T17:16:06.965Z","dependency_job_id":"b2b34c35-cd7e-408a-afe7-646f5549bfc8","html_url":"https://github.com/simlay/line-server-exercise","commit_stats":null,"previous_names":["simlay/line-server-exercise"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/simlay/line-server-exercise","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simlay%2Fline-server-exercise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simlay%2Fline-server-exercise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simlay%2Fline-server-exercise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simlay%2Fline-server-exercise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simlay","download_url":"https://codeload.github.com/simlay/line-server-exercise/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simlay%2Fline-server-exercise/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32331305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T15:26:35.676Z","updated_at":"2026-04-27T09:31:02.859Z","avatar_url":"https://github.com/simlay.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![codecov](https://codecov.io/gh/simlay/line-server-exercise/branch/main/graph/badge.svg?token=J4Z0HON7UV)](https://codecov.io/gh/simlay/line-server-exercise)\n[![Security Audit](https://github.com/simlay/line-server-exercise/actions/workflows/security-audit.yml/badge.svg)](https://github.com/simlay/line-server-exercise/actions/workflows/security-audit.yml)\n[![CI](https://github.com/simlay/line-server-exercise/actions/workflows/ci.yml/badge.svg)](https://github.com/simlay/line-server-exercise/actions/workflows/ci.yml)\n\n# Intro\n\nSee [PROPMT.md](./PROMPT.md) for the exact description of this exercise.\n\n# Additions\n\n* The Specification said that any error should return `ERR\\r\\n`. I felt that\nthis was not descriptive enough and so the responses for Errors are more human\nreadable.\n    - In the event of an known command, `Err - THIS_COMMAND_DOES_NOT_EXIST is an invalid command. \\`GET nnnn | QUIT | SHUTDOWN\\` are valid commands.\\r\\n`\n    - In the event that the `GET nnnn` command is out of bounds for the number of lines in the input text, something like `Err - failed to retrieve line 1000. There are only 4 lines available.\\r\\n`\n    - In the event that the `GET nnnn` has an unparsible `usize` digit or is not a digit something like `Err - invalid digit found in string. Is AOEU an unsigned integer or under usize::MAX?\\r\\n` will be returned.\n\n# Requirements\nTo run this you'll need [the rust\ntoolchain](https://www.rust-lang.org/tools/install) and either `socat` (my\nrecommendation), `netcat` or maybe `telnet`.\n\n# Usage\n\nIn one terminal run:\n```bash\ncargo run -- --line-file ./example.txt\n```\n\nIn another terminal run:\n```bash\nsocat STDIO TCP4:localhost:10497\n```\n\nIn the 2nd terminal type on of:\n* `GET 1`\n* `QUIT`\n* `SHUTDOWN`\n\n# Questions and Answers\nQ: How does your system work? (if not addressed in comments in source)\n* This system reads in a file line by line, then shares that `Vec\u003cString\u003e`\nacross multiple tokio green threeds for each local connection\n\nQ: How will your system perform as the number of requests per second increases?\n* Right now this is system uses the default tokio thread setup. This should\nscale well with new clients and requests per second.\n\nQ: How will your system perform with a 1 GB file? a 100 GB file? a 1,000 GB file?\n* This system was not designed to optimize for a reduced memory footprint. It\nwas designed to handle many clients simultaneously.\n\nQ: What documentation, websites, papers, etc did you consult in doing this assignment?\n* [`tokio::select`](https://tokio.rs/tokio/tutorial/select) and other tokio objects.\n\nQ: What third-party libraries or other tools does the system use?\n* [tokio](https://crates.io/crates/tokio)\n* [log](https://crates.io/crates/log)\n* [env_logger](https://crates.io/crates/env_logger)\n* [anyhow](https://crates.io/crates/anyhow)\n* [clap](https://crates.io/crates/clap)\n* [pretty_assertions](https://crates.io/crates/pretty_assertions)\n\nQ: How long did you spend on this exercise?\n* ~3 hours.\n\n\n# Future work\n\nGiven that this is purely an exercise, I elected not to build out too many\nfeatures. I played around with using\n[criterion](https://bheisler.github.io/criterion.rs/book/getting_started.html)\nto use of `cargo bench` but found the tooling a bit more complicated than I\nwanted for this project.\n\nThis application looks to just be using one core. There is a\n`one_hundred_clients` test where there are 100 clients requesting 400 lines of\na `40000` line file with little addition to CI runtime.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimlay%2Fline-server-exercise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimlay%2Fline-server-exercise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimlay%2Fline-server-exercise/lists"}