unorderedtx

package
v0.0.0-...-a6871c7 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// SnapshotFormat defines the snapshot format of exported unordered transactions.
	// No protobuf envelope, no metadata.
	SnapshotFormat = 1

	// SnapshotName defines the snapshot name of exported unordered transactions.
	SnapshotName = "unordered_txs"
)
View Source
const (
	// DefaultMaxUnOrderedTTL defines the default maximum TTL an un-ordered transaction
	// can set.
	DefaultMaxUnOrderedTTL = 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager contains the tx hash dictionary for duplicates checking, and expire them when block production progresses.

func NewManager

func NewManager(dataDir string) *Manager

func (*Manager) Add

func (m *Manager) Add(txHash TxHash, ttl uint64)

func (*Manager) Close

func (m *Manager) Close() error

Close must be called when a node gracefully shuts down. Typically, this should be called in an application's Close() function, which is called by the server. Note, Start() must be called in order for Close() to not hang.

It will free all necessary resources as well as writing all unexpired unordered transactions along with their TTL values to file.

func (*Manager) Contains

func (m *Manager) Contains(hash TxHash) bool

func (*Manager) OnInit

func (m *Manager) OnInit() error

OnInit must be called when a node starts up. Typically, this should be called in an application's constructor, which is called by the server.

func (*Manager) OnNewBlock

func (m *Manager) OnNewBlock(blockHeight uint64)

OnNewBlock sends the latest block number to the background purge loop, which should be called in ABCI Commit event.

func (*Manager) Size

func (m *Manager) Size() int

func (*Manager) Start

func (m *Manager) Start()

type Snapshotter

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

func NewSnapshotter

func NewSnapshotter(m *Manager) *Snapshotter

func (*Snapshotter) RestoreExtension

func (s *Snapshotter) RestoreExtension(height uint64, format uint32, payloadReader snapshot.ExtensionPayloadReader) error

func (*Snapshotter) SnapshotExtension

func (s *Snapshotter) SnapshotExtension(height uint64, payloadWriter snapshot.ExtensionPayloadWriter) error

func (*Snapshotter) SnapshotFormat

func (s *Snapshotter) SnapshotFormat() uint32

func (*Snapshotter) SnapshotName

func (s *Snapshotter) SnapshotName() string

func (*Snapshotter) SupportedFormats

func (s *Snapshotter) SupportedFormats() []uint32

type TxHash

type TxHash [32]byte

TxHash defines a transaction hash type alias, which is a fixed array of 32 bytes.

Jump to

Keyboard shortcuts

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