storage

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: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainGovernorConfigChain

type ChainGovernorConfigChain struct {
	ChainId            uint32
	NotionalLimit      Uint64
	BigTransactionSize Uint64
}

type ChainGovernorConfigToken

type ChainGovernorConfigToken struct {
	OriginChainId uint32
	OriginAddress string
	Price         float32
}

type ChainGovernorConfigUpdate

type ChainGovernorConfigUpdate struct {
	NodeName  string
	Counter   int64
	Timestamp int64
	Chains    []*ChainGovernorConfigChain
	Tokens    []*ChainGovernorConfigToken
}

type ChainGovernorStatusChain

type ChainGovernorStatusChain struct {
	ChainId                    uint32                        `bson:"chainid"`
	RemainingAvailableNotional Uint64                        `bson:"remainingavailablenotional"`
	Emitters                   []*ChainGovernorStatusEmitter `bson:"emitters"`
}

type ChainGovernorStatusEmitter

type ChainGovernorStatusEmitter struct {
	EmitterAddress    string                            `bson:"emitteraddress"`
	TotalEnqueuedVaas Uint64                            `bson:"totalenqueuedvaas"`
	EnqueuedVaas      []*ChainGovernorStatusEnqueuedVAA `bson:"enqueuedvaas"`
}

type ChainGovernorStatusEnqueuedVAA

type ChainGovernorStatusEnqueuedVAA struct {
	Sequence      string `bson:"sequence"`
	ReleaseTime   uint32 `bson:"releasetime"`
	NotionalValue Uint64 `bson:"notionalvalue"`
	TxHash        string `bson:"txhash"`
}

type GovernorStatusUpdate

type GovernorStatusUpdate struct {
	NodeName  string                      `bson:"nodename"`
	Counter   int64                       `bson:"counter"`
	Timestamp int64                       `bson:"timestamp"`
	Chains    []*ChainGovernorStatusChain `bson:"chains"`
}

type IndexingTimestamps

type IndexingTimestamps struct {
	IndexedAt time.Time `bson:"indexedAt"`
}

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 ObservationUpdate

type ObservationUpdate struct {
	MessageID  string      `bson:"messageId"`
	ChainID    vaa.ChainID `bson:"emitterChain"`
	Emitter    string      `bson:"emitterAddr"`
	Sequence   string      `bson:"sequence"`
	Hash       []byte      `bson:"hash"`
	TxHash     []byte      `bson:"txHash"`
	PhylaxAddr string      `bson:"phylaxAddr"`
	Signature  []byte      `bson:"signature"`
	UpdatedAt  *time.Time  `bson:"updatedAt"`
}

func (*ObservationUpdate) ToMap

func (v *ObservationUpdate) ToMap() map[string]string

type Repository

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

TODO separate and maybe share between fly and web

func NewRepository

func NewRepository(alertService alert.AlertClient, metrics metrics.Metrics, db *mongo.Database, vaaTopicFunc producer.PushFunc, log *zap.Logger) *Repository

TODO wrap repository with a service that filters using redis

func (*Repository) FindVaaByChainID

func (r *Repository) FindVaaByChainID(ctx context.Context, chainID vaa.ChainID, page int64, pageSize int64) ([]*VaaUpdate, error)

func (*Repository) GetMongoStatus

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

GetMongoStatus get mongo server status

func (*Repository) ReplaceVaaTxHash

func (s *Repository) ReplaceVaaTxHash(ctx context.Context, vaaID, oldTxHash, newTxHash string) error

func (*Repository) UpsertGovernorConfig

func (s *Repository) UpsertGovernorConfig(govC *gossipv1.SignedChainGovernorConfig) error

func (*Repository) UpsertGovernorStatus

func (s *Repository) UpsertGovernorStatus(govS *gossipv1.SignedChainGovernorStatus) error

func (*Repository) UpsertHeartbeat

func (s *Repository) UpsertHeartbeat(hb *gossipv1.Heartbeat) error

func (*Repository) UpsertObservation

func (s *Repository) UpsertObservation(o *gossipv1.SignedObservation) error

func (*Repository) UpsertTxHash

func (s *Repository) UpsertTxHash(ctx context.Context, vaaTxHash VaaIdTxHashUpdate) error

func (*Repository) UpsertVaa

func (s *Repository) UpsertVaa(ctx context.Context, v *vaa.VAA, serializedVaa []byte) error

type Uint64

type Uint64 uint64

func (Uint64) MarshalBSONValue

func (u Uint64) MarshalBSONValue() (bsontype.Type, []byte, error)

func (*Uint64) UnmarshalBSONValue

func (u *Uint64) UnmarshalBSONValue(t bsontype.Type, b []byte) error

type VaaIdTxHashUpdate

type VaaIdTxHashUpdate struct {
	ChainID      vaa.ChainID `bson:"emitterChain"`
	Emitter      string      `bson:"emitterAddr"`
	Sequence     string      `bson:"sequence"`
	TxHash       string      `bson:"txHash"`
	OriginTxHash *string     `bson:"_originTxHash,omitempty"` //this is temporary field for fix enconding txHash
	UpdatedAt    *time.Time  `bson:"updatedAt"`
}

type VaaUpdate

type VaaUpdate struct {
	ID             string      `bson:"_id"`
	Version        uint8       `bson:"version"`
	EmitterChain   vaa.ChainID `bson:"emitterChain"`
	EmitterAddr    string      `bson:"emitterAddr"`
	Sequence       string      `bson:"sequence"`
	PhylaxSetIndex uint32      `bson:"phylaxSetIndex"`
	Vaa            []byte      `bson:"vaas"`
	TxHash         string      `bson:"txHash,omitempty"`
	OriginTxHash   *string     `bson:"_originTxHash,omitempty"` //this is temporary field for fix enconding txHash
	Timestamp      *time.Time  `bson:"timestamp"`
	UpdatedAt      *time.Time  `bson:"updatedAt"`
}

func (*VaaUpdate) ToMap

func (v *VaaUpdate) ToMap() map[string]string

ToMap returns a map representation of the VaaUpdate.

Jump to

Keyboard shortcuts

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