mempool

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddTransactionEventType    event.EventType = "mempool.add_tx"
	RemoveTransactionEventType event.EventType = "mempool.remove_tx"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddTransactionEvent

type AddTransactionEvent struct {
	Hash string
	Body []byte
	Type uint
}

type Mempool

type Mempool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMempool

func NewMempool(
	logger *slog.Logger,
	eventBus *event.EventBus,
	promRegistry prometheus.Registerer,
) *Mempool

func (*Mempool) AddConsumer

func (m *Mempool) AddConsumer(connId ouroboros.ConnectionId) *MempoolConsumer

func (*Mempool) AddTransaction

func (m *Mempool) AddTransaction(tx MempoolTransaction) error

func (*Mempool) Consumer

func (m *Mempool) Consumer(connId ouroboros.ConnectionId) *MempoolConsumer

func (*Mempool) GetTransaction

func (m *Mempool) GetTransaction(txHash string) (MempoolTransaction, bool)

func (*Mempool) RemoveConsumer

func (m *Mempool) RemoveConsumer(connId ouroboros.ConnectionId)

func (*Mempool) RemoveTransaction

func (m *Mempool) RemoveTransaction(txHash string)

type MempoolConsumer

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

func (*MempoolConsumer) ClearCache

func (m *MempoolConsumer) ClearCache()

func (*MempoolConsumer) GetTxFromCache

func (m *MempoolConsumer) GetTxFromCache(hash string) *MempoolTransaction

func (*MempoolConsumer) NextTx

func (m *MempoolConsumer) NextTx(blocking bool) *MempoolTransaction

func (*MempoolConsumer) RemoveTxFromCache

func (m *MempoolConsumer) RemoveTxFromCache(hash string)

type MempoolTransaction

type MempoolTransaction struct {
	Hash     string
	Type     uint
	Cbor     []byte
	LastSeen time.Time
}

type RemoveTransactionEvent

type RemoveTransactionEvent struct {
	Hash string
}

Jump to

Keyboard shortcuts

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