server

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

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GCWorkerVersion = "None"
)

The version info is set in Makefile

Functions

func LogGCWorkerInfo

func LogGCWorkerInfo()

LogGCWorkerInfo prints the GC-Worker version information.

func PrintGCWorkerInfo

func PrintGCWorkerInfo()

PrintGCWorkerInfo prints the GC-Worker version information without log info.

Types

type Config

type Config struct {
	Name string `toml:"name" json:"name"`

	Version bool `json:"-"`

	PdAddrs      string `toml:"pd" json:"pd"`
	EtcdEndpoint string `toml:"etcd" json:"etcd"`

	SafePointUpdateInterval typeutil.Duration `toml:"safepoint-update-interval" json:"safepoint-update-interval"`
	EtcdElectionInterval    typeutil.Duration `toml:"etcd-election-interval" json:"etcd-election-interval"`
	GCLifeTime              typeutil.Duration `toml:"gc-life-time" json:"gc-life-time"`
	TLSConfig               TLSConfig         `toml:"security" json:"security"`

	// Log related config.
	Log log.Config `toml:"log" json:"log"`
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig() *Config

NewConfig creates a new config.

func (*Config) Adjust

func (c *Config) Adjust() error

Adjust is used to adjust the configurations.

func (*Config) GetConfigFile

func (c *Config) GetConfigFile() string

GetConfigFile gets the config file.

func (*Config) GetZapLogProperties

func (c *Config) GetZapLogProperties() *log.ZapProperties

GetZapLogProperties gets properties of the zap logger.

func (*Config) GetZapLogger

func (c *Config) GetZapLogger() *zap.Logger

GetZapLogger gets the created zap logger.

func (*Config) Parse

func (c *Config) Parse(arguments []string) error

Parse parses flag definitions from the argument list.

func (*Config) SetupLogger

func (c *Config) SetupLogger() error

SetupLogger setup the logger.

func (*Config) Validate

func (c *Config) Validate() error

Validate is used to validate if some configurations are right.

type Server

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

func CreateServer

func CreateServer(ctx context.Context, cfg *Config) (*Server, error)

CreateServer creates the UNINITIALIZED pd server with given configuration.

func (*Server) Close

func (s *Server) Close()

Close closes the server.

func (*Server) GetServerName

func (s *Server) GetServerName() string

func (*Server) IsLead

func (s *Server) IsLead() bool

func (*Server) IsServing

func (s *Server) IsServing() bool

checks whether server is closed or not.

func (*Server) StartServer

func (s *Server) StartServer()

type TLSConfig

type TLSConfig struct {
	CA   string `json:"ca" toml:"ca"`
	Cert string `json:"cert" toml:"cert"`
	Key  string `json:"key" toml:"key"`
}

func (*TLSConfig) ToTLSConfig

func (tls *TLSConfig) ToTLSConfig() (*tls.Config, error)

ToTLSConfig generate tls.Config.

Jump to

Keyboard shortcuts

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