Help us shape the future of Go! Take the 2026 Go Developer Survey

grpcfixture

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package grpcfixture is the service the gRPC binding's integration tests run: a notes service served on a transport gRPC server behind the transport's auth interceptor and a transit logging interceptor, and the same implementation's unary methods bound as MCP operations behind the estate HTTP chain, under one controls controller. Tests call it both ways and compare (spec 0002 D10). It is evidence, not an example to copy.

Index

Constants

View Source
const (
	ReaderKey   = "reader-key"
	EditorKey   = "editor-key"
	KeyHeader   = "X-API-Key"
	KeyMetadata = "x-api-key"
	Path        = "/mcp"
)

The API keys both edges accept, and where each edge reads them.

Variables

This section is empty.

Functions

func Authorize

func Authorize(ctx context.Context, identity *authn.Identity) bool

Authorize is the one predicate both edges apply: anyone verified may list and wait, only the editor may add.

Types

type Options

type Options struct {
	Logger         *slog.Logger
	ShutdownBudget time.Duration
	// WaitTimeout is the bound Wait method's budget; zero keeps the default.
	WaitTimeout time.Duration
}

Options configure one service instance.

type Service

type Service struct {
	Controller *controls.Controller
	MCP        *server.Server
	GRPC       transportgrpc.ServerSettings
	HTTPAddr   string
	Entered    chan struct{}
	Deadlines  chan time.Duration
	Ended      chan error
	// contains filtered or unexported fields
}

Service is one running instance: the gRPC server's settings for a direct dial, the HTTP address for MCP, and channels that observe each Wait call from outside.

func Start

func Start(ctx context.Context, opts Options) (*Service, error)

Start builds and runs the service, returning once both listeners accept.

func (*Service) Dial

func (s *Service) Dial(opts ...googlegrpc.DialOption) (*googlegrpc.ClientConn, error)

Dial connects a client to the gRPC server directly, as a service's own caller would.

func (*Service) Stop

func (s *Service) Stop(ctx context.Context) error

Stop drives the controller's graceful shutdown and waits within ctx.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL