storage

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetObjectsPage

func GetObjectsPage[T Paginated](s *Storage, address string, from, count uint64) (ret []T, pagination *models.PaginatedResponse)

func GetTotal

func GetTotal[T Paginated](s *Storage, address string) (r uint64)

func GetTypeName

func GetTypeName[T any]() string

Types

type AddressStats

type AddressStats struct {
	models.StatsResponse
	Address string `json:"address"`
	// contains filtered or unexported fields
}

AddressStats defines the model for an address aggregate.

func MakeEmptyAddressStats

func MakeEmptyAddressStats(addr string) *AddressStats

func (*AddressStats) AddDag

func (a *AddressStats) AddDag(timestamp models.Timestamp) uint64

func (*AddressStats) AddPbft

func (a *AddressStats) AddPbft(timestamp models.Timestamp) uint64

func (*AddressStats) AddTransaction

func (a *AddressStats) AddTransaction(timestamp models.Timestamp) uint64

type Batch

type Batch struct {
	*pebble.Batch
	// contains filtered or unexported fields
}

func (*Batch) AddToBatch

func (b *Batch) AddToBatch(o interface{}, key1 string, key2 uint64)

func (*Batch) CommitBatch

func (b *Batch) CommitBatch()

func (*Batch) SetFinalizationData

func (b *Batch) SetFinalizationData(f *FinalizationData)

func (*Batch) SetGenesisHash

func (b *Batch) SetGenesisHash(h GenesisHash)

func (*Batch) SetTotalSupply

func (b *Batch) SetTotalSupply(s *TotalSupply)

func (*Batch) UpdateWeekStats

func (b *Batch) UpdateWeekStats(w WeekStats)

type FinalizationData

type FinalizationData struct {
	DagCount  uint64 `json:"dag_blocks_executed"`
	TrxCount  uint64 `json:"transactions_executed"`
	PbftCount uint64 `json:"pbft_period"`
}

func (*FinalizationData) Check

func (local *FinalizationData) Check(remote *FinalizationData)

type GenesisHash

type GenesisHash string

type Paginated

type Paginated interface {
	models.Transaction | models.Dag | models.Pbft
}

type Storage

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

func NewStorage

func NewStorage(file string) *Storage

func (*Storage) Clean

func (s *Storage) Clean() error

func (*Storage) Close

func (s *Storage) Close() error

func (*Storage) GenesisHashExist

func (s *Storage) GenesisHashExist() bool

func (*Storage) GetAddressStats

func (s *Storage) GetAddressStats(addr string) *AddressStats

func (*Storage) GetFinalizationData

func (s *Storage) GetFinalizationData() *FinalizationData

func (*Storage) GetGenesisHash

func (s *Storage) GetGenesisHash() GenesisHash

func (*Storage) GetTotalSupply

func (s *Storage) GetTotalSupply() *TotalSupply

func (*Storage) GetWeekStats

func (s *Storage) GetWeekStats(year, week int32) WeekStats

func (*Storage) NewBatch

func (s *Storage) NewBatch() *Batch

type TotalSupply

type TotalSupply = big.Int

type WeekStats

type WeekStats struct {
	Validators []models.Validator
	Total      uint32
	// contains filtered or unexported fields
}

func MakeEmptyWeekStats

func MakeEmptyWeekStats() *WeekStats

func (*WeekStats) AddPbftBlock

func (w *WeekStats) AddPbftBlock(block *models.Pbft)

func (*WeekStats) GetPaginated

func (w *WeekStats) GetPaginated(from, count uint64) ([]models.Validator, *models.PaginatedResponse)

func (*WeekStats) Sort

func (w *WeekStats) Sort()

Jump to

Keyboard shortcuts

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