Skip to content

Commit

Permalink
Merge pull request #1489 from filecoin-project/feat/disable-bst-buf
Browse files Browse the repository at this point in the history
bufbs: Env var to disable blockstore buffering
  • Loading branch information
Jakub Sztandera authored Apr 1, 2020
2 parents 565099f + f727f1d commit ff510b7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/bufbstore/buf_bstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,29 @@ package bufbstore

import (
"context"
"os"

block "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
ds "github.com/ipfs/go-datastore"
bstore "github.com/ipfs/go-ipfs-blockstore"
logging "github.com/ipfs/go-log/v2"
)

var log = logging.Logger("bufbs")

type BufferedBS struct {
read bstore.Blockstore
write bstore.Blockstore
}

func NewBufferedBstore(base bstore.Blockstore) *BufferedBS {
buf := bstore.NewBlockstore(ds.NewMapDatastore())
if os.Getenv("LOTUS_DISABLE_VM_BUF") == "iknowitsabadidea" {
log.Warn("VM BLOCKSTORE BUFFERING IS DISABLED")
buf = base
}

return &BufferedBS{
read: base,
write: buf,
Expand Down

0 comments on commit ff510b7

Please sign in to comment.