Merge pull request #6441 from dirkmc/fix/block-put-flush-pin
Fix: flush pin on block put
Steven Allen committed
Jun 12, 2019 at 09:50 UTC
a7d3d0318f63fd6855ac80adbb00c3177b2f1b54
2 files changed
+6
-3
core/commands/block.go
+3
-3
@@ -121,10 +121,10 @@ var blockPutCmd = &cmds.Command{
121
Tagline: "Store input as an IPFS block.",
122
ShortDescription: `
123
'ipfs block put' is a plumbing command for storing raw IPFS blocks.
124
-It reads from stdin, and <key> is a base58 encoded multihash.
124
+It reads from stdin, and outputs the block's CID to stdout.
125
126
-By default CIDv0 is going to be generated. Setting 'mhtype' to anything other
127
-than 'sha2-256' or format to anything other than 'v0' will result in CIDv1.
126
+Unless specified, this command returns dag-pb CIDv0 CIDs. Setting 'mhtype' to anything
127
+other than 'sha2-256' or format to anything other than 'v0' will result in CIDv1.
128
`,
129
},
130
core/coreapi/block.go
+3
@@ -56,6 +56,9 @@ func (api *BlockAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Bloc
56
57
if settings.Pin {
58
api.pinning.PinWithMode(b.Cid(), pin.Recursive)
59
+ if err := api.pinning.Flush(); err != nil {
60
+ return nil, err
61
+ }
62
}
63
64
return &BlockStat{path: path.IpldPath(b.Cid()), size: len(data)}, nil