// NewProductDiskAPI ディスクプランAPI作成
322157
func NewProductDiskAPI(client *Client) *ProductDiskAPI {
	return &ProductDiskAPI{
		&baseAPI{
			client: client,
			FuncGetResourceURL: func() string {
				return "product/disk"
			},
		},
	}
}
75822
func newFunctionProto(name string) *FunctionProto {
	return &FunctionProto{
		SourceName:         name,
		LineDefined:        0,
		LastLineDefined:    0,
		NumUpvalues:        0,
		NumParameters:      0,
		IsVarArg:           0,
		NumUsedRegisters:   2,
		Code:               make([]uint32, 0, 128),
		Constants:          make([]LValue, 0, 32),
		FunctionPrototypes: make([]*FunctionProto, 0, 16),

		DbgSourcePositions: make([]int, 0, 128),
		DbgLocals:          make([]*DbgLocalInfo, 0, 16),
		DbgCalls:           make([]DbgCall, 0, 128),
		DbgUpvalues:        make([]string, 0, 16),

		stringConstants: make([]string, 0, 32),
	}
}
1013851
func NewProductBuilder(name string, client speed.Client) *ProductBuilder {
	completed, err := speed.NewPCPCounter(0, "products."+name+".count")
	if err != nil {
		log.Fatal("Could not create completed, error: ", err)
	}

	totalTime, err := speed.NewPCPGauge(0, "products."+name+".time")
	if err != nil {
		log.Fatal("Could not create totalTime, error: ", err)
	}

	client.MustRegister(completed)
	client.MustRegister(totalTime)

	return &ProductBuilder{
		name:      name,
		bound:     500,
		completed: completed,
		totalTime: totalTime,
	}
}
633665
func (router *SimpleRouter) AddProducer(producers ...Producer) {
	for _, prod := range producers {
		for _, inListProd := range router.Producers {
			if inListProd == prod {
				return // ### return, already in list ###
			}
		}
		router.Producers = append(router.Producers, prod)
	}
}
1176891
func NewDiskManagerAPI(
	st *state.State,
	resources facade.Resources,
	authorizer facade.Authorizer,
) (*DiskManagerAPI, error) {

	if !authorizer.AuthMachineAgent() {
		return nil, common.ErrPerm
	}

	authEntityTag := authorizer.GetAuthTag()
	getAuthFunc := func() (common.AuthFunc, error) {
		return func(tag names.Tag) bool {
			// A machine agent can always access its own machine.
			return tag == authEntityTag
		}, nil
	}

	return &DiskManagerAPI{
		st:          getState(st),
		authorizer:  authorizer,
		getAuthFunc: getAuthFunc,
	}, nil
}
926496
func (metadata *IndexMetadata) hasProduct(prodIds []string) bool {
	for _, pid := range metadata.ProductIds {
		if containsString(prodIds, pid) {
			return true
		}
	}
	return false
}
746650
func (c *SubnetCommandBase) NewAPI() (SubnetAPI, error) {
	if c.api != nil {
		// Already created.
		return c.api, nil
	}
	root, err := c.NewAPIRoot()
	if err != nil {
		return nil, errors.Trace(err)
	}

	// This is tested with a feature test.
	shim := &mvpAPIShim{
		apiState: root,
		facade:   subnets.NewAPI(root),
	}
	return shim, nil
}
1371701
func (p *Pss) addAPI(api rpc.API) {
	p.auxAPIs = append(p.auxAPIs, api)
}
735348
func newProto(docslogLevel logrus.Level, requestTimeout ...time.Duration) *ProtoClient {
	return &ProtoClient{
		Client:           *New(docslogLevel, requestTimeout...),
		descriptorsNames: make(map[string]bool),
		info: ProtoBufferInfo{
			Commands: make(map[string]*Command),
		},
		docsRoute:        "",
		descriptorsRoute: "",
		IncomingMsgChan:  make(chan *message.Message, 10),
		closeChan:        make(chan bool),
	}
}
442191
func NewProducer(config Config, handler MessageDelivery) (*Client, error) {
	client := Client{}
	nativeErr := new(ErrorHandle)

	C.RegisterErrorWrapper(config.handle)
	C.RegisterDeliveryReportWrapper(config.handle)

	client.handle = C.rd_kafka_new(C.RD_KAFKA_PRODUCER, config.handle, nativeErr.buffer(), nativeErr.len())
	if client.handle == nil {
		return nil, nativeErr
	}

	if handler != nil {
		clientGuard.Lock()
		clients[client.handle] = handler
		clientGuard.Unlock()
	}

	return &client, nil
}
207675
func NewAPI(s storage.Storage, logger log.Logger) api.DexServer {
	return dexAPI{
		s:      s,
		logger: logger,
	}
}
565374
func NewPropArg(genResult *GenResult, shrinks int, value, origValue interface{}) *PropArg {
	return &PropArg{
		Label:   strings.Join(genResult.Labels, ", "),
		Arg:     value,
		OrigArg: origValue,
		Shrinks: shrinks,
	}
}
568378
func NewSetProduceCompilationCacheArgs(enabled bool) *SetProduceCompilationCacheArgs {
	args := new(SetProduceCompilationCacheArgs)
	args.Enabled = enabled
	return args
}
403932
func (r *repository) createNewPublicKeyFromKeyIDs(keyIDs []string) ([]data.PublicKey, error) {
	publicKeys := []data.PublicKey{}

	privKeys, err := getAllPrivKeys(keyIDs, r.GetCryptoService())
	if err != nil {
		return nil, err
	}

	for _, privKey := range privKeys {
		rootKey, err := rootCertKey(r.gun, privKey)
		if err != nil {
			return nil, err
		}
		publicKeys = append(publicKeys, rootKey)
	}
	return publicKeys, nil
}
37795
func NewDistributor(caches ...Cache) Distributor {
	if len(caches) == 0 {
		return nil
	}
	return &distrib{
		distribution: stdDistribution,
		caches:       caches,
		size:         uint64(len(caches)),
	}
}
130818
func NewAPI(fileStore *storage.FileStore, dns Resolver, feedHandler *feed.Handler, pk *ecdsa.PrivateKey) (self *API) {
	self = &API{
		fileStore: fileStore,
		dns:       dns,
		feed:      feedHandler,
		Decryptor: func(ctx context.Context, credentials string) DecryptFunc {
			return self.doDecrypt(ctx, credentials, pk)
		},
	}
	return
}
377312
func newPayloadResult(id string, err error) params.PayloadResult {
	result := payload.Result{
		ID:       id,
		Payload:  nil,
		NotFound: errors.IsNotFound(err),
		Error:    err,
	}
	return Result2api(result)
}