Merge pull request #1489 from filecoin-project/feat/disable-bst-buf
bufbs: Env var to disable blockstore buffering
This commit is contained in:
commit
ff510b7542
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user