Remove ChainPutMany

This commit is contained in:
Geoff Stuart 2022-06-10 12:59:06 -04:00
parent 64d62f1f7e
commit 801c670edd
20 changed files with 8 additions and 156 deletions

View File

@ -40,7 +40,6 @@ type ChainIO interface {
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
ChainHasObj(context.Context, cid.Cid) (bool, error)
ChainPutObj(context.Context, blocks.Block) error
ChainPutMany(context.Context, []blocks.Block) error
}
const LookbackNoLimit = abi.ChainEpoch(-1)
@ -129,9 +128,6 @@ type FullNode interface {
// ChainPutObj puts a given object into the block store
ChainPutObj(context.Context, blocks.Block) error //perm:admin
// ChainPutMany puts a given array of objects into the block store
ChainPutMany(context.Context, []blocks.Block) error //perm:admin
// ChainStatObj returns statistics about the graph referenced by 'obj'.
// If 'base' is also specified, then the returned stat will be a diff
// between the two objects.

View File

@ -32,7 +32,6 @@ import (
type Gateway interface {
ChainHasObj(context.Context, cid.Cid) (bool, error)
ChainPutObj(context.Context, blocks.Block) error
ChainPutMany(context.Context, []blocks.Block) error
ChainHead(ctx context.Context) (*types.TipSet, error)
ChainGetParentMessages(context.Context, cid.Cid) ([]Message, error)
ChainGetParentReceipts(context.Context, cid.Cid) ([]*types.MessageReceipt, error)

View File

@ -375,20 +375,6 @@ func (mr *MockFullNodeMockRecorder) ChainNotify(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainNotify", reflect.TypeOf((*MockFullNode)(nil).ChainNotify), arg0)
}
// ChainPutMany mocks base method.
func (m *MockFullNode) ChainPutMany(arg0 context.Context, arg1 []blocks.Block) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ChainPutMany", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// ChainPutMany indicates an expected call of ChainPutMany.
func (mr *MockFullNodeMockRecorder) ChainPutMany(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainPutMany", reflect.TypeOf((*MockFullNode)(nil).ChainPutMany), arg0, arg1)
}
// ChainPutObj mocks base method.
func (m *MockFullNode) ChainPutObj(arg0 context.Context, arg1 blocks.Block) error {
m.ctrl.T.Helper()

View File

@ -49,8 +49,6 @@ type ChainIOStruct struct {
Internal struct {
ChainHasObj func(p0 context.Context, p1 cid.Cid) (bool, error) ``
ChainPutMany func(p0 context.Context, p1 []blocks.Block) error ``
ChainPutObj func(p0 context.Context, p1 blocks.Block) error ``
ChainReadObj func(p0 context.Context, p1 cid.Cid) ([]byte, error) ``
@ -146,8 +144,6 @@ type FullNodeStruct struct {
ChainNotify func(p0 context.Context) (<-chan []*HeadChange, error) `perm:"read"`
ChainPutMany func(p0 context.Context, p1 []blocks.Block) error `perm:"admin"`
ChainPutObj func(p0 context.Context, p1 blocks.Block) error `perm:"admin"`
ChainReadObj func(p0 context.Context, p1 cid.Cid) ([]byte, error) `perm:"read"`
@ -520,8 +516,6 @@ type GatewayStruct struct {
ChainNotify func(p0 context.Context) (<-chan []*HeadChange, error) ``
ChainPutMany func(p0 context.Context, p1 []blocks.Block) error ``
ChainPutObj func(p0 context.Context, p1 blocks.Block) error ``
ChainReadObj func(p0 context.Context, p1 cid.Cid) ([]byte, error) ``
@ -990,17 +984,6 @@ func (s *ChainIOStub) ChainHasObj(p0 context.Context, p1 cid.Cid) (bool, error)
return false, ErrNotSupported
}
func (s *ChainIOStruct) ChainPutMany(p0 context.Context, p1 []blocks.Block) error {
if s.Internal.ChainPutMany == nil {
return ErrNotSupported
}
return s.Internal.ChainPutMany(p0, p1)
}
func (s *ChainIOStub) ChainPutMany(p0 context.Context, p1 []blocks.Block) error {
return ErrNotSupported
}
func (s *ChainIOStruct) ChainPutObj(p0 context.Context, p1 blocks.Block) error {
if s.Internal.ChainPutObj == nil {
return ErrNotSupported
@ -1342,17 +1325,6 @@ func (s *FullNodeStub) ChainNotify(p0 context.Context) (<-chan []*HeadChange, er
return nil, ErrNotSupported
}
func (s *FullNodeStruct) ChainPutMany(p0 context.Context, p1 []blocks.Block) error {
if s.Internal.ChainPutMany == nil {
return ErrNotSupported
}
return s.Internal.ChainPutMany(p0, p1)
}
func (s *FullNodeStub) ChainPutMany(p0 context.Context, p1 []blocks.Block) error {
return ErrNotSupported
}
func (s *FullNodeStruct) ChainPutObj(p0 context.Context, p1 blocks.Block) error {
if s.Internal.ChainPutObj == nil {
return ErrNotSupported
@ -3344,17 +3316,6 @@ func (s *GatewayStub) ChainNotify(p0 context.Context) (<-chan []*HeadChange, err
return nil, ErrNotSupported
}
func (s *GatewayStruct) ChainPutMany(p0 context.Context, p1 []blocks.Block) error {
if s.Internal.ChainPutMany == nil {
return ErrNotSupported
}
return s.Internal.ChainPutMany(p0, p1)
}
func (s *GatewayStub) ChainPutMany(p0 context.Context, p1 []blocks.Block) error {
return ErrNotSupported
}
func (s *GatewayStruct) ChainPutObj(p0 context.Context, p1 blocks.Block) error {
if s.Internal.ChainPutObj == nil {
return ErrNotSupported

View File

@ -114,9 +114,6 @@ type FullNode interface {
// ChainPutObj puts and object into the blockstore
ChainPutObj(context.Context, blocks.Block) error
// ChainPutMany puts an array of objects into the blockstore
ChainPutMany(context.Context, []blocks.Block) error
// ChainHasObj checks if a given CID exists in the chain blockstore.
ChainHasObj(context.Context, cid.Cid) (bool, error) //perm:read

View File

@ -36,7 +36,6 @@ import (
type Gateway interface {
ChainHasObj(context.Context, cid.Cid) (bool, error)
ChainPutObj(context.Context, blocks.Block) error
ChainPutMany(context.Context, []blocks.Block) error
ChainHead(ctx context.Context) (*types.TipSet, error)
ChainGetBlockMessages(context.Context, cid.Cid) (*api.BlockMessages, error)
ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error)

View File

@ -75,8 +75,6 @@ type FullNodeStruct struct {
ChainNotify func(p0 context.Context) (<-chan []*api.HeadChange, error) `perm:"read"`
ChainPutMany func(p0 context.Context, p1 []blocks.Block) error ``
ChainPutObj func(p0 context.Context, p1 blocks.Block) error ``
ChainReadObj func(p0 context.Context, p1 cid.Cid) ([]byte, error) `perm:"read"`
@ -425,8 +423,6 @@ type GatewayStruct struct {
ChainNotify func(p0 context.Context) (<-chan []*api.HeadChange, error) ``
ChainPutMany func(p0 context.Context, p1 []blocks.Block) error ``
ChainPutObj func(p0 context.Context, p1 blocks.Block) error ``
ChainReadObj func(p0 context.Context, p1 cid.Cid) ([]byte, error) ``
@ -691,17 +687,6 @@ func (s *FullNodeStub) ChainNotify(p0 context.Context) (<-chan []*api.HeadChange
return nil, ErrNotSupported
}
func (s *FullNodeStruct) ChainPutMany(p0 context.Context, p1 []blocks.Block) error {
if s.Internal.ChainPutMany == nil {
return ErrNotSupported
}
return s.Internal.ChainPutMany(p0, p1)
}
func (s *FullNodeStub) ChainPutMany(p0 context.Context, p1 []blocks.Block) error {
return ErrNotSupported
}
func (s *FullNodeStruct) ChainPutObj(p0 context.Context, p1 blocks.Block) error {
if s.Internal.ChainPutObj == nil {
return ErrNotSupported
@ -2561,17 +2546,6 @@ func (s *GatewayStub) ChainNotify(p0 context.Context) (<-chan []*api.HeadChange,
return nil, ErrNotSupported
}
func (s *GatewayStruct) ChainPutMany(p0 context.Context, p1 []blocks.Block) error {
if s.Internal.ChainPutMany == nil {
return ErrNotSupported
}
return s.Internal.ChainPutMany(p0, p1)
}
func (s *GatewayStub) ChainPutMany(p0 context.Context, p1 []blocks.Block) error {
return ErrNotSupported
}
func (s *GatewayStruct) ChainPutObj(p0 context.Context, p1 blocks.Block) error {
if s.Internal.ChainPutObj == nil {
return ErrNotSupported

View File

@ -378,20 +378,6 @@ func (mr *MockFullNodeMockRecorder) ChainNotify(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainNotify", reflect.TypeOf((*MockFullNode)(nil).ChainNotify), arg0)
}
// ChainPutMany mocks base method.
func (m *MockFullNode) ChainPutMany(arg0 context.Context, arg1 []blocks.Block) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ChainPutMany", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// ChainPutMany indicates an expected call of ChainPutMany.
func (mr *MockFullNodeMockRecorder) ChainPutMany(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainPutMany", reflect.TypeOf((*MockFullNode)(nil).ChainPutMany), arg0, arg1)
}
// ChainPutObj mocks base method.
func (m *MockFullNode) ChainPutObj(arg0 context.Context, arg1 blocks.Block) error {
m.ctrl.T.Helper()

View File

@ -12,7 +12,6 @@ type ChainIO interface {
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
ChainHasObj(context.Context, cid.Cid) (bool, error)
ChainPutObj(context.Context, blocks.Block) error
ChainPutMany(context.Context, []blocks.Block) error
}
type apiBlockstore struct {
@ -56,7 +55,13 @@ func (a *apiBlockstore) Put(ctx context.Context, block blocks.Block) error {
}
func (a *apiBlockstore) PutMany(ctx context.Context, blocks []blocks.Block) error {
return a.api.ChainPutMany(ctx, blocks)
for _, block := range blocks {
err := a.api.ChainPutObj(ctx, block)
if err != nil {
return err
}
}
return nil
}
func (a *apiBlockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) {

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1431,7 +1431,7 @@ func upgradeActorsV8Common(
return newRoot, nil
}
func UpgradeActorsCode(ctx context.Context, sm *stmgr.StateManager, newActorsManifestCid cid.Cid, root cid.Cid, av actors.Version, oldStateTreeVersion types.StateTreeVersion, newStateTreeVersion types.StateTreeVersion) (cid.Cid, error) { // nolint
func UpgradeActorsCode(ctx context.Context, sm *stmgr.StateManager, newActorsManifestCid cid.Cid, root cid.Cid, av actors.Version, oldStateTreeVersion types.StateTreeVersion, newStateTreeVersion types.StateTreeVersion) (cid.Cid, error) {
bstore := sm.ChainStore().StateBlockstore()
return LiteMigration(ctx, bstore, newActorsManifestCid, root, av, oldStateTreeVersion, newStateTreeVersion)
}

View File

@ -45,10 +45,6 @@ func (m *MockAPI) ChainPutObj(ctx context.Context, block blocks.Block) error {
return m.bs.Put(ctx, block)
}
func (m *MockAPI) ChainPutMany(ctx context.Context, blocks []blocks.Block) error {
return m.bs.PutMany(ctx, blocks)
}
func (m *MockAPI) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) {
m.lk.Lock()
defer m.lk.Unlock()

View File

@ -29,7 +29,6 @@
* [ChainHasObj](#ChainHasObj)
* [ChainHead](#ChainHead)
* [ChainNotify](#ChainNotify)
* [ChainPutMany](#ChainPutMany)
* [ChainPutObj](#ChainPutObj)
* [ChainReadObj](#ChainReadObj)
* [ChainSetHead](#ChainSetHead)
@ -973,23 +972,6 @@ Response:
]
```
### ChainPutMany
ChainPutMany puts an array of objects into the blockstore
Perms:
Inputs:
```json
[
[
{}
]
]
```
Response: `{}`
### ChainPutObj
ChainPutObj puts and object into the blockstore

View File

@ -28,7 +28,6 @@
* [ChainHasObj](#ChainHasObj)
* [ChainHead](#ChainHead)
* [ChainNotify](#ChainNotify)
* [ChainPutMany](#ChainPutMany)
* [ChainPutObj](#ChainPutObj)
* [ChainReadObj](#ChainReadObj)
* [ChainSetHead](#ChainSetHead)
@ -961,23 +960,6 @@ Response:
]
```
### ChainPutMany
ChainPutMany puts a given array of objects into the block store
Perms: admin
Inputs:
```json
[
[
{}
]
]
```
Response: `{}`
### ChainPutObj
ChainPutObj puts a given object into the block store

View File

@ -48,7 +48,6 @@ type TargetAPI interface {
ChainGetPath(ctx context.Context, from, to types.TipSetKey) ([]*api.HeadChange, error)
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
ChainPutObj(context.Context, blocks.Block) error
ChainPutMany(context.Context, []blocks.Block) error
ChainGetGenesis(context.Context) (*types.TipSet, 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)
@ -258,10 +257,6 @@ func (gw *Node) ChainPutObj(context.Context, blocks.Block) error {
return xerrors.New("not supported")
}
func (gw *Node) ChainPutMany(context.Context, []blocks.Block) error {
return xerrors.New("not supported")
}
func (gw *Node) GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, tsk types.TipSetKey) (*types.Message, error) {
if err := gw.checkTipsetKey(ctx, tsk); err != nil {
return nil, err

View File

@ -22,7 +22,6 @@ type apiWrapper struct {
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
ChainHasObj(context.Context, cid.Cid) (bool, error)
ChainPutObj(context.Context, blocks.Block) error
ChainPutMany(context.Context, []blocks.Block) error
}
}

View File

@ -266,10 +266,6 @@ func (a *ChainAPI) ChainPutObj(ctx context.Context, obj blocks.Block) error {
return a.ExposedBlockstore.Put(ctx, obj)
}
func (a *ChainAPI) ChainPutMany(ctx context.Context, objs []blocks.Block) error {
return a.ExposedBlockstore.PutMany(ctx, objs)
}
func (a *ChainAPI) ChainDeleteObj(ctx context.Context, obj cid.Cid) error {
return a.ExposedBlockstore.DeleteBlock(ctx, obj)
}

View File

@ -124,7 +124,6 @@ type fullNodeFilteredAPI interface {
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
ChainHasObj(context.Context, cid.Cid) (bool, error)
ChainPutObj(context.Context, blocks.Block) error
ChainPutMany(context.Context, []blocks.Block) error
ChainGetTipSet(ctx context.Context, key types.TipSetKey) (*types.TipSet, error)
WalletSign(context.Context, address.Address, []byte) (*crypto.Signature, error)