erigon-pulse/cmd/snapshots/utils/utils.go

21 lines
481 B
Go
Raw Normal View History

package utils
import (
"errors"
"os"
"github.com/ledgerwatch/erigon/ethdb/kv"
"github.com/ledgerwatch/erigon/ethdb/mdbx"
"github.com/ledgerwatch/erigon/log"
)
var ErrUnsupported error = errors.New("unsupported KV type")
2021-06-16 10:57:58 +00:00
func RmTmpFiles(snapshotPath string) error {
return os.Remove(snapshotPath + "/mdbx.lck")
}
2021-07-28 03:43:51 +00:00
func OpenSnapshotKV(configsFunc mdbx.TableCfgFunc, path string) kv.RwDB {
return mdbx.NewMDBX(log.New()).WithTablessCfg(configsFunc).Path(path).MustOpen()
}