// NewAckingResourceMutatorWrapper creates a new AckingResourceMutatorWrapper
// to wrap the given ResourceMutator. The given NodeToIDFunc is used to extract
// a string identifier from an Envoy Node identifier.
500393
func NewAckingResourceMutatorWrapper(mutator ResourceMutator, nodeToID NodeToIDFunc) *AckingResourceMutatorWrapper {
	return &AckingResourceMutatorWrapper{
		mutator:            mutator,
		nodeToID:           nodeToID,
		pendingCompletions: make(map[*completion.Completion]*pendingCompletion),
	}
}
1333667
func NewCRUDResource(resourceType string, storage store.CRUD) *Resource {
	resource := NewResource(resourceType)
	resource.CRUD(storage)
	return resource
}
755919
func NewIdGenerator() func() Id {
	var (
		mu     sync.Mutex
		nextId Id
	)

	return func() Id {
		mu.Lock()
		defer func() {
			nextId++
			mu.Unlock()
		}()
		return nextId
	}
}
1109366
func NewCharmResourcesCommand(resourceLister ResourceLister) modelcmd.ModelCommand {
	var c CharmResourcesCommand
	c.setResourceLister(resourceLister)
	return modelcmd.Wrap(&c)
}
1339113
func NewHandlerWrapper(rate int, opts ...ratelimit.Option) server.HandlerWrapper {
	r := ratelimit.New(rate, opts...)

	return func(h server.HandlerFunc) server.HandlerFunc {
		return func(ctx context.Context, req server.Request, rsp interface{}) error {
			r.Take()
			return h(ctx, req, rsp)
		}
	}
}
678538
func NewDefaultWrapper(message string) Wrapper {
	spinner := NewDefaultSpinner(message)
	interactiveMode := OutputDeviceIsTerminal()
	return NewWrapper(spinner, interactiveMode)
}
141904
func NewReaderErrWrapper(r io.Reader, closer func()) io.Reader {
	return &readerErrWrapper{
		reader: r,
		closer: closer,
	}
}
1331646
func NewDistinctPropertyIterator(ctx Context, source FeasibleIterator) *DistinctPropertyIterator {
	return &DistinctPropertyIterator{
		ctx:               ctx,
		source:            source,
		groupPropertySets: make(map[string][]*propertySet),
	}
}
3897
func (rm *StateResourceManager) RedefineResource(id, desc string, rsrcCfg interface{}) error {

	rsrc, alreadyExists, err := rm.findResource(id, desc)
	if err != nil {
		return err
	}

	if !alreadyExists {
		return core.Errorf("No resource found for description: %q and id: %q",
			desc, id)
	}

	rsrc.Reinit(rsrcCfg)
	return nil

}
351434
func NewWrapper(rwa ReadWriterAt, L, O, N int64) *Wrapper {
	return &Wrapper{
		L:   L,
		O:   O,
		N:   N,
		rwa: rwa,
	}
}
1123912
func NewClientWrapper(rate int, opts ...ratelimit.Option) client.Wrapper {
	r := ratelimit.New(rate, opts...)

	return func(c client.Client) client.Client {
		return &clientWrapper{r, c}
	}
}
732057
func NewResource(p interface{}, selfUri string) *Resource {
	var r Resource

	r.Payload = p

	r.Links = make(LinkRelations)
	r.AddNewLink("self", selfUri)

	r.Embedded = make(Embedded)
	r.Curies = make(map[string]*CurieHandle)

	return &r
}
1012436
func wrapUnaryHandler(name string, handler interface{}) transport.UnaryHandler {
	reqBodyType := verifyUnarySignature(name, reflect.TypeOf(handler))
	return newJSONHandler(reqBodyType, handler)
}
205313
func MakeWrapper(i interface{}) *Object {
	v := InternalObject(i)
	o := Global.Get("Object").New()
	o.Set("__internal_object__", v)
	methods := v.Get("constructor").Get("methods")
	for i := 0; i < methods.Length(); i++ {
		m := methods.Index(i)
		if m.Get("pkg").String() != "" { // not exported
			continue
		}
		o.Set(m.Get("name").String(), func(args ...*Object) *Object {
			return Global.Call("$externalizeFunction", v.Get(m.Get("prop").String()), m.Get("typ"), true).Call("apply", v, args)
		})
	}
	return o
}
373692
func NewFeasibilityWrapper(ctx Context, source FeasibleIterator,
	jobCheckers, tgCheckers []FeasibilityChecker) *FeasibilityWrapper {
	return &FeasibilityWrapper{
		ctx:         ctx,
		source:      source,
		jobCheckers: jobCheckers,
		tgCheckers:  tgCheckers,
	}
}
415599
func NewHandlerWrapper(opts ...Option) server.HandlerWrapper {
	options := Options{
		Daemon: "localhost:2000",
	}

	for _, o := range opts {
		o(&options)
	}

	x := newXRay(options)

	return func(h server.HandlerFunc) server.HandlerFunc {
		return func(ctx context.Context, req server.Request, rsp interface{}) error {
			name := options.Name
			if len(name) == 0 {
				// default name
				name = req.Service() + "." + req.Endpoint()
			}

			var err error
			s := getSegment(name, ctx)

			defer func() {
				setCallStatus(s, req.Service(), req.Endpoint(), err)
				go record(x, s)
			}()

			ctx = newContext(ctx, s)
			err = h(ctx, req, rsp)
			return err
		}
	}
}
499209
func (c *ConfigLocal) AddRootNodeWrapper(f func(Node) Node) {
	c.lock.Lock()
	defer c.lock.Unlock()
	c.rootNodeWrappers = append(c.rootNodeWrappers, f)
}