infrastructure

package
v0.0.0-...-efbd42f Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

Controller definition.

func NewController

func NewController(serv *Service, logger *zap.Logger) *Controller

NewController creates a Controller instance.

func (*Controller) HealthCheck

func (c *Controller) HealthCheck(ctx *fiber.Ctx) error

HealthCheck handler for the endpoint /health.

func (*Controller) ReadyCheck

func (c *Controller) ReadyCheck(ctx *fiber.Ctx) error

ReadyCheck handler for the endpoint /ready.

type MongoConnections

type MongoConnections struct {
	Current      int32 `bson:"current"`
	Available    int32 `bson:"available"`
	TotalCreated int32 `bson:"totalCreated"`
}

MongoConnections represents a mongo server connection.

type MongoStatus

type MongoStatus struct {
	Ok          int32             `bson:"ok"`
	Host        string            `bson:"host"`
	Version     string            `bson:"version"`
	Process     string            `bson:"process"`
	Pid         int32             `bson:"pid"`
	Uptime      int32             `bson:"uptime"`
	Connections *MongoConnections `bson:"connections"`
}

MongoStatus represent a mongo server status.

type Repository

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

Repository definition.

func NewRepository

func NewRepository(db *mongo.Database, logger *zap.Logger) *Repository

NewRepository create a new Repository instance.

func (*Repository) GetMongoStatus

func (r *Repository) GetMongoStatus(ctx context.Context) (*MongoStatus, error)

GetMongoStatus get mongo server status.

type Server

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

func NewServer

func NewServer(logger *zap.Logger, port string, pprofEnabled bool, isQueueConsumer bool, consumer *sqs.Consumer,
	db *mongo.Database, vaaController *vaa.Controller) *Server

func (*Server) Start

func (s *Server) Start()

Start listen serves HTTP requests from addr.

func (*Server) Stop

func (s *Server) Stop()

Stop gracefull server.

type Service

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

Service definition.

func NewService

func NewService(dao *Repository, consumer *sqs.Consumer, isQueueConsumer bool, logger *zap.Logger) *Service

NewService create a new Service instance.

func (*Service) CheckAwsSQS

func (s *Service) CheckAwsSQS(ctx context.Context) (bool, error)

CheckAwsSQS check aws sqs status.

func (*Service) CheckIsReady

func (s *Service) CheckIsReady(ctx context.Context) (bool, error)

CheckIsReady check if the service is ready.

func (*Service) CheckMongoServerStatus

func (s *Service) CheckMongoServerStatus(ctx context.Context) (bool, error)

CheckMongoServerStatus check mongodb status.

Jump to

Keyboard shortcuts

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