MCPcopy Create free account
hub / github.com/CPChain/chain / OpenDatabase

Method OpenDatabase

node/node.go:577–582  ·  view source on GitHub ↗

OpenDatabase opens an existing database with the given name (or creates one if no previous can be found) from within the node's instance directory. If the node is ephemeral, a memory database is returned.

(name string, cache, handles int)

Source from the content-addressed store, hash-verified

575// previous can be found) from within the node's instance directory. If the node is
576// ephemeral, a memory database is returned.
577func (n *Node) OpenDatabase(name string, cache, handles int) (database.Database, error) {
578 if n.config.DataDir == "" {
579 return database.NewMemDatabase(), nil
580 }
581 return database.NewLDBDatabase(n.config.resolvePath(name), cache, handles)
582}
583
584// ResolvePath returns the absolute path of a resource in the instance directory.
585func (n *Node) ResolvePath(x string) string {

Callers 3

initChainFunction · 0.45
MakeChainDatabaseFunction · 0.45
CreateDBFunction · 0.45

Calls 1

resolvePathMethod · 0.80

Tested by

no test coverage detected