server

package
v1.1.0-beta.0...-dd8df1a Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ServerMaxProcsGauge records the maxprocs.
	ServerMaxProcsGauge = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: "pd",
			Subsystem: "service",
			Name:      "maxprocs",
			Help:      "The value of GOMAXPROCS.",
		})

	// ServerMemoryLimit records the cgroup memory limit.
	ServerMemoryLimit = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: "pd",
			Subsystem: "service",
			Name:      "memory_quota_bytes",
			Help:      "The value of memory quota bytes.",
		})

	// ServerInfoGauge indicates the pd server info including version and git hash.
	ServerInfoGauge = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: "pd",
			Subsystem: "server",
			Name:      "info",
			Help:      "Indicate the pd server info, and the value is the start timestamp (s).",
		}, []string{"version", "hash"})
)

Functions

This section is empty.

Types

type Server

type Server interface {
	// Name returns the unique name for this server in the cluster.
	Name() string
	// GetAddr returns the address of the server.
	GetAddr() string
	// Context returns the context of server.
	Context() context.Context
	// Run runs the server.
	Run() error
	// Close closes the server.
	Close()
	// GetLeaderListenUrls gets service endpoints from the leader in election group.
	GetLeaderListenUrls() []string
	// GetClient returns builtin etcd client.
	GetClient() *clientv3.Client
	// GetHTTPClient returns builtin http client.
	GetHTTPClient() *http.Client
	// AddStartCallback adds a callback in the startServer phase.
	AddStartCallback(callbacks ...func())
	// IsServing returns whether the server is the leader, if there is embedded etcd, or the primary otherwise.
	IsServing() bool
	// AddServiceReadyCallback adds callbacks when the server becomes the leader, if there is embedded etcd, or the primary otherwise.
	AddServiceReadyCallback(callbacks ...func(context.Context) error)
}

Server defines the common basic behaviors of a server

Jump to

Keyboard shortcuts

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