bufbs: Env var to disable blockstore buffering
This commit is contained in:
parent
f6c260c49f
commit
f727f1db26
@ -2,13 +2,17 @@ package bufbstore
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"os"
|
||||||
|
|
||||||
block "github.com/ipfs/go-block-format"
|
block "github.com/ipfs/go-block-format"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
ds "github.com/ipfs/go-datastore"
|
ds "github.com/ipfs/go-datastore"
|
||||||
bstore "github.com/ipfs/go-ipfs-blockstore"
|
bstore "github.com/ipfs/go-ipfs-blockstore"
|
||||||
|
logging "github.com/ipfs/go-log/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var log = logging.Logger("bufbs")
|
||||||
|
|
||||||
type BufferedBS struct {
|
type BufferedBS struct {
|
||||||
read bstore.Blockstore
|
read bstore.Blockstore
|
||||||
write bstore.Blockstore
|
write bstore.Blockstore
|
||||||
@ -16,6 +20,11 @@ type BufferedBS struct {
|
|||||||
|
|
||||||
func NewBufferedBstore(base bstore.Blockstore) *BufferedBS {
|
func NewBufferedBstore(base bstore.Blockstore) *BufferedBS {
|
||||||
buf := bstore.NewBlockstore(ds.NewMapDatastore())
|
buf := bstore.NewBlockstore(ds.NewMapDatastore())
|
||||||
|
if os.Getenv("LOTUS_DISABLE_VM_BUF") == "iknowitsabadidea" {
|
||||||
|
log.Warn("VM BLOCKSTORE BUFFERING IS DISABLED")
|
||||||
|
buf = base
|
||||||
|
}
|
||||||
|
|
||||||
return &BufferedBS{
|
return &BufferedBS{
|
||||||
read: base,
|
read: base,
|
||||||
write: buf,
|
write: buf,
|
||||||
|
Loading…
Reference in New Issue
Block a user