unorderedtx

package
v0.52.0-beta.2 Latest Latest
Warning

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

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

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 (
	// DefaultmaxTimeoutDuration defines the default maximum duration an un-ordered transaction
	// can set.
	DefaultMaxTimeoutDuration = time.Minute * 40
)

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, timestamp time.Time)

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(blockTime time.Time)

OnNewBlock sends the latest block time 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