// TrackChain provides a mock function with given fields: chainName, genesisBlock, createChain
19619
func (_m *InactiveChainRegistry) TrackChain(chainName string, genesisBlock *common.Block, createChain etcdraft.CreateChainCallback) {
	_m.Called(chainName, genesisBlock, createChain)
}
17186
func NewTaskChain(dtasks Dogtasks, task string) (taskChain TaskChain, err error) {
	err = taskChain.generate(dtasks, task)
	if err != nil {
		return
	}
	return
}
174623
func (_m *ChainReplicator) ReplicateChains(lastConfigBlock *common.Block, chains []string) []string {
	ret := _m.Called(lastConfigBlock, chains)

	var r0 []string
	if rf, ok := ret.Get(0).(func(*common.Block, []string) []string); ok {
		r0 = rf(lastConfigBlock, chains)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]string)
		}
	}

	return r0
}
30421
func (m *Mux) buildChain() {
	m.handler = dispatch{}
	for i := len(m.middleware) - 1; i >= 0; i-- {
		m.handler = m.middleware[i](m.handler)
	}
}
478116
func (bc *BlockChain) SubscribeChainHeadEvent(ch chan<- ChainHeadEvent) event.Subscription {
	return bc.scope.Track(bc.chainHeadFeed.Subscribe(ch))
}
554440
func (c *chainRegistry) NumActiveChains() uint32 {
	c.RLock()
	defer c.RUnlock()

	return uint32(len(c.activeChains))
}
806106
func joinChain(chainID string, block *common.Block, ccp ccprovider.ChaincodeProvider, sccp sysccprovider.SystemChaincodeProvider) pb.Response {
	if err := peer.CreateChainFromBlock(block, ccp, sccp); err != nil {
		return shim.Error(err.Error())
	}

	peer.InitChain(chainID)

	return shim.Success(nil)
}
1312747
func OnewayChain(mw ...middleware.OnewayInbound) middleware.OnewayInbound {
	unchained := make([]middleware.OnewayInbound, 0, len(mw))
	for _, m := range mw {
		if m == nil {
			continue
		}
		if c, ok := m.(onewayChain); ok {
			unchained = append(unchained, c...)
			continue
		}
		unchained = append(unchained, m)
	}

	switch len(unchained) {
	case 0:
		return middleware.NopOnewayInbound
	case 1:
		return unchained[0]
	default:
		return onewayChain(unchained)
	}
}
823033
func (w *Wallet) scanChain(startHeight int32,
	onBlock func(int32, *chainhash.Hash, *wire.BlockHeader) error) error {

	chainClient, err := w.requireChainClient()
	if err != nil {
		return err
	}

	// isCurrent is a helper function that we'll use to determine if the
	// chain backend is currently synced. When running with a btcd or
	// bitcoind backend, it will use the height of the latest checkpoint as
	// its lower bound.
	var latestCheckptHeight int32
	if len(w.chainParams.Checkpoints) > 0 {
		latestCheckptHeight = w.chainParams.
			Checkpoints[len(w.chainParams.Checkpoints)-1].Height
	}
	isCurrent := func(bestHeight int32) bool {
		// If the best height is zero, we assume the chain backend is
		// still looking for peers to sync to in the case of a global
		// network, e.g., testnet and mainnet.
		if bestHeight == 0 && !w.isDevEnv() {
			return false
		}

		switch c := chainClient.(type) {
		case *chain.NeutrinoClient:
			return c.CS.IsCurrent()
		}
		return bestHeight >= latestCheckptHeight
	}

	// Determine the latest height known to the chain backend and begin
	// scanning the chain from the start height up until this point.
	_, bestHeight, err := chainClient.GetBestBlock()
	if err != nil {
		return err
	}

	for height := startHeight; height <= bestHeight; height++ {
		hash, err := chainClient.GetBlockHash(int64(height))
		if err != nil {
			return err
		}
		header, err := chainClient.GetBlockHeader(hash)
		if err != nil {
			return err
		}

		if err := onBlock(height, hash, header); err != nil {
			return err
		}

		// If we've reached our best height, we'll wait for blocks at
		// tip to ensure we go through all existent blocks in the chain.
		// We'll update our bestHeight before checking if we're current
		// with the chain to ensure we process any additional blocks
		// that came in while we were scanning from our starting point.
		for height == bestHeight {
			time.Sleep(100 * time.Millisecond)
			_, bestHeight, err = chainClient.GetBestBlock()
			if err != nil {
				return err
			}
			if isCurrent(bestHeight) {
				break
			}
		}
	}

	return nil
}
595665
func trackSyncPtrChangesInCreate(
	mostRecentTargetPtr data.BlockPointer, unmergedChain *crChain,
	unmergedChains *crChains, toName string) {
	targetChain, ok := unmergedChains.byMostRecent[mostRecentTargetPtr]
	var refs, unrefs []data.BlockPointer
	if ok && targetChain.isFile() {
		// The create op also needs to reference the child block ptrs
		// created by any sync ops (and not unreferenced by future
		// ones).
		for _, op := range targetChain.ops {
			syncOp, ok := op.(*syncOp)
			if !ok {
				continue
			}
			for _, ref := range op.Refs() {
				if !unmergedChains.isDeleted(ref) {
					refs = append(refs, ref)
				}
			}
			for _, unref := range op.Unrefs() {
				unrefs = append(unrefs, unref)
			}
			// Account for the file ptr too, if it's the most recent.
			filePtr := syncOp.File.Ref
			_, isMostRecent := unmergedChains.byMostRecent[filePtr]
			if isMostRecent && !unmergedChains.isDeleted(filePtr) {
				refs = append(refs, filePtr)
			}
		}
	}
	if len(refs) > 0 {
		for _, uop := range unmergedChain.ops {
			cop, ok := uop.(*createOp)
			if !ok || cop.NewName != toName {
				continue
			}
			for _, ref := range refs {
				cop.AddRefBlock(ref)
			}
			for _, unref := range unrefs {
				cop.AddUnrefBlock(unref)
			}
			break
		}
	}
}
912418
func NewLoggingChain(name string, useKernelLogging bool, runner command_runner.CommandRunner, logger lager.Logger) Chain {
	logger = logger.Session("logging-chain", lager.Data{
		"name":             name,
		"useKernelLogging": useKernelLogging,
	})
	return &chain{
		name:             name,
		logChainName:     name + "-log",
		useKernelLogging: useKernelLogging,
		loglessRunner:    runner,
		runner:           &logging.Runner{runner, logger},
		logger:           logger,
	}
}
534462
func (c *chainView) Genesis() *blockNode {
	c.mtx.Lock()
	genesis := c.genesis()
	c.mtx.Unlock()
	return genesis
}
622555
func (runner *runner) FlushChain(table Table, chain Chain) error {
	fullArgs := makeFullArgs(table, chain)

	runner.mu.Lock()
	defer runner.mu.Unlock()

	out, err := runner.run(opFlushChain, fullArgs)
	if err != nil {
		return fmt.Errorf("error flushing chain %q: %v: %s", chain, err, out)
	}
	return nil
}
779353
func (l *Link) TrackOffset() time.Duration {
	var offsetMs C.int
	C.sp_link_as_track_and_offset(l.sp_link, &offsetMs)
	return time.Duration(offsetMs) / time.Millisecond
}
359560
func (p DestinationPublisher) createTransformerChain(f Descriptor) transform.Chain {
	transformers := transform.NewEmpty()

	isHTML := f.OutputFormat.IsHTML

	if f.AbsURLPath != "" {
		if isHTML {
			transformers = append(transformers, urlreplacers.NewAbsURLTransformer(f.AbsURLPath))
		} else {
			// Assume XML.
			transformers = append(transformers, urlreplacers.NewAbsURLInXMLTransformer(f.AbsURLPath))
		}
	}

	if isHTML {
		if f.LiveReloadPort > 0 {
			transformers = append(transformers, livereloadinject.New(f.LiveReloadPort))
		}

		// This is only injected on the home page.
		if f.AddHugoGeneratorTag {
			transformers = append(transformers, metainject.HugoGenerator)
		}

	}

	if p.minify {
		minifyTransformer := p.min.Transformer(f.OutputFormat.MediaType)
		if minifyTransformer != nil {
			transformers = append(transformers, minifyTransformer)
		}
	}

	return transformers

}
159546
func (s *state) evalFieldChain(dot, receiver reflect.Value, node parse.Node, ident []string, args []parse.Node, final reflect.Value) reflect.Value {
	n := len(ident)
	for i := 0; i < n-1; i++ {
		receiver = s.evalField(dot, ident[i], node, nil, zero, receiver)
	}
	// Now if it's a method, it gets the arguments.
	return s.evalField(dot, ident[n-1], node, args, final, receiver)
}
68901
func (mr *MockTrackBranchCommandAPIMockRecorder) TrackBranch(arg0, arg1 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TrackBranch", reflect.TypeOf((*MockTrackBranchCommandAPI)(nil).TrackBranch), arg0, arg1)
}