price

package
v0.0.0-...-5c7291a Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg *types.Mempool, sub []byte) queue.Module

New 创建price cache 结构的 mempool

Types

type Queue

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

Queue 价格队列模式(价格=手续费/交易字节数,价格高者优先,同价则时间早优先)

func NewQueue

func NewQueue(subcfg subConfig) *Queue

NewQueue 创建队列

func (*Queue) Exist

func (cache *Queue) Exist(hash string) bool

Exist 是否存在

func (*Queue) GetItem

func (cache *Queue) GetItem(hash string) (*mempool.Item, error)

GetItem 获取数据通过 key

func (*Queue) GetProperFee

func (cache *Queue) GetProperFee() int64

GetProperFee 获取合适的手续费,取前100的平均价格

func (*Queue) Push

func (cache *Queue) Push(item *mempool.Item) error

Push 把给定tx添加到Queue;如果tx已经存在Queue中或Mempool已满则返回对应error

func (*Queue) Remove

func (cache *Queue) Remove(hash string) error

Remove 删除数据

func (*Queue) Size

func (cache *Queue) Size() int

Size 数据总数

func (*Queue) Walk

func (cache *Queue) Walk(count int, cb func(value *mempool.Item) bool)

Walk 遍历整个队列

Jump to

Keyboard shortcuts

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