txcache

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright © 2019 Annchain Authors <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TxCache

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

func NewTxCache

func NewTxCache(maxSize int, expire int, invalidTx func(h types2.Hash) bool, sorted bool) *TxCache

func (*TxCache) DeQueue

func (t *TxCache) DeQueue() types.Txi

get top element end remove it

func (*TxCache) DeQueueBatch

func (c *TxCache) DeQueueBatch(count int) (txs types.Txis, err error)

func (*TxCache) EnQueue

func (t *TxCache) EnQueue(tx types.Txi) error

Add tx into txCache

func (*TxCache) EnQueueBatch

func (c *TxCache) EnQueueBatch(txs types.Txis) error

func (*TxCache) Get

func (t *TxCache) Get(h types2.Hash) types.Txi

Get get an item

func (*TxCache) GetHashOrder

func (t *TxCache) GetHashOrder() types2.Hashes

func (*TxCache) GetTop

func (t *TxCache) GetTop() types.Txi

func (*TxCache) Has

func (t *TxCache) Has(h types2.Hash) bool

func (*TxCache) Len

func (t *TxCache) Len() int

func (*TxCache) Prepend

func (t *TxCache) Prepend(tx types.Txi) error

Add tx into txCache

func (*TxCache) PrependBatch

func (c *TxCache) PrependBatch(txs types.Txis) error

func (*TxCache) Refresh

func (t *TxCache) Refresh()

func (*TxCache) Remove

func (t *TxCache) Remove(h types2.Hash) bool

Remove tx from txCache

func (*TxCache) RemoveExpiredAndInvalid

func (t *TxCache) RemoveExpiredAndInvalid(allowFailCount int) error

func (*TxCache) Sort

func (t *TxCache) Sort()

Jump to

Keyboard shortcuts

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