msg

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: Apache-2.0, MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMessageWaitLookback uint64 = 2 // in most cases, this should be enough to avoid races.

Functions

This section is empty.

Types

type ChainMessage

type ChainMessage struct {
	Message *types.SignedMessage
	Block   *block.Block
	Receipt *vm.MessageReceipt
}

ChainMessage is an on-chain message with its block and receipt.

type Previewer

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

Previewer calculates the amount of Gas needed for a command

func NewPreviewer

func NewPreviewer(chainReader previewerChainReader, cst cbor.IpldStore, bs bstore.Blockstore, processor messagePreviewer) *Previewer

NewPreviewer constructs a Previewer.

func (*Previewer) Preview

func (p *Previewer) Preview(ctx context.Context, optFrom, to address.Address, method abi.MethodNum, params ...interface{}) (gas.Unit, error)

Preview sends a read-only message to an actor.

type WaitPredicate

type WaitPredicate func(msg *types.SignedMessage, msgCid cid.Cid) bool

WaitPredicate is a function that identifies a message and returns true when found.

type Waiter

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

Waiter waits for a message to appear on chain.

func NewWaiter

func NewWaiter(chainStore waiterChainReader, messages chain.MessageProvider, bs bstore.Blockstore, cst cbor.IpldStore) *Waiter

NewWaiter returns a new Waiter.

func (*Waiter) Find

func (w *Waiter) Find(ctx context.Context, lookback uint64, pred WaitPredicate) (*ChainMessage, bool, error)

Find searches the blockchain history (but doesn't wait).

func (*Waiter) Wait

func (w *Waiter) Wait(ctx context.Context, msgCid cid.Cid, lookback uint64, cb func(*block.Block, *types.SignedMessage, *vm.MessageReceipt) error) error

Wait uses WaitPredicate to invoke the callback when a message with the given cid appears on chain.

func (*Waiter) WaitPredicate

func (w *Waiter) WaitPredicate(ctx context.Context, lookback uint64, pred WaitPredicate, cb func(*block.Block, *types.SignedMessage, *vm.MessageReceipt) error) error

WaitPredicate invokes the callback when the passed predicate succeeds. See api description.

Note: this method does too much -- the callback should just receive the tipset containing the message and the caller should pull the receipt out of the block if in fact that's what it wants to do, using something like receiptFromTipset. Something like receiptFromTipset is necessary because not every message in a block will have a receipt in the tipset: it might be a duplicate message. This method will always check for the message in the current head tipset. A lookback parameter > 1 will cause this method to check for the message in up to that many previous tipsets on the chain of the current head.

Jump to

Keyboard shortcuts

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