2021-08-04 00:10:30 +00:00
|
|
|
package events
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-06-14 15:00:51 +00:00
|
|
|
"github.com/ipfs/go-cid"
|
|
|
|
|
2021-08-04 00:10:30 +00:00
|
|
|
"github.com/filecoin-project/go-address"
|
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
2022-06-14 15:00:51 +00:00
|
|
|
|
2021-08-04 00:10:30 +00:00
|
|
|
"github.com/filecoin-project/lotus/api"
|
|
|
|
"github.com/filecoin-project/lotus/chain/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
type uncachedAPI interface {
|
|
|
|
ChainNotify(context.Context) (<-chan []*api.HeadChange, error)
|
|
|
|
ChainGetPath(ctx context.Context, from, to types.TipSetKey) ([]*api.HeadChange, error)
|
|
|
|
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
|
|
|
|
|
|
|
|
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) // optional / for CalledMsg
|
|
|
|
}
|
|
|
|
|
|
|
|
type cache struct {
|
|
|
|
*tipSetCache
|
|
|
|
*messageCache
|
|
|
|
uncachedAPI
|
|
|
|
}
|
|
|
|
|
2024-02-19 04:54:38 +00:00
|
|
|
func newCache(api EventHelperAPI, gcConfidence abi.ChainEpoch) *cache {
|
2021-08-04 00:10:30 +00:00
|
|
|
return &cache{
|
|
|
|
newTSCache(api, gcConfidence),
|
|
|
|
newMessageCache(api),
|
|
|
|
api,
|
|
|
|
}
|
|
|
|
}
|