heartbeats

package
v0.0.0-...-4318582 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: Apache-2.0 Imports: 9 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(srv *Service, logger *zap.Logger) *Controller

NewController create a new controler.

func (*Controller) GetLastHeartbeats

func (c *Controller) GetLastHeartbeats(ctx *fiber.Ctx, addresses []string) error

GetLastHeartbeats handler for the endpoint /guardian_public_api/v1/heartbeats This endpoint has been migrated from the guardian grpc api.

type HeartbeatDoc

type HeartbeatDoc struct {
	ID            string             `bson:"_id" json:"id"`
	BootTimestamp int64              `bson:"boottimestamp" json:"bootTimestamp"`
	Counter       int64              `bson:"counter" json:"counter"`
	GuardianAddr  string             `bson:"guardianaddr" json:"guardianAddr"`
	IndexedAt     *time.Time         `bson:"indexedAt" json:"indexedAt"`
	NodeName      string             `bson:"nodename" json:"nodeName"`
	Timestamp     int64              `bson:"timestamp" json:"timestamp"`
	UpdatedAt     *time.Time         `bson:"updatedAt" json:"updatedAt"`
	Version       string             `bson:"version" json:"version"`
	Networks      []HeartbeatNetwork `bson:"networks" json:"networks"`
}

HeartbeatDoc represent an heartbeat document.

type HeartbeatNetwork

type HeartbeatNetwork struct {
	ID              int64  `bson:"id" json:"id"`
	Height          int64  `bson:"height" json:"height"`
	ContractAddress string `bson:"contractaddress" json:"contractAddress"`
	ErrorCount      int64  `bson:"errorcount" json:"errorCount"`
}

HeartbeatNetwork definition.

type HeartbeatNetworkResponse

type HeartbeatNetworkResponse struct {
	ID              int64  `bson:"id" json:"id"`
	Height          string `bson:"height" json:"height"`
	ContractAddress string `bson:"contractaddress" json:"contractAddress"`
	ErrorCount      string `bson:"errorcount" json:"errorCount"`
}

HeartbeatNetwork definition.

type HeartbeatResponse

type HeartbeatResponse struct {
	VerifiedGuardianAddr string        `json:"verifiedGuardianAddr"`
	P2PNodeAddr          string        `json:"p2pNodeAddr"`
	RawHeartbeat         *RawHeartbeat `json:"rawHeartbeat"`
}

type HeartbeatsResponse

type HeartbeatsResponse struct {
	Heartbeats []*HeartbeatResponse `json:"entries"`
}

HeartbeatsResponse response.

type RawHeartbeat

type RawHeartbeat struct {
	NodeName      string                      `json:"nodeName"`
	Counter       int64                       `json:"counter"`
	Timestamp     string                      `json:"timestamp"`
	Networks      []*HeartbeatNetworkResponse `json:"networks"`
	Version       string                      `json:"version"`
	GuardianAddr  string                      `json:"guardianAddr"`
	BootTimestamp string                      `json:"bootTimestamp"`
}

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.

func (*Repository) FindByIDs

func (r *Repository) FindByIDs(ctx context.Context, ids []string) ([]*HeartbeatDoc, error)

FindByIDS get a list of HeartbeatDoc pointer.

type Service

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

Service definition.

func NewService

func NewService(dao *Repository, logger *zap.Logger) *Service

NewService create a new Service.

func (*Service) GetHeartbeatsByIds

func (s *Service) GetHeartbeatsByIds(ctx context.Context, heartbeatsIDs []string) ([]*HeartbeatDoc, error)

GetHeartbeatsByIds get heartbeats by IDs.

Jump to

Keyboard shortcuts

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