model

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrAppBandwidthInfoNotFound

func ErrAppBandwidthInfoNotFound() sdk.Error

ErrAppBandwidthInfoNotFound - error if app bandwidth info is not found

func ErrBandwidthInfoNotFound

func ErrBandwidthInfoNotFound() sdk.Error

ErrBandwidthInfoNotFound - error if bandwidth info is not found

func ErrBlockInfoNotFound

func ErrBlockInfoNotFound() sdk.Error

ErrBlockInfoNotFound - error if last block info is not found

func GetAppBandwidthInfoKey

func GetAppBandwidthInfoKey(accKey linotypes.AccountKey) []byte

GetAppBandwidthInfoKey - "app bandwidth substore" + "username"

func GetBandwidthInfoKey

func GetBandwidthInfoKey() []byte

func GetBlockInfoKey

func GetBlockInfoKey() []byte

Types

type AppBandwidthInfo

type AppBandwidthInfo struct {
	Username           linotypes.AccountKey `json:"username"`
	MaxBandwidthCredit sdk.Dec              `json:"max_bandwidth_credit"`
	CurBandwidthCredit sdk.Dec              `json:"cur_bandwidth_credit"`
	MessagesInCurBlock int64                `json:"messages_in_cur_block"`
	ExpectedMPS        sdk.Dec              `json:"expected_mps"`
	LastRefilledAt     int64                `json:"last_refilled_at"`
}

AppBandwidthInfo - stores info about each app's bandwidth

type BandwidthInfo

type BandwidthInfo struct {
	GeneralMsgEMA sdk.Dec `json:"general_msg_ema"`
	AppMsgEMA     sdk.Dec `json:"app_msg_ema"`
	MaxMPS        sdk.Dec `json:"max_mps"`
}

BandwidthInfo - stores info about the moving average of mps and max mps

type BandwidthStorage

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

BandwidthStorage - bandwidth storage

func NewBandwidthStorage

func NewBandwidthStorage(key sdk.StoreKey) BandwidthStorage

func (BandwidthStorage) DoesAppBandwidthInfoExist

func (bs BandwidthStorage) DoesAppBandwidthInfoExist(ctx sdk.Context, accKey linotypes.AccountKey) bool

func (BandwidthStorage) GetAllAppBandwidthInfo

func (bs BandwidthStorage) GetAllAppBandwidthInfo(ctx sdk.Context) ([]*AppBandwidthInfo, sdk.Error)

GetAllAppBandwidthInfo

func (BandwidthStorage) GetAppBandwidthInfo

func (bs BandwidthStorage) GetAppBandwidthInfo(ctx sdk.Context, accKey linotypes.AccountKey) (*AppBandwidthInfo, sdk.Error)

func (BandwidthStorage) GetBandwidthInfo

func (bs BandwidthStorage) GetBandwidthInfo(ctx sdk.Context) (*BandwidthInfo, sdk.Error)

GetBandwidthInfo - returns bandwidth info, returns error otherwise.

func (BandwidthStorage) GetBlockInfo

func (bs BandwidthStorage) GetBlockInfo(ctx sdk.Context) (*BlockInfo, sdk.Error)

GetBlockInfo - returns cur block info, returns error otherwise.

func (BandwidthStorage) SetAppBandwidthInfo

func (bs BandwidthStorage) SetAppBandwidthInfo(ctx sdk.Context, accKey linotypes.AccountKey, info *AppBandwidthInfo) sdk.Error

func (BandwidthStorage) SetBandwidthInfo

func (bs BandwidthStorage) SetBandwidthInfo(ctx sdk.Context, info *BandwidthInfo) sdk.Error

SetBandwidthInfo - sets bandwidth info, returns error if any.

func (BandwidthStorage) SetBlockInfo

func (bs BandwidthStorage) SetBlockInfo(ctx sdk.Context, info *BlockInfo) sdk.Error

SetBlockInfo - sets cur block info, returns error if any.

type BlockInfo

type BlockInfo struct {
	TotalMsgSignedByApp  int64          `json:"total_tx_signed_by_app"`
	TotalMsgSignedByUser int64          `json:"total_tx_signed_by_user"`
	CurMsgFee            linotypes.Coin `json:"cur_msg_fee"`
	CurU                 sdk.Dec        `json:"cur_u"`
}

BlockInfo - stores info about number of tx in last block

Jump to

Keyboard shortcuts

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