storage

package
v0.0.0-...-220dd01 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 28 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 DuplicateVaaUpdate

type DuplicateVaaUpdate struct {
	ID               string      `bson:"_id"`
	VaaID            string      `bson:"vaaId"`
	Version          uint8       `bson:"version"`
	EmitterChain     vaa.ChainID `bson:"emitterChain"`
	EmitterAddr      string      `bson:"emitterAddr"`
	Sequence         string      `bson:"sequence"`
	GuardianSetIndex uint32      `bson:"guardianSetIndex"`
	Vaa              []byte      `bson:"vaas"`
	Digest           string      `bson:"digest"`
	ConsistencyLevel uint8       `bson:"consistencyLevel"`
	TxHash           string      `bson:"txHash,omitempty"`
	Timestamp        *time.Time  `bson:"timestamp"`
	UpdatedAt        *time.Time  `bson:"updatedAt"`
}

func (*DuplicateVaaUpdate) ToMap

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

ToMap returns a map representation of the VaaUpdate.

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"`
	GuardianAddr string      `bson:"guardianAddr"`
	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,
	txHashStore txhash.TxHashStore,
	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) FindVaaByID

func (r *Repository) FindVaaByID(ctx context.Context, vaaID string) (*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) UpsertDuplicateVaa

func (s *Repository) UpsertDuplicateVaa(ctx context.Context, v *vaa.VAA, serializedVaa []byte) 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(ctx context.Context, o *gossipv1.SignedObservation, saveTxHash bool) 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 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"`
	GuardianSetIndex uint32      `bson:"guardianSetIndex"`
	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"`
	Digest           string      `bson:"digest"`
	IsDuplicated     bool        `bson:"isDuplicated"`
}

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