server

package
v0.30.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HandlerAckDone is set when handler has been acknowledged of snapshotter termination.
	HandlerAckDone uint32 = 0
	// HandlerAckWaiting is set when handler starts waiting of snapshotter termination.
	HandlerAckWaiting uint32 = 1
)

Variables

This section is empty.

Functions

func IsBackupRestoreHealthy added in v0.29.0

func IsBackupRestoreHealthy(backupRestoreURL string, TLSEnabled bool, rootCA string) (bool, error)

IsBackupRestoreHealthy checks the whether the backup-restore of given backup-restore URL healthy or not.

Types

type BackupRestoreComponentConfig added in v0.29.0

type BackupRestoreComponentConfig struct {
	EtcdConnectionConfig     *brtypes.EtcdConnectionConfig     `json:"etcdConnectionConfig,omitempty"`
	ServerConfig             *HTTPServerConfig                 `json:"serverConfig,omitempty"`
	SnapshotterConfig        *brtypes.SnapshotterConfig        `json:"snapshotterConfig,omitempty"`
	SnapstoreConfig          *brtypes.SnapstoreConfig          `json:"snapstoreConfig,omitempty"`
	CompressionConfig        *compressor.CompressionConfig     `json:"compressionConfig,omitempty"`
	RestorationConfig        *brtypes.RestorationConfig        `json:"restorationConfig,omitempty"`
	DefragmentationSchedule  string                            `json:"defragmentationSchedule"`
	HealthConfig             *brtypes.HealthConfig             `json:"healthConfig,omitempty"`
	LeaderElectionConfig     *brtypes.Config                   `json:"leaderElectionConfig,omitempty"`
	ExponentialBackoffConfig *brtypes.ExponentialBackoffConfig `json:"exponentialBackoffConfig,omitempty"`
	UseEtcdWrapper           bool                              `json:"useEtcdWrapper,omitempty"`
}

BackupRestoreComponentConfig holds the component configuration.

func NewBackupRestoreComponentConfig added in v0.29.0

func NewBackupRestoreComponentConfig() *BackupRestoreComponentConfig

NewBackupRestoreComponentConfig returns the backup-restore componenet config.

func (*BackupRestoreComponentConfig) AddFlags added in v0.29.0

func (c *BackupRestoreComponentConfig) AddFlags(fs *flag.FlagSet)

AddFlags adds the flags to flagset.

func (*BackupRestoreComponentConfig) Complete added in v0.29.0

func (c *BackupRestoreComponentConfig) Complete()

Complete completes the config.

func (*BackupRestoreComponentConfig) Validate added in v0.29.0

func (c *BackupRestoreComponentConfig) Validate() error

Validate validates the config.

type BackupRestoreServer added in v0.29.0

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

BackupRestoreServer holds the details for backup-restore server.

func NewBackupRestoreServer added in v0.29.0

func NewBackupRestoreServer(logger *logrus.Logger, config *BackupRestoreComponentConfig) (*BackupRestoreServer, error)

NewBackupRestoreServer return new backup restore server.

func (*BackupRestoreServer) Run added in v0.29.0

Run starts the backup restore server.

type HTTPHandler

type HTTPHandler struct {
	Initializer          initializer.Initializer
	Snapshotter          *snapshotter.Snapshotter
	EtcdConnectionConfig *brtypes.EtcdConnectionConfig
	StorageProvider      string
	Port                 uint

	Logger *logrus.Entry

	AckState uint32

	StopCh            chan struct{}
	EnableProfiling   bool
	ReqCh             chan struct{}
	AckCh             chan struct{}
	EnableTLS         bool
	ServerTLSCertFile string
	ServerTLSKeyFile  string
	HTTPHandlerMutex  *sync.Mutex
	SnapstoreConfig   *brtypes.SnapstoreConfig
	// contains filtered or unexported fields
}

HTTPHandler is implementation to handle HTTP API exposed by server

func (*HTTPHandler) GetClusterState added in v0.29.0

func (h *HTTPHandler) GetClusterState(ctx context.Context, clusterSize int, client client.Client, podName string, podNS string) (string, error)

GetClusterState returns the Cluster state either `new` or `existing`.

func (*HTTPHandler) GetStatus added in v0.7.0

func (h *HTTPHandler) GetStatus() int

GetStatus returns the current status in the HTTPHandler

func (*HTTPHandler) RegisterHandler

func (h *HTTPHandler) RegisterHandler()

RegisterHandler registers the handler for different requests

func (*HTTPHandler) SetSnapshotter added in v0.29.0

func (h *HTTPHandler) SetSnapshotter(ssr *snapshotter.Snapshotter)

SetSnapshotter sets the current HTTPHandler.Snapshotter in the HTTPHandler.

func (*HTTPHandler) SetSnapshotterToNil added in v0.29.0

func (h *HTTPHandler) SetSnapshotterToNil()

SetSnapshotterToNil sets the current HTTPHandler.Snapshotter to Nil in the HTTPHandler.

func (*HTTPHandler) SetStatus added in v0.7.0

func (h *HTTPHandler) SetStatus(status int)

SetStatus sets the current status in the HTTPHandler

func (*HTTPHandler) Start

func (h *HTTPHandler) Start()

Start starts the http server to listen for request

func (*HTTPHandler) Stop

func (h *HTTPHandler) Stop() error

Stop stops the http server

type HTTPServerConfig added in v0.29.0

type HTTPServerConfig struct {
	Port            uint   `json:"port,omitempty"`
	EnableProfiling bool   `json:"enableProfiling,omitempty"`
	TLSCertFile     string `json:"server-cert,omitempty"`
	TLSKeyFile      string `json:"server-key,omitempty"`
}

HTTPServerConfig holds the server config.

func NewHTTPServerConfig added in v0.29.0

func NewHTTPServerConfig() *HTTPServerConfig

NewHTTPServerConfig returns the config for http server

func (*HTTPServerConfig) AddFlags added in v0.29.0

func (c *HTTPServerConfig) AddFlags(fs *flag.FlagSet)

AddFlags adds the flags to flagset.

func (*HTTPServerConfig) Validate added in v0.29.0

func (c *HTTPServerConfig) Validate() error

Validate validates the config.E

type HandlerAckState

type HandlerAckState int32

HandlerAckState denotes the state the handler would be in after sending a stop request to the snapshotter.

type HandlerRequest

type HandlerRequest int

HandlerRequest represents the type of request handler makes to the snapshotter.

const (
	// HandlerSsrAbort is the HandlerRequest to the snapshotter to terminate the snapshot process.
	HandlerSsrAbort HandlerRequest = 0
)

Jump to

Keyboard shortcuts

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