Add putObj and putMany to apiBlockstore

This commit is contained in:
Geoff Stuart
2022-06-09 15:13:42 -04:00
parent 81cacd76a7
commit 5c0f2c8ae6
20 changed files with 292 additions and 7701 deletions
+9
View File
@@ -15,6 +15,7 @@ import (
"go.uber.org/fx"
"golang.org/x/xerrors"
blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-blockservice"
"github.com/ipfs/go-cid"
offline "github.com/ipfs/go-ipfs-exchange-offline"
@@ -261,6 +262,14 @@ func (m *ChainModule) ChainReadObj(ctx context.Context, obj cid.Cid) ([]byte, er
return blk.RawData(), nil
}
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)
}