Skip to content

Commit

Permalink
bufbs: Env var to disable blockstore buffering
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Apr 1, 2020
1 parent cb5e454 commit e04786c
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 e04786c

Please sign in to comment.