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

21 lines
476 B
Go
Raw Normal View History

package utils
import (
"errors"
"os"
2021-07-29 11:53:13 +00:00
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon-lib/kv/mdbx"
2021-07-29 10:23:23 +00:00
"github.com/ledgerwatch/log/v3"
)
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()
}