feat: expose ChainGetPath on the gateway

This commit is contained in:
Steven Allen 2021-08-27 12:25:43 -07:00
parent 003eae81ce
commit 1cf556c3a2
27 changed files with 46 additions and 12 deletions

View File

@ -33,6 +33,7 @@ type Gateway interface {
ChainHead(ctx context.Context) (*types.TipSet, error)
ChainGetBlockMessages(context.Context, cid.Cid) (*BlockMessages, error)
ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error)
ChainGetPath(ctx context.Context, from, to types.TipSetKey) ([]*HeadChange, error)
ChainGetTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)
ChainGetTipSetByHeight(ctx context.Context, h abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error)
ChainGetTipSetAfterHeight(ctx context.Context, h abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error)

View File

@ -480,6 +480,8 @@ type GatewayStruct struct {
ChainGetMessage func(p0 context.Context, p1 cid.Cid) (*types.Message, error) ``
ChainGetPath func(p0 context.Context, p1 types.TipSetKey, p2 types.TipSetKey) ([]*HeadChange, error) ``
ChainGetTipSet func(p0 context.Context, p1 types.TipSetKey) (*types.TipSet, error) ``
ChainGetTipSetAfterHeight func(p0 context.Context, p1 abi.ChainEpoch, p2 types.TipSetKey) (*types.TipSet, error) ``
@ -3039,6 +3041,17 @@ func (s *GatewayStub) ChainGetMessage(p0 context.Context, p1 cid.Cid) (*types.Me
return nil, ErrNotSupported
}
func (s *GatewayStruct) ChainGetPath(p0 context.Context, p1 types.TipSetKey, p2 types.TipSetKey) ([]*HeadChange, error) {
if s.Internal.ChainGetPath == nil {
return *new([]*HeadChange), ErrNotSupported
}
return s.Internal.ChainGetPath(p0, p1, p2)
}
func (s *GatewayStub) ChainGetPath(p0 context.Context, p1 types.TipSetKey, p2 types.TipSetKey) ([]*HeadChange, error) {
return *new([]*HeadChange), ErrNotSupported
}
func (s *GatewayStruct) ChainGetTipSet(p0 context.Context, p1 types.TipSetKey) (*types.TipSet, error) {
if s.Internal.ChainGetTipSet == nil {
return nil, ErrNotSupported

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +1,4 @@
//go:build debug || 2k
// +build debug 2k
package build

View File

@ -1,3 +1,4 @@
//go:build butterflynet
// +build butterflynet
package build

View File

@ -1,3 +1,4 @@
//go:build calibnet
// +build calibnet
package build

View File

@ -1,3 +1,4 @@
//go:build debug
// +build debug
package build

View File

@ -1,3 +1,4 @@
//go:build interopnet
// +build interopnet
package build

View File

@ -1,10 +1,5 @@
// +build !debug
// +build !2k
// +build !testground
// +build !calibnet
// +build !nerpanet
// +build !butterflynet
// +build !interopnet
//go:build !debug && !2k && !testground && !calibnet && !nerpanet && !butterflynet && !interopnet
// +build !debug,!2k,!testground,!calibnet,!nerpanet,!butterflynet,!interopnet
package build

View File

@ -1,3 +1,4 @@
//go:build nerpanet
// +build nerpanet
package build

View File

@ -1,3 +1,4 @@
//go:build !testground
// +build !testground
package build

View File

@ -1,3 +1,4 @@
//go:build testground
// +build testground
// This file makes hardcoded parameters (const) configurable as vars.

View File

@ -1,4 +1,5 @@
//+build tools
//go:build tools
// +build tools
package build

View File

@ -1,4 +1,5 @@
//+build gofuzz
//go:build gofuzz
// +build gofuzz
package types

View File

@ -1,3 +1,4 @@
//go:build !nodaemon
// +build !nodaemon
package main

View File

@ -1,3 +1,4 @@
//go:build nodaemon
// +build nodaemon
package main

View File

@ -1,3 +1,4 @@
//go:build debug
// +build debug
package main

View File

@ -1,4 +1,5 @@
//+build cgo
//go:build cgo
// +build cgo
package ffiwrapper

View File

@ -1,4 +1,5 @@
//+build cgo
//go:build cgo
// +build cgo
package ffiwrapper

View File

@ -1,4 +1,5 @@
//+build cgo
//go:build cgo
// +build cgo
package ffiwrapper

View File

@ -1,3 +1,4 @@
//go:build !linux
// +build !linux
package fsutil

View File

@ -40,6 +40,7 @@ type TargetAPI interface {
ChainHasObj(context.Context, cid.Cid) (bool, error)
ChainHead(ctx context.Context) (*types.TipSet, error)
ChainNotify(context.Context) (<-chan []*api.HeadChange, error)
ChainGetPath(ctx context.Context, from, to types.TipSetKey) ([]*api.HeadChange, error)
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, tsk types.TipSetKey) (*types.Message, error)
MpoolPushUntrusted(ctx context.Context, sm *types.SignedMessage) (cid.Cid, error)
@ -216,6 +217,10 @@ func (gw *Node) ChainNotify(ctx context.Context) (<-chan []*api.HeadChange, erro
return gw.target.ChainNotify(ctx)
}
func (gw *Node) ChainGetPath(ctx context.Context, from, to types.TipSetKey) ([]*api.HeadChange, error) {
return gw.target.ChainGetPath(ctx, from, to)
}
func (gw *Node) ChainReadObj(ctx context.Context, c cid.Cid) ([]byte, error) {
return gw.target.ChainReadObj(ctx, c)
}

View File

@ -1,3 +1,4 @@
//go:build freebsd
// +build freebsd
package ulimit

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package ulimit

View File

@ -1,3 +1,4 @@
//go:build darwin || linux || netbsd || openbsd
// +build darwin linux netbsd openbsd
package ulimit