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) ChainHead(ctx context.Context) (*types.TipSet, error)
ChainGetBlockMessages(context.Context, cid.Cid) (*BlockMessages, error) ChainGetBlockMessages(context.Context, cid.Cid) (*BlockMessages, error)
ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, 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) ChainGetTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)
ChainGetTipSetByHeight(ctx context.Context, h abi.ChainEpoch, 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) 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) `` 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) `` 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) `` 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 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) { func (s *GatewayStruct) ChainGetTipSet(p0 context.Context, p1 types.TipSetKey) (*types.TipSet, error) {
if s.Internal.ChainGetTipSet == nil { if s.Internal.ChainGetTipSet == nil {
return nil, ErrNotSupported 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 // +build debug 2k
package build package build

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,6 +40,7 @@ type TargetAPI interface {
ChainHasObj(context.Context, cid.Cid) (bool, error) ChainHasObj(context.Context, cid.Cid) (bool, error)
ChainHead(ctx context.Context) (*types.TipSet, error) ChainHead(ctx context.Context) (*types.TipSet, error)
ChainNotify(context.Context) (<-chan []*api.HeadChange, 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) ChainReadObj(context.Context, cid.Cid) ([]byte, error)
GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, tsk types.TipSetKey) (*types.Message, 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) 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) 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) { func (gw *Node) ChainReadObj(ctx context.Context, c cid.Cid) ([]byte, error) {
return gw.target.ChainReadObj(ctx, c) return gw.target.ChainReadObj(ctx, c)
} }

View File

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

View File

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

View File

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