func NewCore(ctx context.Context) (*core, error) {
	var cfg config.Config
	err := ctx.LoadCustomConfig(&cfg)
	if err != nil {
		return nil, err
	}

	c := &core{}
	c.sto, err = store.NewBoltHold(cfg.Store.Path)
	if err != nil {
		return nil, err
	}
	c.sha, err = node.NewNode(c.sto)
	if err != nil {
		c.Close()
		return nil, err
	}
	c.eng, err = engine.NewEngine(cfg.Engine, c.sto, c.sha)
	if err != nil {
		c.Close()
		return nil, err
	}
	c.syn, err = sync.NewSync(cfg.Sync, c.sto, c.sha)
	if err != nil {
		c.Close()
		return nil, err
	}
	return c, nil
}
// NewCore creats a new core
NewCore creats a new core
// NewCore creats a new core
func NewCore(ctx context.Context) (*core, error) {
	var cfg config.Config
	err := ctx.LoadCustomConfig(&cfg)
	if err != nil {
		return nil, err
	}
	c := &core{}
	c.sto, err = store.NewBoltHold(cfg.Store.Path)
	if err != nil {
		return nil, err
	}
	c.sha, err = node.NewNode(c.sto)
	if err != nil {
		c.Close()
		return nil, err
	}
	c.eng, err = engine.NewEngine(cfg.Engine, c.sto, c.sha)
	if err != nil {
		c.Close()
		return nil, err
	}
	c.syn, err = sync.NewSync(cfg.Sync, c.sto, c.sha)
	if err != nil {
		c.Close()
		return nil, err
	}
	return c, nil
}
func NewCore ( ctx context . Context ) ( * core , error ) { var cfg config . Config err := ctx . LoadCustomConfig ( & cfg ) if err != nil { return nil , err } c := & core { } c . sto , err = store . NewBoltHold ( cfg . Store . Path ) if err != nil { return nil , err } c . sha , err = node . NewNode ( c . sto ) if err != nil { c . Close ( ) return nil , err } c . eng , err = engine . NewEngine ( cfg . Engine , c . sto , c . sha ) if err != nil { c . Close ( ) return nil , err } c . syn , err = sync . NewSync ( cfg . Sync , c . sto , c . sha ) if err != nil { c . Close ( ) return nil , err } return c , nil }
NewCore creats a new core
NewCore creats a new core