Documentation ¶
Index ¶
- Constants
- type CalledHandler
- type CheckFunc
- type Events
- func (e *Events) Called(check CheckFunc, hnd CalledHandler, rev RevertHandler, confidence int, ...) error
- func (e *Events) CalledMsg(ctx context.Context, hnd CalledHandler, rev RevertHandler, confidence int, ...) error
- func (e *Events) ChainAt(hnd HeightHandler, rev RevertHandler, confidence int, h uint64) error
- func (e *Events) CheckMsg(ctx context.Context, smsg store.ChainMsg, hnd CalledHandler) CheckFunc
- func (e *Events) MatchMsg(inmsg *types.Message) MatchFunc
- type HeightHandler
- type MatchFunc
- type RevertHandler
Constants ¶
const NoTimeout = math.MaxUint64
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CalledHandler ¶
type CalledHandler func(msg *types.Message, rec *types.MessageReceipt, ts *types.TipSet, curH uint64) (more bool, err error)
`ts` is the tipset, in which the `msg` is included. `curH`-`ts.Height` = `confidence`
type CheckFunc ¶
CheckFunc is used for atomicity guarantees. If the condition the callbacks wait for has already happened in tipset `ts`
If `done` is true, timeout won't be triggered If `more` is false, no messages will be sent to CalledHandler (RevertHandler
may still be called)
type Events ¶
type Events struct {
// contains filtered or unexported fields
}
func (*Events) Called ¶
func (e *Events) Called(check CheckFunc, hnd CalledHandler, rev RevertHandler, confidence int, timeout uint64, mf MatchFunc) error
Called registers a callbacks which are triggered when a specified method is
called on an actor, or a timeout is reached.
`CheckFunc` callback is invoked immediately with a recent tipset, it returns two booleans - `done`, and `more`.
`done` should be true when some on-chain action we are waiting for has happened. When `done` is set to true, timeout trigger is disabled.
`more` should be false when we don't want to receive new notifications through CalledHandler. Note that notifications may still be delivered to RevertHandler
- `CalledHandler` is called when the specified event was observed on-chain, and a confidence threshold was reached, or the specified `timeout` height was reached with no events observed. When this callback is invoked on a timeout, `msg` is set to nil. This callback returns a boolean specifying whether further notifications should be sent, like `more` return param from `CheckFunc` above.
- `RevertHandler` is called after apply handler, when we drop the tipset containing the message. The tipset passed as the argument is the tipset that is being dropped. Note that the message dropped may be re-applied in a different tipset in small amount of time.
func (*Events) CalledMsg ¶
func (e *Events) CalledMsg(ctx context.Context, hnd CalledHandler, rev RevertHandler, confidence int, timeout uint64, msg store.ChainMsg) error
func (*Events) ChainAt ¶
func (e *Events) ChainAt(hnd HeightHandler, rev RevertHandler, confidence int, h uint64) error
ChainAt invokes the specified `HeightHandler` when the chain reaches the
specified height+confidence threshold. If the chain is rolled-back under the specified height, `RevertHandler` will be called.
ts passed to handlers is the tipset at the specified, or above, if lower tipsets were null
type HeightHandler ¶
`curH`-`ts.Height` = `confidence`