storage

package
v1.5.9 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: GPL-3.0 Imports: 18 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, fee 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) 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) 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) GetCirculation added in v1.2.0

func (s *Storage) GetCirculation(parent context.Context) (int64, error)

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) GetEpochNumLayers added in v1.2.0

func (s *Storage) GetEpochNumLayers() uint32

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) GetLastActivationReceived added in v1.5.0

func (s *Storage) GetLastActivationReceived() int64

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) 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) ([]model.Transaction, 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) 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) IsLayerInQueue added in v1.2.0

func (s *Storage) IsLayerInQueue(layer *pb.Layer) bool

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) LayersInQueue added in v1.2.0

func (s *Storage) LayersInQueue() int

func (*Storage) OnAccounts added in v1.2.0

func (s *Storage) OnAccounts(accounts []*types.Account)

func (*Storage) OnActivation added in v1.5.0

func (s *Storage) OnActivation(atx *types.VerifiedActivationTx)

func (*Storage) OnLayer

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

func (*Storage) OnMalfeasanceProof added in v1.1.0

func (s *Storage) OnMalfeasanceProof(in *pb.MalfeasanceProof)

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) OnTransactionResult added in v1.2.2

func (s *Storage) OnTransactionResult(res *pb.TransactionResult, state *pb.TransactionState)

func (*Storage) Ping added in v0.0.8

func (s *Storage) Ping() error

func (*Storage) RecalculateEpochStats added in v1.5.0

func (s *Storage) RecalculateEpochStats()

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

func (s *Storage) SaveBlock(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) SaveMalfeasanceProof added in v1.1.0

func (s *Storage) SaveMalfeasanceProof(parent context.Context, in *model.MalfeasanceProof) error

func (*Storage) SaveOrUpdateActivation added in v1.5.0

func (s *Storage) SaveOrUpdateActivation(parent context.Context, atx *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, epoch uint32) error

func (*Storage) SaveSmesherQuery added in v1.1.2

func (s *Storage) SaveSmesherQuery(in *model.Smesher) *mongo.UpdateOneModel

func (*Storage) SaveTransaction

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

func (*Storage) SaveTransactionResult added in v1.2.2

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

func (*Storage) UpdateAccount

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

func (*Storage) UpdateEpochStats added in v1.3.0

func (s *Storage) UpdateEpochStats(layer uint32)

func (*Storage) UpdateSmesher

func (s *Storage) UpdateSmesher(parent context.Context, in *model.Smesher, epoch uint32) error

func (*Storage) UpdateSmesherQuery added in v1.1.2

func (s *Storage) UpdateSmesherQuery(smesher string, coinbase string, space uint64, timestamp uint32) (*mongo.UpdateOneModel, *mongo.UpdateOneModel)

func (*Storage) UpdateTransactionState added in v1.2.3

func (s *Storage) UpdateTransactionState(parent context.Context, id string, state int32) error

Jump to

Keyboard shortcuts

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