complete rewrite to grpc

This commit is contained in:
matst80
2025-10-10 06:45:23 +00:00
parent f735540c3d
commit 4c973b239f
31 changed files with 3080 additions and 1816 deletions

View File

@@ -6,7 +6,7 @@ A distributed cart management system using the actor model pattern.
- Go 1.24.2+
- Protocol Buffers compiler (`protoc`)
- protoc-gen-go plugin
- protoc-gen-go and protoc-gen-go-grpc plugins
### Installing Protocol Buffers
@@ -32,17 +32,20 @@ sudo apt install protobuf-compiler
```bash
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
```
## Working with Protocol Buffers
### Generating Go code from proto files
After modifying `proto/messages.proto`, regenerate the Go code:
After modifying any proto (`proto/messages.proto`, `proto/cart_actor.proto`, `proto/control_plane.proto`), regenerate the Go code (all three share the unified `messages` package):
```bash
cd proto
protoc --go_out=. --go_opt=paths=source_relative messages.proto
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
messages.proto cart_actor.proto control_plane.proto
```
### Protocol Buffer Messages
@@ -75,6 +78,6 @@ go test ./...
## Important Notes
- Always regenerate protobuf Go code after modifying `.proto` files
- Always regenerate protobuf Go code after modifying any `.proto` files (messages/cart_actor/control_plane)
- The generated `messages.pb.go` file should not be edited manually
- Make sure your PATH includes the protoc-gen-go binary location (usually `$GOPATH/bin`)