utils

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2022 License: LGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDatabaseDir = "db"

DefaultDatabaseDir directory inside basepath where database contents are stored

Variables

View Source
var (
	ErrFindProjectRoot = errors.New("cannot find project root")
)

Functions

func BasePath

func BasePath(name string) string

BasePath attempts to create a data directory using the given name within the gossamer directory within the user's HOME directory, returns absolute path or, if unable to locate HOME directory, returns within current directory

func ExpandDir

func ExpandDir(targetPath string) string

ExpandDir expands a tilde prefix path to a full home path

func GetDevGenesisPath added in v0.7.0

func GetDevGenesisPath(t *testing.T) string

GetDevGenesisPath gets the dev genesis path

func GetDevGenesisSpecPathTest added in v0.7.0

func GetDevGenesisSpecPathTest(t *testing.T) string

GetDevGenesisSpecPathTest gets the dev genesis spec path

func GetDevV3SubstrateGenesisPath added in v0.7.0

func GetDevV3SubstrateGenesisPath(t *testing.T) string

GetDevV3SubstrateGenesisPath gets the v3 substrate dev genesis path

func GetGssmrGenesisPath

func GetGssmrGenesisPath() (path string, err error)

GetGssmrGenesisPath gets the gssmr genesis path and returns an error if it cannot find it.

func GetGssmrGenesisPathTest added in v0.7.0

func GetGssmrGenesisPathTest(t *testing.T) string

GetGssmrGenesisPathTest gets the gssmr genesis path and fails the test if it cannot find it.

func GetGssmrGenesisRawPath added in v0.2.0

func GetGssmrGenesisRawPath() (path string, err error)

GetGssmrGenesisRawPath gets the gssmr raw genesis path and returns an error if it cannot find it.

func GetGssmrGenesisRawPathTest added in v0.7.0

func GetGssmrGenesisRawPathTest(t *testing.T) string

GetGssmrGenesisRawPathTest gets the gssmr raw genesis path and fails the test if it cannot find it.

func GetGssmrV3SubstrateGenesisPath added in v0.7.0

func GetGssmrV3SubstrateGenesisPath() (path string, err error)

GetGssmrV3SubstrateGenesisPath gets the v3 substrate gssmr genesis path and returns an error if it cannot find it.

func GetGssmrV3SubstrateGenesisPathTest added in v0.7.0

func GetGssmrV3SubstrateGenesisPathTest(t *testing.T) string

GetGssmrV3SubstrateGenesisPathTest gets the v3 substrate gssmr genesis path and fails the test if it cannot find it.

func GetGssmrV3SubstrateGenesisRawPath added in v0.7.0

func GetGssmrV3SubstrateGenesisRawPath() (path string, err error)

GetGssmrV3SubstrateGenesisRawPath gets the v3 substrate gssmr raw genesis path and returns an error if it cannot find it.

func GetGssmrV3SubstrateGenesisRawPathTest added in v0.7.0

func GetGssmrV3SubstrateGenesisRawPathTest(t *testing.T) string

GetGssmrV3SubstrateGenesisRawPathTest gets the v3 substrate gssmr raw genesis path and fails the test if it cannot find it.

func GetKusamaGenesisPath added in v0.3.2

func GetKusamaGenesisPath(t *testing.T) string

GetKusamaGenesisPath gets the Kusama genesis path

func GetPolkadotGenesisPath added in v0.7.0

func GetPolkadotGenesisPath(t *testing.T) string

GetPolkadotGenesisPath gets the Polkadot genesis path

func GetProjectRootPath added in v0.7.0

func GetProjectRootPath() (rootPath string, err error)

GetProjectRootPath finds the root of the project where `go.mod` is and returns it as an absolute path.

func GetProjectRootPathTest added in v0.7.0

func GetProjectRootPathTest(t *testing.T) (rootPath string)

GetProjectRootPathTest finds the root of the project where `go.mod` is and returns it as an absolute path. It fails the test if it's not found.

func HomeDir

func HomeDir() string

HomeDir returns the user's current HOME directory

func KeystoreDir

func KeystoreDir(basepath string) (keystorepath string, err error)

KeystoreDir returns the absolute filepath of the keystore directory

func KeystoreFilepaths

func KeystoreFilepaths(basepath string) ([]string, error)

KeystoreFilepaths lists all the keys in the basepath/keystore/ directory and returns them as a list of filepaths

func KeystoreFiles

func KeystoreFiles(basepath string) ([]string, error)

KeystoreFiles returns the filenames of all the keys in the basepath's keystore

func LoadBadgerDB added in v0.7.0

func LoadBadgerDB(basePath string) (*badger.DB, error)

LoadBadgerDB load the db at the given path.

func LoadChainDB added in v0.7.0

func LoadChainDB(basePath string) (*chaindb.BadgerDB, error)

LoadChainDB load the db at the given path.

func PathExists

func PathExists(p string) bool

PathExists returns true if the named file or directory exists, otherwise false

func SetupDatabase added in v0.7.0

func SetupDatabase(basepath string, inMemory bool) (chaindb.Database, error)

SetupDatabase will return an instance of database based on basepath

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL