MCPcopy Create free account
hub / github.com/ethstorage/es-node / initDatabase

Method initDatabase

ethstorage/node/node.go:584–603  ·  view source on GitHub ↗
(cfg *Config)

Source from the content-addressed store, hash-verified

582}
583
584func (n *EsNode) initDatabase(cfg *Config) error {
585 var db ethdb.Database
586 if cfg.DataDir == "" {
587 db = rawdb.NewMemoryDatabase()
588 } else {
589 rdb, err := leveldb.New(
590 cfg.ResolvePath(cfg.DBConfig.Name),
591 cfg.DBConfig.DatabaseCache,
592 cfg.DBConfig.DatabaseHandles,
593 cfg.DBConfig.NameSpace,
594 false,
595 )
596 if err != nil {
597 return err
598 }
599 db = rawdb.NewDatabase(rdb)
600 }
601 n.db = db
602 return nil
603}
604
605func sendMessage(url string, data string) (string, error) {
606 contentType := "application/json"

Callers 2

initMethod · 0.95
test_InitDBFunction · 0.95

Calls 1

ResolvePathMethod · 0.80

Tested by 1

test_InitDBFunction · 0.76