checks

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 9 Imported by: 0

README

Check Package

A check answers the question 'Is third party, networked dependency X available?'

A check is an arbitrary class that conforms to the Check interface, check.go.

A check attempts to establish a connection to a dependency and reports whether it is currently avaiable, with the configuration provided to the check.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckInterface

type CheckInterface interface {
	// GetImp returns the check's Implementation.
	GetImp() Implementation
	// GetStatus returns the check's current status.
	GetStatus() CheckStatus
	// GetLastCheck return the time the check last attempt finished.
	GetLastCheck() time.Time
	// GetError returns the error the last check attempt encountered,
	// if the check passed succesfully returns nil.
	GetError() error
	// HealthCheck runs the check.
	// If the check fails, returns the error encountered.
	// If the check succeeds returns nil.
	HealthCheck() error
	// Cleans up any resources and dependencies required by the check.
	Cleanup()
}

func NewHttpCheck

func NewHttpCheck(host string, port int, timeout time.Duration) (CheckInterface, error)

func NewPostgresCheck

func NewPostgresCheck(host string, port int, dbName, user, pass, sslMode string) (CheckInterface, error)

func NewPubsubCheck

func NewPubsubCheck(projectID string) (CheckInterface, error)

func NewRabbitmqCheck

func NewRabbitmqCheck(host string, port int, user, pass string) (CheckInterface, error)

type CheckStatus

type CheckStatus string
const (
	// the check is preparing required resources.
	STARTUP CheckStatus = "startup"
	// the check is ongoing.
	CHECKING CheckStatus = "checking"
	// the check is complete.
	DONE CheckStatus = "done"
)

type Implementation

type Implementation string
const HTTP Implementation = "http"
const POSTGRES Implementation = "postgres"
const (
	PUBSUB Implementation = "pubsub"
)
const (
	RABBITMQ Implementation = "rabbitmq"
)

Jump to

Keyboard shortcuts

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