提交 bc02a61e 作者: Dirk McCormick

fix: flush pin on block put

上级 ccef991a
...@@ -123,10 +123,10 @@ var blockPutCmd = &cmds.Command{ ...@@ -123,10 +123,10 @@ var blockPutCmd = &cmds.Command{
Tagline: "Store input as an IPFS block.", Tagline: "Store input as an IPFS block.",
ShortDescription: ` ShortDescription: `
'ipfs block put' is a plumbing command for storing raw IPFS blocks. 'ipfs block put' is a plumbing command for storing raw IPFS blocks.
It reads from stdin, and <key> is a base58 encoded multihash. It reads from stdin, and outputs a multihash to stdout.
By default CIDv0 is going to be generated. Setting 'mhtype' to anything other By default the multihash is output in CIDv0 format. Setting 'mhtype' to anything
than 'sha2-256' or format to anything other than 'v0' will result in CIDv1. other than 'sha2-256' or format to anything other than 'v0' will result in CIDv1.
`, `,
}, },
......
...@@ -56,6 +56,9 @@ func (api *BlockAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Bloc ...@@ -56,6 +56,9 @@ func (api *BlockAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Bloc
if settings.Pin { if settings.Pin {
api.pinning.PinWithMode(b.Cid(), pin.Recursive) api.pinning.PinWithMode(b.Cid(), pin.Recursive)
if err := api.pinning.Flush(); err != nil {
return nil, err
}
} }
return &BlockStat{path: path.IpldPath(b.Cid()), size: len(data)}, nil return &BlockStat{path: path.IpldPath(b.Cid()), size: len(data)}, nil
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论