{"id":27206129,"url":"https://github.com/grayoj/gostore","last_synced_at":"2025-04-09T23:09:58.857Z","repository":{"id":241503408,"uuid":"629467177","full_name":"grayoj/gostore","owner":"grayoj","description":"Simple implementation of a distributed key-value store in Golang programming language.","archived":false,"fork":false,"pushed_at":"2023-05-16T18:34:21.000Z","size":1859,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T23:09:55.830Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grayoj.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-04-18T11:26:21.000Z","updated_at":"2023-05-16T18:35:30.000Z","dependencies_parsed_at":"2024-05-28T20:41:21.187Z","dependency_job_id":null,"html_url":"https://github.com/grayoj/gostore","commit_stats":null,"previous_names":["grayoj/gostore"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayoj%2Fgostore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayoj%2Fgostore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayoj%2Fgostore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayoj%2Fgostore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grayoj","download_url":"https://codeload.github.com/grayoj/gostore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125616,"owners_count":21051770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2025-04-09T23:09:58.374Z","updated_at":"2025-04-09T23:09:58.846Z","avatar_url":"https://github.com/grayoj.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Distributed Key-Value Store\n\nThis is a simple implementation of a distributed key-value store in Golang. It uses TCP sockets for communication between clients and a server.\n\n## Setup\n\nTo use the key-value store, follow these steps:\n\n1. Clone the repository\n2. Navigate to the project directory: cd gostore\n3. Build the project. Run `go build`\n4. Start the server: ./gostore\n5. Start up client: ./gostore\n\n*Notice*: The server will listen on a _random TCP port_. The client will connect to the server on localhost and the port that the server is listening on.\n\n## Using the Key-Value Store\n\nEnable permissions on your machine. `chmod +x gostore``\n\n1. Start the server.\n```bash\n./gostore\n```\n2. Send a set message to the server to set a key-value pair.\n```bash\n./gostore set key1 value1\n```\n3. To get the value of a key, send a `get` message.\n```bash\n./gostore get key1\n```\n\n## Functionality\n\nThis program (code) makes use of different types to facilitate its functionality. The `KeyValue` type is used to represent key-value pairs, while the ServerState type is used to store the server's internal state and ensure synchronization using a mutex. Additionally, the Server type is used to manage the server itself and includes several methods, such as handling client connections and processing \"get\" and \"set\" messages.\n\nThe `NewServer` function creates a new Server instance, sets it to listen for TCP connections on a random port, initializes the server's encoder and decoder, and then returns the created server. On the other hand, the `NewClient` function creates a new client, connects to the server using the provided address, and then returns an encoder and decoder for the connection.\n\nIn the main function, a new Server is created and started in a new goroutine. The program waits for the server to start listening for connections before creating a new client. The client then sends a \"set\" message to the server to store a key-value pair, followed by a \"get\" message to retrieve thevalue for that key. Finally, the program prints the server's response and stops the server.\n\n## Contributions\n\nFeel free to open a PR or make an issue!\n\n## References\n\n1. https://github.com/akritibhat/Distributed-Key-Value-Store-Go-Lang\n2. https://mrkaran.dev/posts/barreldb/\n3. https://github.com/geohot/minikeyvalue\n\n## License\n\nMIT License\n\nCopyright (c) 2023 Gerald Maduabuchi\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrayoj%2Fgostore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrayoj%2Fgostore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrayoj%2Fgostore/lists"}