bufbs: Env var to disable blockstore buffering

This commit is contained in:
Łukasz Magiera 2020-04-01 22:37:34 +02:00
parent f6c260c49f
commit f727f1db26

View File

@ -2,13 +2,17 @@ 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
@ -16,6 +20,11 @@ type BufferedBS struct {
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,