connect

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidationError added in v0.3.2

func IsValidationError(err error) bool

IsValidationError reports whether err — or anything in its wrap chain — originated from NewValidationError.

func New

func New(
	log *slog.Logger,
	core provider,
	domain string,
	opts ...connect.HandlerOption,
) *http.ServeMux

New creates and returns gRPC server. Commit-resolution enhancements (pre-warm, sha probe) are disabled; production should use NewWithConfig to enable them.

func NewLoggingInterceptor added in v0.3.2

func NewLoggingInterceptor(log *slog.Logger) connect.Option

NewLoggingInterceptor returns a connect.Option that wraps unary handlers with structured request/response logging at debug level.

func NewValidationError added in v0.3.2

func NewValidationError(format string, args ...any) error

NewValidationError formats and returns a validation error. Use this anywhere the client sent input we cannot accept; the connect-go handler will surface it as CodeInvalidArgument (HTTP 400) with the formatted message as detail.

func NewWithConfig added in v0.3.6

func NewWithConfig(
	log *slog.Logger,
	core provider,
	domain string,
	cfg CommitResolution,
	opts ...connect.HandlerOption,
) *http.ServeMux

NewWithConfig is like New but enables commit-resolution enhancements per cfg. ProbeEnabled turns on the upstream sha probe for Download cache misses.

func RequestIDFrom added in v0.3.2

func RequestIDFrom(ctx context.Context) string

RequestIDFrom extracts the request ID from context, returning empty string if absent.

func WithRequestID added in v0.3.2

func WithRequestID(ctx context.Context, id string) context.Context

WithRequestID stores a request ID in the context for log correlation. Thin wrapper over internal/reqid so callers depending on this package do not have to import the reqid package directly.

Types

type CommitResolution added in v0.3.6

type CommitResolution struct {
	ProbeEnabled     bool
	ProbeNegativeTTL time.Duration
	ProbeTimeout     time.Duration
}

CommitResolution configures the buf v1 commit-id resolution enhancements in commitServiceHandler: the upstream sha probe used on a Download cache miss. It is the connect-package mirror of the user-facing connect config — kept here (not imported from cmd/easyp/internal/config) to avoid an internal→cmd layering violation. A zero value disables the enhancement (the historical behavior), so callers that construct the mux via New (tests) are unaffected; production threads it via NewWithConfig.

Jump to

Keyboard shortcuts

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