Documentation
¶
Overview ¶
Package wrapper is a count-core-shaped example showing how to expose Murmur counter pipelines through your application's OWN typed Connect-RPC service rather than the generic Value{bytes} shape.
Pattern (the count-core integration plan from the review thread):
- Murmur pipelines do the aggregation. Their query layer is a generic `QueryService.Get/GetMany/GetWindow → Value{bytes}`.
- Your application defines its OWN proto with typed responses (e.g. count-core's `BotInteractionCountService.GetBotInteractionCount(...)` returning `int64`).
- The application's server implementation is a thin wrapper: it takes the typed request, calls the underlying Murmur QueryService via `pkg/query/typed`, and returns a typed response. No bytes-decoding boilerplate; no leakage of Murmur's wire shape into the application's API.
This file shows that wrapper for a fictional "BotInteractionCount" service. Real count-core code would substitute its own proto definition; the structure is the same.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BotInteractionRequest ¶
BotInteractionRequest is what the application's protobuf would define — here in Go for example purposes. Real code would use the generated proto types.
type BotInteractionResponse ¶
BotInteractionResponse is the typed response shape — no Value{bytes}, no decoder boilerplate at the call site.
type BotInteractionService ¶
type BotInteractionService interface {
GetBotInteractionCount(ctx context.Context, req *BotInteractionRequest) (*BotInteractionResponse, error)
GetBotInteractionCountWindow(ctx context.Context, req *BotInteractionWindowRequest) (*BotInteractionResponse, error)
}
BotInteractionService is the application's typed Connect-RPC server shape (here as a Go interface for illustration). Real code would use a generated `connect.UnaryHandlerFunc` or the connect-go server stub.
type BotInteractionWindowRequest ¶
BotInteractionWindowRequest carries the windowed-query inputs.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the count-core-shaped wrapper. It holds two typed Murmur clients — one for the all-time counter, one for the windowed counter — and exposes the application's typed RPC surface on top of them.
In production, count-core's BotInteractionService server would embed this struct (or one with more fields for per-counter pipelines) and serve it via `connect.NewBotInteractionServiceHandler`.
func NewServer ¶
func NewServer(likes, windowed murmurv1connect.QueryServiceClient) *Server
NewServer constructs the wrapper given the two underlying Murmur QueryService clients. In production you'd wire each client to its own gRPC endpoint (one Murmur worker per pipeline).
func (*Server) GetBotInteractionCount ¶
func (s *Server) GetBotInteractionCount(ctx context.Context, req *BotInteractionRequest) (*BotInteractionResponse, error)
GetBotInteractionCount returns the all-time interaction count for a (bot, user) pair. The server-side wire shape is just this typed shape; Murmur's bytes layer is hidden from the caller.
func (*Server) GetBotInteractionCountWindow ¶
func (s *Server) GetBotInteractionCountWindow(ctx context.Context, req *BotInteractionWindowRequest) (*BotInteractionResponse, error)
GetBotInteractionCountWindow returns the count over the last `duration` for a (bot, user) pair. Wraps the underlying Murmur GetWindow call with the typed shape.