Add HTTP REST API, multi-connection support, tests, CI, and lint - #2
Merged
Conversation
- Add HTTP REST API on :8080 (api.go) alongside RESP on :6379
- KV CRUD: PUT/GET/DELETE /kv/{key}, INCR/DECR/INCRBY/DECRBY/APPEND
- List: PUT/GET/POST /list/{key} with push/range/pop
- Hash: PUT/GET/DELETE /hash/{key}/{field}, GET /hash/{key}
- GET /ping for health check
- AOF write-through for all mutating commands
- Fix single-connection bug: main.go now accepts multiple concurrent
TCP connections via accept loop with goroutines
- Add HDEL command to stdhash (was missing from Handlers map)
- Add comprehensive unit tests (49 tests total):
- handler_test.go: string commands, wrong args, concurrent SET
- stdhash_test.go: HSET/HGET/HGETALL/HDEL
- hashes_test.go: cuckoo hash CHSET/CHGET/CHGETALL/CHDEL, resize
- resp_test.go: marshal/unmarshal, round-trip, writer
- api_test.go: HTTP REST endpoints for all operations
- Add GitHub Actions CI (.github/workflows/ci.yml):
build, vet, test -race, golangci-lint
- Add .golangci.yml with 13 linters enabled
- Fix lint issues: unused Value.num field, unchecked errors in
RESP reader, comment formatting, increment style, nil check
around range, SA4008 in cuckoo hash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan