Repository navigation
Reorganize project structure, packaging, and CI - #8
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70eea7c8cb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| t.messagesChannel <- data | ||
| result := <-t.resultChannel |
There was a problem hiding this comment.
Pair each insert result with its producer
When concurrent Produce RPCs target the same topic, each caller sends through messagesChannel but then reads from the same shared resultChannel. If the worker accepts the second message before the first caller receives its result, the second caller can consume the first insert's addResult, causing acknowledgements to return another producer's offset. Use a per-request response channel or otherwise serialize each send/result pair.
Useful? React with 👍 / 👎.
Moving the server under internal/ (#7) left other Go modules with no way to run SMQ inside their own process. Add a public embedded package that opens the SQLite store directly, with no listener. It provides an idempotent CreateTopic, Publish and an atomic PublishBatch that return offsets, Read from an offset bounded by count and bytes, Earliest and Latest offsets, DeleteUntilOffset, per-topic Stats, and Close. An optional RegisterGRPC serves the existing SMQ API from the same store on a caller-owned grpc.Server. The package reuses the internal SQLite store, which gains: - AddMessages, ReadMessages, TopicStats and Topics. - Open with options. WAL, synchronous, auto_vacuum and busy_timeout are now set through the DSN, so they apply to every pooled connection. Previously they applied to one. Private in-memory databases are pinned to a single connection. - A fix for concurrent producers receiving each other's offsets. The per-topic writer goroutine shared one result channel; on the base branch, 258 of 3,200 concurrent AddMessage calls got the wrong offset. Inserts now run directly under the existing write lock. - ErrStoreClosed for operations after Close, instead of a send on a closed channel. The gRPC transport maps it to UNAVAILABLE. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
8b25d93 to
e552580
Compare
Summary
srclayout with deterministic generated bindings, corrected streaming behavior, tested packaging, and independent release versioningCompatibility
smqprotobuf wire package and field numbers are unchangedgithub.com/Suhaibinator/SuhaibMessageQueue/protoremains available through deprecated aliasesvX.Y.Z; Python releases usepysmq-vX.Y.ZValidation
go vet ./...go test -race -shuffle=on ./...go build -trimpath ./cmd/smqtwine check