healthcheck

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version = "0.5.0"
)

Variables

View Source
var ErrNoReplsetConfigStr string = "(NotYetInitialized) no replset config has been received"

OkMemberStates is a slice of acceptable replication member states

Functions

func CheckState added in v1.10.0

func CheckState(rs ReplSetStatus, startupDelaySeconds int64, oplogSize int64) error

func HealthCheckMongodLiveness

func HealthCheckMongodLiveness(ctx context.Context, cnf *db.Config, startupDelaySeconds int64) (_ *mongo.MemberState, err error)

func HealthCheckMongosLiveness

func HealthCheckMongosLiveness(ctx context.Context, cnf *db.Config) (err error)

func MongodReadinessCheck added in v1.15.0

func MongodReadinessCheck(ctx context.Context, addr string) error

ReadinessCheck runs a ping on a pmgo.SessionManager to check server readiness

func MongosReadinessCheck

func MongosReadinessCheck(ctx context.Context, cnf *db.Config) (err error)

Types

type InitialSyncStatus

type InitialSyncStatus interface{}

type OplogRs

type OplogRs struct {
	StorageSize int64 `bson:"storageSize" json:"storageSize"`

	Ok     int    `bson:"ok" json:"ok"`
	Errmsg string `bson:"errmsg,omitempty" json:"errmsg,omitempty"`
}

type ReplSetStatus

type ReplSetStatus struct {
	mongo.Status      `bson:",inline"`
	InitialSyncStatus InitialSyncStatus `bson:"initialSyncStatus" json:"initialSyncStatus"`
}

type ServerStatus

type ServerStatus struct {
	Ok     int    `bson:"ok" json:"ok"`
	Errmsg string `bson:"errmsg,omitempty" json:"errmsg,omitempty"`
}

type State

type State int
const (
	StateOk State = iota
	StateFailed
)

func HealthCheck

func HealthCheck(client mongo.Client, okMemberStates []mongo.MemberState) (State, *mongo.MemberState, error)

HealthCheck checks the replication member state of the local MongoDB member

func (State) ExitCode

func (s State) ExitCode() int

ExitCode returns an integer reflecting the State, to be used as an exit code

Directories

Path Synopsis
pkg
db
pod
pod/mocks
Code generated by mockery v1.0.0.
Code generated by mockery v1.0.0.
db

Jump to

Keyboard shortcuts

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