// InjectToDependencies adds the To dependencies to the engine.
438371
func InjectToDependencies(depsMap execute.Dependencies, deps ToDependencies) error {
	if err := deps.Validate(); err != nil {
		return err
	}
	depsMap[ToKind] = deps
	return nil
}
1267188
func (e *Endpoint) Inject(protocol tcpip.NetworkProtocolNumber, vv buffer.VectorisedView) {
	e.InjectLinkAddr(protocol, "", vv)
}
619934
func FixInjectionsWithRelativePath(workdir string, injections api.VolumeList) api.VolumeList {
	if len(injections) == 0 {
		return injections
	}
	newList := api.VolumeList{}
	for _, injection := range injections {
		changed := false
		if filepath.Clean(filepath.FromSlash(injection.Destination)) == "." {
			injection.Destination = filepath.ToSlash(workdir)
			changed = true
		}
		if filepath.ToSlash(injection.Destination)[0] != '/' {
			injection.Destination = filepath.ToSlash(filepath.Join(workdir, injection.Destination))
			changed = true
		}
		if changed {
			glog.V(5).Infof("Using %q as a destination for injecting %q", injection.Destination, injection.Source)
		}
		newList = append(newList, injection)
	}
	return newList
}
1180252
func Injector(parent inject.Injector) gin.HandlerFunc {
	return func(c *gin.Context) {
		inj := inject.New()
		inj.SetParent(parent)
		inj.Map(inj)
		inj.Map(c)

		c.Set(metaInjectorKey, inj)

		c.Next()
	}
}
1232778
func (e *LB) GetDependencies(tasks map[string]fi.Task) []fi.Task {
	var deps []fi.Task
	for _, task := range tasks {
		if _, ok := task.(*Subnet); ok {
			deps = append(deps, task)
		}
		if _, ok := task.(*ServerGroup); ok {
			deps = append(deps, task)
		}
		if _, ok := task.(*Instance); ok {
			deps = append(deps, task)
		}
		if _, ok := task.(*SecurityGroup); ok {
			deps = append(deps, task)
		}
	}
	return deps
}
595892
func (typedData *TypedData) Dependencies(primaryType string, found []string) []string {
	includes := func(arr []string, str string) bool {
		for _, obj := range arr {
			if obj == str {
				return true
			}
		}
		return false
	}

	if includes(found, primaryType) {
		return found
	}
	if typedData.Types[primaryType] == nil {
		return found
	}
	found = append(found, primaryType)
	for _, field := range typedData.Types[primaryType] {
		for _, dep := range typedData.Dependencies(field.Type, found) {
			if !includes(found, dep) {
				found = append(found, dep)
			}
		}
	}
	return found
}
597520
func (e *Subnet) GetDependencies(tasks map[string]fi.Task) []fi.Task {
	var deps []fi.Task
	for _, task := range tasks {
		if _, ok := task.(*Network); ok {
			deps = append(deps, task)
		}
	}
	return deps
}
737132
func (e *Port) GetDependencies(tasks map[string]fi.Task) []fi.Task {
	var deps []fi.Task
	for _, task := range tasks {
		if _, ok := task.(*Subnet); ok {
			deps = append(deps, task)
		}
		if _, ok := task.(*SecurityGroup); ok {
			deps = append(deps, task)
		}
		if _, ok := task.(*Network); ok {
			deps = append(deps, task)
		}
	}
	return deps
}
824033
func (s *ContainerDefinition) SetDependsOn(v []*ContainerDependency) *ContainerDefinition {
	s.DependsOn = v
	return s
}
805380
func BuildDependencies(targets map[string]*Action, pkg *Package) ([]*Action, error) {
	var deps []*Action
	pkgs := pkg.Imports

	var extra []string
	switch {
	case pkg.Main:
		// all binaries depend on runtime, even if they do not
		// explicitly import it.
		extra = append(extra, "runtime")
		if pkg.race {
			// race binaries have extra implicit depdendenceis.
			extra = append(extra, "runtime/race")
		}
	case len(pkg.CgoFiles) > 0 && pkg.ImportPath != "runtime/cgo":
		// anything that uses cgo has a dependency on runtime/cgo which is
		// only visible after cgo file generation.
		// TODO(dfc) what about pkg.Main && pkg.CgoFiles > 0 ??
		extra = append(extra, "runtime/cgo")
	}
	if pkg.TestScope {
		extra = append(extra, "regexp")
		if version.Version > 1.7 {
			// since Go 1.8 tests have additional implicit dependencies
			extra = append(extra, "testing/internal/testdeps")
		}
	}
	for _, i := range extra {
		p, err := pkg.ResolvePackage(i)
		if err != nil {
			return nil, err
		}
		pkgs = append(pkgs, p)
	}
	for _, i := range pkgs {
		a, err := BuildPackage(targets, i)
		if err != nil {
			return nil, err
		}
		if a == nil {
			// no action required for this Package
			continue
		}
		deps = append(deps, a)
	}
	return deps, nil
}
1106971
func sortDependencies(root Root, depFunc func(Root) []Root) []Root {
	seen := make(map[string]bool, len(roots))
	var sorted []Root
	sortDependenciesR(root, seen, &sorted, depFunc)
	return sorted
}
1246446
func (c *dependencyCompiler) resolvePackageDependencies(releasePackage *birelpkg.Package, packageMap map[string]*birelpkg.Package) {
	for _, dependency := range releasePackage.Dependencies {
		// only add un-added packages, to avoid endless looping in case of cycles
		pkgKey := c.pkgKey(dependency)
		if _, found := packageMap[pkgKey]; !found {
			packageMap[pkgKey] = dependency
			c.resolvePackageDependencies(releasePackage, packageMap)
		}
	}
}
554451
func parseDependency(dep string, deps []*Dependency) ([]*Dependency, error) {
	var name string
	var dependency *Dependency
	index := -1

	if dep == "" {
		return deps, nil
	}

	if dep[0] == '-' {
		return nil, fmt.Errorf("invalid dependency name")
	}

	i := 0
	for _, c := range dep {
		if !isValidPkgnameChar(c) {
			break
		}
		i++
	}

	// check if the dependency has been set before
	name = dep[0:i]
	for n, d := range deps {
		if d.Name == name {
			index = n
			break
		}
	}

	dependency = &Dependency{
		Name: name,
		sgt:  false,
		slt:  false,
	}

	if len(dep) != len(name) {
		var eq bytes.Buffer
		for _, c := range dep[i:] {
			if c == '<' || c == '>' || c == '=' {
				i++
				eq.WriteRune(c)
				continue
			}
			break
		}

		version, err := NewCompleteVersion(dep[i:])
		if err != nil {
			return nil, err
		}

		switch eq.String() {
		case "=":
			dependency.MinVer = version
			dependency.MaxVer = version
		case "<=":
			dependency.MaxVer = version
		case ">=":
			dependency.MinVer = version
		case "<":
			dependency.MaxVer = version
			dependency.slt = true
		case ">":
			dependency.MinVer = version
			dependency.sgt = true
		}
	}

	if index == -1 {
		deps = append(deps, dependency)
	} else {
		deps[index] = deps[index].Restrict(dependency)
	}

	return deps, nil
}
340227
func InjectHandler(mainLog Interface) func(http.Handler) http.Handler {
	return func(next http.Handler) http.Handler {
		return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
			ctx := req.Context()
			if l := FromContext(ctx); l == nil {
				l = kitlog.With(mainLog, "urlPath", req.URL.Path)
				req = req.WithContext(NewContext(ctx, l))
			}
			next.ServeHTTP(w, req)
		})
	}
}
350655
func Manifold(config ManifoldConfig) dependency.Manifold {
	return dependency.Manifold{
		Inputs: []string{config.APICallerName},
		Start:  config.start,
		Output: engine.FlagOutput,
		Filter: filterErrors,
	}
}
664994
func (eng *Engine) InjectWait(f func() error) error {
	done := make(chan error)
	defer close(done)
	err := eng.Inject(func() { done <- f() })
	if err != nil {
		return err
	}
	select {
	case <-eng.running:
		return eng.Error()
	case err := <-done:
		return err
	}
}
478539
func (e *Chattr) GetDependencies(tasks map[string]fi.Task) []fi.Task {
	return e.Deps
}