clientpolicyx

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package clientpolicyx defines outbound microservice call governance.

Server access policy answers: "who may call this RPC?" Downstream policy answers: "how does this service call that downstream safely?" Business code must use Kernel client factories/autowire so timeout, identity propagation, rate limiting, retry, circuit breaker and errorx decoding stay consistent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CircuitBreakerPolicy

type CircuitBreakerPolicy struct {
	Enabled bool
	Name    string
}

CircuitBreakerPolicy controls outbound breaker behavior.

type Deployment

type Deployment struct {
	Replicas int
}

Deployment describes topology used for validation.

type DownstreamPolicy

type DownstreamPolicy struct {
	Name           string
	Protocol       Protocol
	Target         string
	Timeout        time.Duration
	RateLimit      ratelimitx.Policy
	CircuitBreaker CircuitBreakerPolicy
	Retry          RetryPolicy
	ServiceAuth    ServiceAuthPolicy
}

DownstreamPolicy is the caller-side contract for one downstream dependency.

func (DownstreamPolicy) Normalize

func (p DownstreamPolicy) Normalize() DownstreamPolicy

Normalize fills safe defaults.

func (DownstreamPolicy) Validate

func (p DownstreamPolicy) Validate(deploy Deployment) error

Validate checks policy semantics and topology-sensitive constraints.

type Protocol

type Protocol string

Protocol is the downstream transport.

const (
	ProtocolGRPC Protocol = "grpc"
	ProtocolHTTP Protocol = "http"
)

type RetryPolicy

type RetryPolicy struct {
	Enabled     bool
	MaxAttempts int
	Backoff     time.Duration
}

RetryPolicy controls client retries. Only retryable errorx errors or explicit transient transport failures should be retried by runtime middleware.

func (RetryPolicy) Normalize

func (p RetryPolicy) Normalize() RetryPolicy

type ServiceAuthPolicy

type ServiceAuthPolicy struct {
	Enabled bool
	Mode    string // jwt, mtls, spiffe, mesh
}

ServiceAuthPolicy controls service-to-service identity.

Jump to

Keyboard shortcuts

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