observations

package
v0.0.0-...-e8e2c10 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package observations handle the request of observations data from governor endpoint defined in the api.

Package observations handle the request of observations data from governor endpoint defined in the api.

Package observations handle the request of observations data from governor endpoint defined in the api.

Package observations handle the request of observations data from governor endpoint defined in the api.

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) FindAll

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

FindAll handler for the endpoint /observations/.

func (*Controller) FindAllByChain

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

FindAllByChain handler for the endpoint /observations/:emitterChain.

func (*Controller) FindAllByEmitter

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

FindAllByEmitter handler for the endpoint /observations/:emitterChain/:emitterAddress.

func (*Controller) FindAllByEmitterAndTargetChain

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

FindAllByEmitter handler for the endpoint /observations/:emitterChain/:emitterAddress/:targetChain.

func (*Controller) FindAllByVAA

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

FindAllByVAA handler for the endpoint /observations/:emitterChain/:emitterAddress/:sequence

func (*Controller) FindOne

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

FindOne handler for the endpoint /observations/:chain/:emitter/:sequence/:signer/:hash

type ObservationDoc

type ObservationDoc struct {
	ID           string      `bson:"_id" json:"id"`
	Version      uint8       `bson:"version" json:"version"`
	EmitterChain vaa.ChainID `bson:"emitterChain" json:"emitterChain"`
	EmitterAddr  string      `bson:"emitterAddr" json:"emitterAddr"`
	TargetChain  vaa.ChainID `bson:"targetChain" json:"targetChain"`
	Sequence     uint64      `bson:"sequence" json:"sequence"`
	Hash         []byte      `bson:"hash" json:"hash"`
	TxHash       []byte      `bson:"txHash" json:"txHash"`
	GuardianAddr string      `bson:"guardianAddr" json:"guardianAddr"`
	Signature    []byte      `bson:"signature" json:"signature"`
	UpdatedAt    *time.Time  `bson:"updatedAt" json:"updatedAt"`
	IndexedAt    *time.Time  `bson:"indexedAt" json:"indexedAt"`
}

ObservationDoc represent an observation document.

type ObservationQuery

type ObservationQuery struct {
	pagination.Pagination
	// contains filtered or unexported fields
}

ObservationQuery respresent a query for the observation mongodb document.

func Query

func Query() *ObservationQuery

Query create a new ObservationQuery with default pagination vaues.

func (*ObservationQuery) SetEmitter

func (q *ObservationQuery) SetEmitter(emitter string) *ObservationQuery

SetEmitter set the emitter field of the ObservationQuery struct.

func (*ObservationQuery) SetEmitterChain

func (q *ObservationQuery) SetEmitterChain(chainID vaa.ChainID) *ObservationQuery

SetEmitterChain set the emitterChain field of the ObservationQuery struct.

func (*ObservationQuery) SetGuardianAddr

func (q *ObservationQuery) SetGuardianAddr(guardianAddr string) *ObservationQuery

SetGuardianAddr set the guardianAddr field of the ObservationQuery struct.

func (*ObservationQuery) SetHash

func (q *ObservationQuery) SetHash(hash []byte) *ObservationQuery

SetHash set the hash field of the ObservationQuery struct.

func (*ObservationQuery) SetPagination

SetPagination set the pagination field of the ObservationQuery struct.

func (*ObservationQuery) SetSequence

func (q *ObservationQuery) SetSequence(seq string) *ObservationQuery

SetSequence set the sequence field of the ObservationQuery struct.

func (*ObservationQuery) SetTargetChain

func (q *ObservationQuery) SetTargetChain(chainID vaa.ChainID) *ObservationQuery

SetTargetChain set the targetChain field of the ObservationQuery struct.

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) Find

Find get a list of ObservationDoc pointers. The input parameter [q *ObservationQuery] define the filters to apply in the query.

func (*Repository) FindOne

Find get ObservationDoc pointer. The input parameter [q *ObservationQuery] define the filters to apply in the query.

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) FindAll

func (s *Service) FindAll(ctx context.Context, p *pagination.Pagination) ([]*ObservationDoc, error)

FindAll get all the observations.

func (*Service) FindByChain

func (s *Service) FindByChain(ctx context.Context, chain vaa.ChainID, p *pagination.Pagination) ([]*ObservationDoc, error)

FindByChain get all the observations by emitter chain.

func (*Service) FindByEmitter

func (s *Service) FindByEmitter(ctx context.Context, chain vaa.ChainID, emitter *vaa.Address, p *pagination.Pagination) ([]*ObservationDoc, error)

FindByEmitter get all the observations by emitter chain and emitter address.

func (*Service) FindByEmitterAndTargetChain

func (s *Service) FindByEmitterAndTargetChain(ctx context.Context, emitterChain vaa.ChainID, emitterAddress *vaa.Address, targetChain vaa.ChainID, p *pagination.Pagination) ([]*ObservationDoc, error)

FindByEmitter get all the observations by emitter chain, emitter address and target chain.

func (*Service) FindByVAA

func (s *Service) FindByVAA(ctx context.Context, emitterChain vaa.ChainID, emitter *vaa.Address, targetChain vaa.ChainID, seq string, p *pagination.Pagination) ([]*ObservationDoc, error)

FindByVAA get all the observations for a VAA (emitter chain, emitter addrress, target chain and sequence number).

func (*Service) FindOne

func (s *Service) FindOne(ctx context.Context, emitterChain vaa.ChainID, emitterAddr *vaa.Address, targetChain vaa.ChainID, seq string, signerAddr *vaa.Address, hash []byte) (*ObservationDoc, error)

FindOne get a observation by chainID, emitter address, sequence, signer address and hash.

Jump to

Keyboard shortcuts

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