workflow

package
v0.1.2-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TraceTagTxInput = "txinput"
)

Variables

View Source
var (
	EventNewGoodTx = eventtype.RegisterNew[*vertex.WrappedTx]("new good seq")
	EventNewTx     = eventtype.RegisterNew[*vertex.WrappedTx]("new tx") // event may be posted more than once for the transaction
)

Functions

func OptionDoNotStartPruner

func OptionDoNotStartPruner(c *ConfigParams)

OptionDoNotStartPruner used for testing, to disable pruner Config key: 'workflow.do_not_start_pruner: true'

func OptionEnableSyncManager

func OptionEnableSyncManager(c *ConfigParams)

OptionEnableSyncManager used to disable sync manager which is optional if sync is not long Config key: 'workflow.do_not_start_sync_manager: true'

Types

type ConfigOption

type ConfigOption func(c *ConfigParams)

type ConfigParams

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

type Environment

type Environment interface {
	global.NodeGlobal
	StateStore() global.StateStore
	TxBytesStore() global.TxBytesStore
	PullFromNPeers(nPeers int, txid *ledger.TransactionID) int
	GetOwnSequencerID() *ledger.ChainID
}

type TxInOption

type TxInOption func(options *txInOptions)

func WithAttachmentCallback

func WithAttachmentCallback(fun func(vid *vertex.WrappedTx, err error)) TxInOption

func WithContext

func WithContext(ctx context.Context) TxInOption

func WithMetadata

func WithMetadata(metadata *txmetadata.TransactionMetadata) TxInOption

func WithPeerMetadata

func WithPeerMetadata(peerID peer.ID, metadata *txmetadata.TransactionMetadata) TxInOption

func WithSourceType

func WithSourceType(sourceType txmetadata.SourceType) TxInOption

func WithTxTraceFlag

func WithTxTraceFlag(trace bool) TxInOption

type Workflow

type Workflow struct {
	Environment
	*memdag.MemDAG
	// contains filtered or unexported fields
}

func Start

func Start(env Environment, peers *peering.Peers, opts ...ConfigOption) *Workflow

func StartFromConfig

func StartFromConfig(env Environment, peers *peering.Peers) *Workflow

func (*Workflow) AddWantedTransaction

func (w *Workflow) AddWantedTransaction(txid *ledger.TransactionID)

func (*Workflow) EnsureBranch

func (w *Workflow) EnsureBranch(txid ledger.TransactionID, timeout ...time.Duration) (*vertex.WrappedTx, error)

func (*Workflow) EnsureLatestBranches

func (w *Workflow) EnsureLatestBranches() error

func (*Workflow) EvidenceNonSequencerTx

func (w *Workflow) EvidenceNonSequencerTx()

func (*Workflow) GetLatestMilestone

func (w *Workflow) GetLatestMilestone(seqID ledger.ChainID) *vertex.WrappedTx

func (*Workflow) GetTxInclusion

func (w *Workflow) GetTxInclusion(txid *ledger.TransactionID, slotsBack int) *multistate.TxInclusion

func (*Workflow) GossipAttachedTransaction

func (w *Workflow) GossipAttachedTransaction(tx *transaction.Transaction, metadata *txmetadata.TransactionMetadata)

func (*Workflow) GossipTxBytesToPeers

func (w *Workflow) GossipTxBytesToPeers(txBytes []byte, metadata *txmetadata.TransactionMetadata, except ...peer.ID)

func (*Workflow) IsSynced

func (w *Workflow) IsSynced() bool

func (*Workflow) LatestMilestonesDescending

func (w *Workflow) LatestMilestonesDescending(filter ...func(seqID ledger.ChainID, vid *vertex.WrappedTx) bool) []*vertex.WrappedTx

LatestMilestonesDescending returns optionally filtered sorted transactions from the sequencer tippool

func (*Workflow) LatestMilestonesShuffled

func (w *Workflow) LatestMilestonesShuffled(filter ...func(seqID ledger.ChainID, vid *vertex.WrappedTx) bool) []*vertex.WrappedTx

LatestMilestonesShuffled returns optionally filtered sorted transactions from the sequencer tippool

func (*Workflow) ListenToAccount

func (w *Workflow) ListenToAccount(account ledger.Accountable, fun func(wOut vertex.WrappedOutput))

ListenToAccount listens to all outputs which belongs to the account (except stem-locked outputs)

func (*Workflow) ListenToSequencers

func (w *Workflow) ListenToSequencers(fun func(vid *vertex.WrappedTx))

func (*Workflow) MaxDurationInTheFuture

func (w *Workflow) MaxDurationInTheFuture() time.Duration

func (*Workflow) MilestoneArrivedSince

func (w *Workflow) MilestoneArrivedSince(when time.Time) bool

func (*Workflow) MustEnsureBranch

func (w *Workflow) MustEnsureBranch(txid ledger.TransactionID) *vertex.WrappedTx

func (*Workflow) MustPersistTxBytesWithMetadata

func (w *Workflow) MustPersistTxBytesWithMetadata(txBytes []byte, metadata *txmetadata.TransactionMetadata)

func (*Workflow) NumSequencerTips

func (w *Workflow) NumSequencerTips() int

func (*Workflow) PeerName

func (w *Workflow) PeerName(id peer.ID) string

func (*Workflow) PokeAllWith

func (w *Workflow) PokeAllWith(wanted *vertex.WrappedTx)

func (*Workflow) PokeMe

func (w *Workflow) PokeMe(me, with *vertex.WrappedTx)

func (*Workflow) PostEventNewGood

func (w *Workflow) PostEventNewGood(vid *vertex.WrappedTx)

func (*Workflow) PostEventNewTransaction

func (w *Workflow) PostEventNewTransaction(vid *vertex.WrappedTx)

func (*Workflow) QueryTxIDStatus

func (w *Workflow) QueryTxIDStatus(txid *ledger.TransactionID) (ret vertex.TxIDStatus)

func (*Workflow) QueryTxIDStatusJSONAble

func (w *Workflow) QueryTxIDStatusJSONAble(txid *ledger.TransactionID) vertex.TxIDStatusJSONAble

func (*Workflow) SendToTippool

func (w *Workflow) SendToTippool(vid *vertex.WrappedTx)

func (*Workflow) SendTxBytesWithMetadataToPeer

func (w *Workflow) SendTxBytesWithMetadataToPeer(id peer.ID, txBytes []byte, metadata *txmetadata.TransactionMetadata) bool

func (*Workflow) SequencerMilestoneAttachWait

func (w *Workflow) SequencerMilestoneAttachWait(txBytes []byte, meta *txmetadata.TransactionMetadata, timeout time.Duration) (*vertex.WrappedTx, error)

SequencerMilestoneAttachWait attaches sequencer transaction synchronously. Waits up to timeout until attacher finishes

func (*Workflow) TxBytesFromStoreIn

func (w *Workflow) TxBytesFromStoreIn(txBytesWithMetadata []byte) (*ledger.TransactionID, error)

func (*Workflow) TxBytesIn

func (w *Workflow) TxBytesIn(txBytes []byte, opts ...TxInOption) (*ledger.TransactionID, error)

func (*Workflow) TxBytesInFromAPIQueued

func (w *Workflow) TxBytesInFromAPIQueued(txBytes []byte, trace bool)

func (*Workflow) TxBytesInFromPeerQueued

func (w *Workflow) TxBytesInFromPeerQueued(txBytes []byte, metaData *txmetadata.TransactionMetadata, from peer.ID)

func (*Workflow) TxFromStoreIn

func (w *Workflow) TxFromStoreIn(txid *ledger.TransactionID) (err error)

func (*Workflow) TxIn

func (w *Workflow) TxIn(tx *transaction.Transaction, opts ...TxInOption) error

func (*Workflow) TxInFromAPI

func (w *Workflow) TxInFromAPI(tx *transaction.Transaction, trace bool) error

func (*Workflow) TxInFromPeer

func (w *Workflow) TxInFromPeer(tx *transaction.Transaction, metaData *txmetadata.TransactionMetadata, from peer.ID) error

func (*Workflow) WaitTxIDDefined

func (w *Workflow) WaitTxIDDefined(txid *ledger.TransactionID, pollPeriod, timeout time.Duration) (vertex.Status, error)

Jump to

Keyboard shortcuts

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