当前位置: 首页>>代码示例>>Golang>>正文


Golang node.Node类代码示例

本文整理汇总了Golang中github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint/node.Node的典型用法代码示例。如果您正苦于以下问题:Golang Node类的具体用法?Golang Node怎么用?Golang Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Node类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: startNode

// Private. Create a new node.
func startNode(nd *node.Node, ready chan struct{}, shutDown <-chan struct{}) {
	laddr := tmConfig.GetString("node_laddr")
	if laddr != "" {
		l := p2p.NewDefaultListener("tcp", laddr)
		nd.AddListener(l)
	}

	nd.Start()

	// If seedNode is provided by config, dial out.

	if len(tmConfig.GetString("seeds")) > 0 {
		nd.DialSeed()
	}

	if len(tmConfig.GetString("rpc_laddr")) > 0 {
		nd.StartRPC()
	}
	ready <- struct{}{}
	// Block until everything is shut down.
	<-shutDown
	nd.Stop()
}
开发者ID:ZhuZhengyi,项目名称:eris-db,代码行数:24,代码来源:serve.go

示例2: NewPipe

// Create a new rpc pipe.
func NewPipe(tNode *node.Node) Pipe {
	accounts := newAccounts(tNode.ConsensusState(), tNode.MempoolReactor())
	blockchain := newBlockchain(tNode.BlockStore())
	consensus := newConsensus(tNode.ConsensusState(), tNode.Switch())
	events := newEvents(tNode.EventSwitch())
	namereg := newNamereg(tNode.ConsensusState())
	net := newNetwork(tNode.Switch())
	txs := newTransactor(tNode.EventSwitch(), tNode.ConsensusState(), tNode.MempoolReactor(), events)
	return &PipeImpl{
		tNode,
		accounts,
		blockchain,
		consensus,
		events,
		namereg,
		net,
		txs,
	}
}
开发者ID:uledger,项目名称:eris-db,代码行数:20,代码来源:pipe.go


注:本文中的github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint/node.Node类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。