storage

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: GPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountUpdaterService

type AccountUpdaterService interface {
	GetAccountState(address string) (uint64, uint64, error)
}

type Storage

type Storage struct {
	NetworkInfo model.NetworkInfo

	AccountUpdater AccountUpdaterService

	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(parent context.Context, dbUrl string, dbName string) (*Storage, error)

func (*Storage) AddAccount

func (s *Storage) AddAccount(parent context.Context, layer uint32, address string, balance uint64) error

func (*Storage) AddAccountReceived

func (s *Storage) AddAccountReceived(parent context.Context, layer uint32, address string, amount uint64) error

func (*Storage) AddAccountReward

func (s *Storage) AddAccountReward(parent context.Context, layer uint32, address string, reward uint64, fee uint64) error

func (*Storage) AddAccountSent

func (s *Storage) AddAccountSent(parent context.Context, layer uint32, address string, amount uint64) error

func (*Storage) Close

func (s *Storage) Close()

func (*Storage) GetAccount

func (s *Storage) GetAccount(parent context.Context, query *bson.D) (*model.Account, error)

func (*Storage) GetAccountSummary

func (s *Storage) GetAccountSummary(parent context.Context, address string) (uint64, uint64, uint64, uint64, uint32)

func (*Storage) GetAccounts

func (s *Storage) GetAccounts(parent context.Context, query *bson.D, opts ...*options.FindOptions) ([]bson.D, error)

func (*Storage) GetAccountsCount

func (s *Storage) GetAccountsCount(parent context.Context, query *bson.D, opts ...*options.CountOptions) int64

func (*Storage) GetActivation

func (s *Storage) GetActivation(parent context.Context, query *bson.D) (*model.Activation, error)

func (*Storage) GetActivations

func (s *Storage) GetActivations(parent context.Context, query *bson.D, opts ...*options.FindOptions) ([]bson.D, error)

func (*Storage) GetActivationsCount

func (s *Storage) GetActivationsCount(parent context.Context, query *bson.D, opts ...*options.CountOptions) int64

func (*Storage) GetApp

func (s *Storage) GetApp(parent context.Context, query *bson.D) (*model.App, error)

func (*Storage) GetApps

func (s *Storage) GetApps(parent context.Context, query *bson.D, opts ...*options.FindOptions) ([]bson.D, error)

func (*Storage) GetAppsCount

func (s *Storage) GetAppsCount(parent context.Context, query *bson.D, opts ...*options.CountOptions) int64

func (*Storage) GetBlock

func (s *Storage) GetBlock(parent context.Context, query *bson.D) (*model.Block, error)

func (*Storage) GetBlocks

func (s *Storage) GetBlocks(parent context.Context, query *bson.D, opts ...*options.FindOptions) ([]bson.D, error)

func (*Storage) GetBlocksCount

func (s *Storage) GetBlocksCount(parent context.Context, query *bson.D, opts ...*options.CountOptions) int64

func (*Storage) GetEpoch

func (s *Storage) GetEpoch(parent context.Context, query *bson.D) (*model.Epoch, error)

func (*Storage) GetEpochByNumber

func (s *Storage) GetEpochByNumber(parent context.Context, epochNumber int32) (*model.Epoch, error)

func (*Storage) GetEpochForLayer

func (s *Storage) GetEpochForLayer(layer uint32) uint32

func (*Storage) GetEpochLayers

func (s *Storage) GetEpochLayers(epoch int32) (uint32, uint32)

func (*Storage) GetEpochLayersFilter

func (s *Storage) GetEpochLayersFilter(epochNumber int32, key string) *bson.D

func (*Storage) GetEpochs

func (s *Storage) GetEpochs(parent context.Context, query *bson.D, opts ...*options.FindOptions) ([]bson.D, error)

func (*Storage) GetEpochsCount

func (s *Storage) GetEpochsCount(parent context.Context, query *bson.D, opts ...*options.CountOptions) int64

func (*Storage) GetEpochsData

func (s *Storage) GetEpochsData(parent context.Context, query *bson.D, opts ...*options.FindOptions) ([]*model.Epoch, error)

func (*Storage) GetLastLayer

func (s *Storage) GetLastLayer(parent context.Context) uint32

func (*Storage) GetLayer

func (s *Storage) GetLayer(parent context.Context, query *bson.D) (*model.Layer, error)

func (*Storage) GetLayerByNumber

func (s *Storage) GetLayerByNumber(parent context.Context, layerNumber uint32) (*model.Layer, error)

func (*Storage) GetLayers

func (s *Storage) GetLayers(parent context.Context, query *bson.D, opts ...*options.FindOptions) ([]bson.D, error)

func (*Storage) GetLayersCount

func (s *Storage) GetLayersCount(parent context.Context, query *bson.D, opts ...*options.CountOptions) int64

func (*Storage) GetLayersRewards

func (s *Storage) GetLayersRewards(parent context.Context, layerStart uint32, layerEnd uint32) (int64, int64)

func (*Storage) GetNetworkInfo

func (s *Storage) GetNetworkInfo(parent context.Context) (*model.NetworkInfo, error)

func (*Storage) GetReward

func (s *Storage) GetReward(parent context.Context, query *bson.D) (*model.Reward, error)

func (*Storage) GetRewards

func (s *Storage) GetRewards(parent context.Context, query *bson.D, opts ...*options.FindOptions) ([]bson.D, error)

func (*Storage) GetRewardsCount

func (s *Storage) GetRewardsCount(parent context.Context, query *bson.D, opts ...*options.CountOptions) int64

func (*Storage) GetSmesher

func (s *Storage) GetSmesher(parent context.Context, query *bson.D) (*model.Smesher, error)

func (*Storage) GetSmesherByCoinbase

func (s *Storage) GetSmesherByCoinbase(parent context.Context, coinbase string) (*model.Smesher, error)

func (*Storage) GetSmesherRewards

func (s *Storage) GetSmesherRewards(parent context.Context, smesher string) (int64, int64)

func (*Storage) GetSmeshers

func (s *Storage) GetSmeshers(parent context.Context, query *bson.D, opts ...*options.FindOptions) ([]bson.D, error)

func (*Storage) GetSmeshersCount

func (s *Storage) GetSmeshersCount(parent context.Context, query *bson.D, opts ...*options.CountOptions) int64

func (*Storage) GetTransaction

func (s *Storage) GetTransaction(parent context.Context, query *bson.D) (*model.Transaction, error)

func (*Storage) GetTransactions

func (s *Storage) GetTransactions(parent context.Context, query *bson.D, opts ...*options.FindOptions) ([]bson.D, error)

func (*Storage) GetTransactionsAmount

func (s *Storage) GetTransactionsAmount(parent context.Context, query *bson.D) int64

func (*Storage) GetTransactionsCount

func (s *Storage) GetTransactionsCount(parent context.Context, query *bson.D, opts ...*options.CountOptions) int64

func (*Storage) InitAccountsStorage

func (s *Storage) InitAccountsStorage(ctx context.Context) error

func (*Storage) InitActivationsStorage

func (s *Storage) InitActivationsStorage(ctx context.Context) error

func (*Storage) InitAppsStorage

func (s *Storage) InitAppsStorage(ctx context.Context) error

func (*Storage) InitBlocksStorage

func (s *Storage) InitBlocksStorage(ctx context.Context) error

func (*Storage) InitEpochsStorage

func (s *Storage) InitEpochsStorage(ctx context.Context) error

func (*Storage) InitLayersStorage

func (s *Storage) InitLayersStorage(ctx context.Context) error

func (*Storage) InitRewardsStorage

func (s *Storage) InitRewardsStorage(ctx context.Context) error

func (*Storage) InitSmeshersStorage

func (s *Storage) InitSmeshersStorage(ctx context.Context) error

func (*Storage) InitTransactionsStorage

func (s *Storage) InitTransactionsStorage(ctx context.Context) error

func (*Storage) IsSmesherExists

func (s *Storage) IsSmesherExists(parent context.Context, smesher string) bool

func (*Storage) IsTransactionExists

func (s *Storage) IsTransactionExists(parent context.Context, txId string) bool

func (*Storage) OnAccount

func (s *Storage) OnAccount(in *pb.Account)

func (*Storage) OnLayer

func (s *Storage) OnLayer(in *pb.Layer)

func (*Storage) OnNetworkInfo

func (s *Storage) OnNetworkInfo(genesisId string, genesisTime uint64, epochNumLayers uint32, maxTransactionsPerSecond uint64, layerDuration uint64, postUnitSize uint64)

func (*Storage) OnNodeStatus

func (s *Storage) OnNodeStatus(connectedPeers uint64, isSynced bool, syncedLayer uint32, topLayer uint32, verifiedLayer uint32)

func (*Storage) OnReward

func (s *Storage) OnReward(in *pb.Reward)

func (*Storage) OnTransactionReceipt

func (s *Storage) OnTransactionReceipt(in *pb.TransactionReceipt)

func (*Storage) Ping added in v0.0.8

func (s *Storage) Ping() error

func (*Storage) SaveAccount

func (s *Storage) SaveAccount(parent context.Context, layer uint32, in *model.Account) error

func (*Storage) SaveActivation

func (s *Storage) SaveActivation(parent context.Context, in *model.Activation) error

func (*Storage) SaveActivations

func (s *Storage) SaveActivations(parent context.Context, in []*model.Activation) error

func (*Storage) SaveApp

func (s *Storage) SaveApp(parent context.Context, in *model.App) error

func (*Storage) SaveBlock

func (s *Storage) SaveBlock(parent context.Context, in *model.Block) error

func (*Storage) SaveBlocks

func (s *Storage) SaveBlocks(parent context.Context, in []*model.Block) error

func (*Storage) SaveEpoch

func (s *Storage) SaveEpoch(parent context.Context, epoch *model.Epoch) error

func (*Storage) SaveLayer

func (s *Storage) SaveLayer(parent context.Context, in *model.Layer) error

func (*Storage) SaveOrUpdateActivations

func (s *Storage) SaveOrUpdateActivations(parent context.Context, in []*model.Activation) error

func (*Storage) SaveOrUpdateBlocks

func (s *Storage) SaveOrUpdateBlocks(parent context.Context, in []*model.Block) error

func (*Storage) SaveOrUpdateEpoch

func (s *Storage) SaveOrUpdateEpoch(parent context.Context, epoch *model.Epoch) error

func (*Storage) SaveOrUpdateLayer

func (s *Storage) SaveOrUpdateLayer(parent context.Context, in *model.Layer) error

func (*Storage) SaveOrUpdateNetworkInfo

func (s *Storage) SaveOrUpdateNetworkInfo(parent context.Context, in *model.NetworkInfo) error

func (*Storage) SaveReward

func (s *Storage) SaveReward(parent context.Context, in *model.Reward) error

func (*Storage) SaveSmesher

func (s *Storage) SaveSmesher(parent context.Context, in *model.Smesher) error

func (*Storage) SaveTransaction

func (s *Storage) SaveTransaction(parent context.Context, in *model.Transaction) error

func (*Storage) SaveTransactions

func (s *Storage) SaveTransactions(parent context.Context, in map[string]*model.Transaction) error

func (*Storage) UpdateAccount

func (s *Storage) UpdateAccount(parent context.Context, address string, balance uint64, counter uint64) error

func (*Storage) UpdateSmesher

func (s *Storage) UpdateSmesher(parent context.Context, smesher string, coinbase string, space uint64, timestamp uint32) error

func (*Storage) UpdateTransaction

func (s *Storage) UpdateTransaction(parent context.Context, in *model.TransactionReceipt) error

Jump to

Keyboard shortcuts

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