github.com/turingchain2020/turingchain@v1.1.21/store/store.go (about)

     1  // Copyright Turing Corp. 2018 All Rights Reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package store store the world - state data
     6  package store
     7  
     8  import (
     9  	"github.com/turingchain2020/turingchain/queue"
    10  	"github.com/turingchain2020/turingchain/system/store"
    11  	"github.com/turingchain2020/turingchain/types"
    12  )
    13  
    14  // New new store queue module
    15  func New(cfg *types.TuringchainConfig) queue.Module {
    16  	mcfg := cfg.GetModuleConfig().Store
    17  	sub := cfg.GetSubConfig().Store
    18  	s, err := store.Load(mcfg.Name)
    19  	if err != nil {
    20  		panic("Unsupported store type:" + mcfg.Name + " " + err.Error())
    21  	}
    22  	subcfg, ok := sub[mcfg.Name]
    23  	if !ok {
    24  		subcfg = nil
    25  	}
    26  	return s(mcfg, subcfg, cfg)
    27  }