server

package
v0.0.0-...-1c77d03 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SocketAddress       string
	Version             string
	GitCommit           string
	RequestTimeout      time.Duration
	MaxConcurrentCommit int
	MaxConcurrentPush   int
	ContainerdNamespace string
	RuntimeOverride     string
	// AllowedUIDs restricts which Unix peer UIDs may invoke the agent.
	// Empty/nil means "allow everyone with access to the socket" (the
	// pre-existing behaviour).
	AllowedUIDs []uint32
	// Metrics, if non-nil, enables observation of RPC counts/latencies.
	Metrics *Registry
	// PushRetry overrides the runtime push retry policy. Zero values pick
	// sensible defaults inside operate.NewRuntime.
	PushRetry operate.RetryPolicy
}

Config drives runtime behaviour of the gRPC image server.

type ImageServer

type ImageServer struct {
	v1beta1.UnimplementedImageServiceServer
	// contains filtered or unexported fields
}

ImageServer is the gRPC handler implementing v1beta1.ImageServiceServer.

func New

func New(cfg Config) (*ImageServer, error)

New validates configuration and returns an ImageServer ready to start.

func (*ImageServer) CommitImage

CommitImage implements the gRPC method.

func (*ImageServer) PushImage

PushImage implements the gRPC method.

func (*ImageServer) StartRPCServer

func (s *ImageServer) StartRPCServer() (*grpc.Server, chan error)

StartRPCServer starts serving in a goroutine and returns the underlying *grpc.Server so callers can perform graceful shutdown. The error channel is closed when Serve returns.

func (*ImageServer) Version

Version implements the gRPC method.

type MetricsServer

type MetricsServer struct {
	Registry *Registry
	Address  string
	// contains filtered or unexported fields
}

MetricsServer wraps an http.Server hosting the registry. ListenAndServe returns nil if address is empty.

func (*MetricsServer) Shutdown

func (m *MetricsServer) Shutdown(ctx context.Context) error

Shutdown gracefully stops the metrics HTTP server.

func (*MetricsServer) Start

func (m *MetricsServer) Start() chan error

Start begins serving in the background. It returns an error channel which receives the eventual ListenAndServe error (one value, then closed).

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry is the metrics container exposed at /metrics.

func NewRegistry

func NewRegistry() *Registry

NewRegistry constructs an empty registry. The latency buckets are tuned for commit/push: from sub-second up to 30 minutes.

func (*Registry) AddCounter

func (r *Registry) AddCounter(name string, labels map[string]string, delta float64)

AddCounter atomically increments the named counter by `delta`.

func (*Registry) DecGauge

func (r *Registry) DecGauge(name string, labels map[string]string)

func (*Registry) HTTPHandler

func (r *Registry) HTTPHandler() http.Handler

HTTPHandler exposes the registry in Prometheus text exposition format.

func (*Registry) IncCounter

func (r *Registry) IncCounter(name string, labels map[string]string)

IncCounter atomically increments the named counter by 1.

func (*Registry) IncGauge

func (r *Registry) IncGauge(name string, labels map[string]string)

IncGauge / DecGauge bump an in-flight style gauge.

func (*Registry) ObserveSeconds

func (r *Registry) ObserveSeconds(name string, labels map[string]string, seconds float64)

ObserveSeconds records a duration into a histogram.

Jump to

Keyboard shortcuts

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