//ChainWith returns ActDepend(ActionDepend) with this action as the root
496415
func (a *ActDepend) ChainWith(r ...ActionInterface) *ActDepend {
	return a.current().ChainWith(r...)
}
13885
func (rs Rules) Chain() Chain {
	if len(rs) == 0 {
		return ChainIdentity
	}
	return func(ctx context.Context, e *scheduler.Call, z mesos.Response, err error) (context.Context, *scheduler.Call, mesos.Response, error) {
		return rs[0].Eval(ctx, e, z, err, rs[1:].Chain())
	}
}
8122
func (i *Image) WithDigest(digest digest.Digest) (err error) {
	i.Digest = digest
	i.named, err = reference.WithDigest(i.named, digest)
	return err
}
304453
func (server *Server) SendChainWithContext(ctx context.Context, chain *tasks.Chain) (*result.ChainAsyncResult, error) {
	span, _ := opentracing.StartSpanFromContext(ctx, "SendChain", tracing.ProducerOption(), tracing.MachineryTag, tracing.WorkflowChainTag)
	defer span.Finish()

	tracing.AnnotateSpanWithChainInfo(span, chain)

	return server.SendChain(chain)
}
932677
func (r *Router) chain() http.Handler {
	var final http.Handler

	final = r.router
	mw := r.allMiddleware()
	for i := len(mw) - 1; i >= 0; i-- {
		final = mw[i](final)
	}

	return final
}
199716
func ErrorWithCauseChain(err error) string {
	var buffer bytes.Buffer

	for {
		if wrappedErr, ok := err.(*Err); ok && wrappedErr.Cause != nil {
			fmt.Fprintln(&buffer, wrappedErr.Error())
			fmt.Fprint(&buffer, "caused by ")
			err = wrappedErr.Cause
		} else {
			break
		}
	}

	if err != nil {
		buffer.WriteString(err.Error())
	} else {
		buffer.WriteString("<err=nil>")
	}

	return buffer.String()
}
386660
func execChains(event *Event) {
	for _, c := range chains {
		if c.Event.Name != event.Name || c.Event.Bee != event.Bee {
			continue
		}

		m := make(map[string]interface{})
		for _, opt := range event.Options {
			m[opt.Name] = opt.Value
		}
		ctx.FillMap(m)

		failed := false
		log.Println("Executing chain:", c.Name, "-", c.Description)
		for _, el := range c.Filters {
			if execFilter(el, m) {
				log.Println("\t\tPassed filter!")
			} else {
				log.Println("\t\tDid not pass filter!")
				failed = true
				break
			}
		}
		if failed {
			continue
		}

		for _, el := range c.Actions {
			action := GetAction(el)
			if action == nil {
				log.Println("\t\tERROR: Unknown action referenced!")
				continue
			}
			execAction(*action, m)
		}
	}
}
1374090
func (c *CfFilteredChainView) chainFilterer() {
	defer c.wg.Done()

	for {
		select {
		case err := <-c.rescanErrChan:
			log.Errorf("Error encountered during rescan: %v", err)
		case <-c.quit:
			return
		}
	}
}
904847
func (b *boltArbitratorLog) FetchChainActions() (ChainActionMap, error) {
	actionsMap := make(ChainActionMap)

	err := b.db.View(func(tx *bbolt.Tx) error {
		scopeBucket := tx.Bucket(b.scopeKey[:])
		if scopeBucket == nil {
			return errScopeBucketNoExist
		}

		actionsBucket := scopeBucket.Bucket(actionsBucketKey)
		if actionsBucket == nil {
			return errNoActions
		}

		return actionsBucket.ForEach(func(action, htlcBytes []byte) error {
			if htlcBytes == nil {
				return nil
			}

			chainAction := ChainAction(action[0])

			htlcReader := bytes.NewReader(htlcBytes)
			htlcs, err := channeldb.DeserializeHtlcs(htlcReader)
			if err != nil {
				return err
			}

			actionsMap[chainAction] = htlcs

			return nil
		})
	})
	if err != nil {
		return nil, err
	}

	return actionsMap, nil
}
127904
func (s *Snapshotter) withTransaction(ctx context.Context, writable bool, fn func(ctx context.Context) error) error {
	ctx, trans, err := s.store.TransactionContext(ctx, writable)
	if err != nil {
		return err
	}

	var result *multierror.Error

	err = fn(ctx)
	if err != nil {
		result = multierror.Append(result, err)
	}

	// Always rollback if transaction is not writable
	if err != nil || !writable {
		if terr := trans.Rollback(); terr != nil {
			log.G(ctx).WithError(terr).Error("failed to rollback transaction")
			result = multierror.Append(result, errors.Wrap(terr, "rollback failed"))
		}
	} else {
		if terr := trans.Commit(); terr != nil {
			log.G(ctx).WithError(terr).Error("failed to commit transaction")
			result = multierror.Append(result, errors.Wrap(terr, "commit failed"))
		}
	}

	if err := result.ErrorOrNil(); err != nil {
		log.G(ctx).WithError(err).Debug("snapshotter error")

		// Unwrap if just one error
		if len(result.Errors) == 1 {
			return result.Errors[0]
		}

		return err
	}

	return nil
}
1001362
func (a *ActDepend) Use(ind int) ActionInterface {
	return a.getIndex(ind).Wrap()
}
1031302
func (r *RootFS) ChainID() layer.ChainID {
	if runtime.GOOS == "windows" && r.Type == typeLayersWithBase {
		logrus.Warnf("Layer type is unsupported on this platform. DiffIDs: '%v'", r.DiffIDs)
		return ""
	}
	return layer.CreateChainID(r.DiffIDs)
}
256336
func PostWithChainlink(mctx libkb.MetaContext, clearBundle stellar1.Bundle) (err error) {
	defer mctx.TraceTimed("Stellar.PostWithChainlink", func() error { return err })()

	uid := mctx.G().ActiveDevice.UID()
	if uid.IsNil() {
		return libkb.NoUIDError{}
	}
	mctx.Debug("Stellar.PostWithChainLink: load self")
	loadMeArg := libkb.NewLoadUserArg(mctx.G()).
		WithNetContext(mctx.Ctx()).
		WithUID(uid).
		WithSelf(true).
		WithPublicKeyOptional()
	me, err := libkb.LoadUser(loadMeArg)
	if err != nil {
		return err
	}

	deviceSigKey, err := mctx.G().ActiveDevice.SigningKey()
	if err != nil {
		return fmt.Errorf("signing key not found: (%v)", err)
	}
	pukGen, pukSeed, err := getLatestPuk(mctx.Ctx(), mctx.G())
	if err != nil {
		return err
	}

	payload, seqno, linkID, err := buildChainLinkPayload(mctx, clearBundle, me, pukGen, pukSeed, deviceSigKey)
	if err != nil {
		return err
	}

	mctx.Debug("Stellar.PostWithChainLink: post")
	_, err = mctx.G().API.PostJSON(mctx, libkb.APIArg{
		Endpoint:    "key/multi",
		SessionType: libkb.APISessionTypeREQUIRED,
		JSONPayload: *payload,
	})
	if err != nil {
		return err
	}
	if err = libkb.MerkleCheckPostedUserSig(mctx, uid, seqno, linkID); err != nil {
		return err
	}

	mctx.G().UserChanged(mctx.Ctx(), uid)
	return nil
}
1215569
func (_m *RouterGroup) Chain() alice.Chain {
	ret := _m.Called()

	var r0 alice.Chain
	if rf, ok := ret.Get(0).(func() alice.Chain); ok {
		r0 = rf()
	} else {
		r0 = ret.Get(0).(alice.Chain)
	}

	return r0
}
754244
func (l *Loop) ChainEdge(chainID, offset int) Edge {
	return Edge{l.Vertex(offset), l.Vertex(offset + 1)}
}
583705
func WithDigest(name Named, digest digest.Digest) (Canonical, error) {
	if !anchoredDigestRegexp.MatchString(digest.String()) {
		return nil, ErrDigestInvalidFormat
	}
	var repo repository
	if r, ok := name.(namedRepository); ok {
		repo.domain = r.Domain()
		repo.path = r.Path()
	} else {
		repo.path = name.Name()
	}
	if tagged, ok := name.(Tagged); ok {
		return reference{
			namedRepository: repo,
			tag:             tagged.Tag(),
			digest:          digest,
		}, nil
	}
	return canonicalReference{
		namedRepository: repo,
		digest:          digest,
	}, nil
}
101061
func (builder *Builder) With(a ...ANSI) *Builder {
	return NewBuilder(builder.ANSI.With(a...))
}