Skip to content

Commit

Permalink
Merge pull request #6441 from dirkmc/fix/block-put-flush-pin
Browse files Browse the repository at this point in the history
Fix: flush pin on block put
  • Loading branch information
Stebalien authored Jun 12, 2019
2 parents 5353dce + 4b6175f commit ffb8bf4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/commands/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ var blockPutCmd = &cmds.Command{
Tagline: "Store input as an IPFS block.",
ShortDescription: `
'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 the block's CID to stdout.
By default CIDv0 is going to be generated. Setting 'mhtype' to anything other
than 'sha2-256' or format to anything other than 'v0' will result in CIDv1.
Unless specified, this command returns dag-pb CIDv0 CIDs. Setting 'mhtype' to anything
other than 'sha2-256' or format to anything other than 'v0' will result in CIDv1.
`,
},

Expand Down
3 changes: 3 additions & 0 deletions core/coreapi/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ func (api *BlockAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Bloc

if settings.Pin {
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
Expand Down

0 comments on commit ffb8bf4

Please sign in to comment.