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)
| 575 | // previous can be found) from within the node's instance directory. If the node is |
| 576 | // ephemeral, a memory database is returned. |
| 577 | func (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. |
| 585 | func (n *Node) ResolvePath(x string) string { |
no test coverage detected