本文整理匯總了Golang中github.com/eris-ltd/eris-cli/definitions.Chain類的典型用法代碼示例。如果您正苦於以下問題:Golang Chain類的具體用法?Golang Chain怎麽用?Golang Chain使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Chain類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: MarshalChainDefinition
// marshal from viper to definitions struct
func MarshalChainDefinition(chainConf *viper.Viper, chain *definitions.Chain) error {
chnTemp := definitions.BlankChain()
// logger.Debugf("Loader.Chain: ChainID =>\t\t%v\n", chain.ChainID)
// logger.Debugf("Loader.Chain. Conf =>\t\t%v\n", chainConf)
err := chainConf.Marshal(chnTemp)
if err != nil {
return fmt.Errorf("The marmots coult not marshal from viper to chain def: %v", err)
}
// logger.Debugf("Loader.Chain.Marshal: ChanID =>\t%v\n", chnTemp.ChainID)
mergeChainAndService(chain, chnTemp.Service)
chain.ChainID = chnTemp.ChainID
// toml bools don't really marshal well
// data_container can be in the chain or
// in the service layer. this is very
// opinionated. we know.
for _, s := range []string{"", "service."} {
if chainConf.GetBool(s + "data_container") {
logger.Debugln("Loader.Chain.Marshal: Data Containers Turned On.")
chain.Service.AutoData = true
}
}
return nil
}
示例2: setChainDefaults
func setChainDefaults(chain *definitions.Chain) {
ver := strings.Join(strings.Split(version.VERSION, ".")[:2], ".") // only need 0.10 not full ver => 0.10.0
chain.Service.Image = "eris/erisdb:" + ver
chain.Service.AutoData = true
chain.ChainType = "mint"
chain.Service.Environment = append(chain.Service.Environment, "CHAIN_ID="+chain.ChainID, "CHAIN_TYPE="+chain.ChainType)
logger.Debugf("Chain Defaults Set. Image =>\t%s\n", chain.Service.Image)
}
示例3: MarshalChainDefinition
// marshal from viper to definitions struct
func MarshalChainDefinition(chainConf *viper.Viper, chain *definitions.Chain) error {
log.Debug("Marshalling chain")
chnTemp := definitions.BlankChain()
err := chainConf.Unmarshal(chnTemp)
if err != nil {
return fmt.Errorf("The marmots coult not marshal from viper to chain def: %v", err)
}
util.Merge(chain.Service, chnTemp.Service)
chain.ChainID = chnTemp.ChainID
// toml bools don't really marshal well
// data_container can be in the chain or
// in the service layer. this is very
// opinionated. we know.
for _, s := range []string{"", "service."} {
if chainConf.GetBool(s + "data_container") {
chain.Service.AutoData = true
log.WithField("autodata", chain.Service.AutoData).Debug()
}
}
return nil
}