// NewObjectPoolWithDefaultConfig return new ObjectPool init with PooledObjectFactory and default config
519207
func NewObjectPoolWithDefaultConfig(ctx context.Context, factory PooledObjectFactory) *ObjectPool {
	return NewObjectPool(ctx, factory, NewDefaultPoolConfig())
}
655131
func NewDefaultConfig() *Config {
	return &Config{
		TTL:                env.GetOrDefaultInt("DESIGNATE_TTL", 10),
		PropagationTimeout: env.GetOrDefaultSecond("DESIGNATE_PROPAGATION_TIMEOUT", 10*time.Minute),
		PollingInterval:    env.GetOrDefaultSecond("DESIGNATE_POLLING_INTERVAL", 10*time.Second),
	}
}
1015893
func (e *ebsProvider) DefaultPools() []*storage.Config {
	ssdPool, _ := storage.NewConfig("ebs-ssd", EBS_ProviderType, map[string]interface{}{
		EBS_VolumeType: volumeAliasSSD,
	})
	return []*storage.Config{ssdPool}
}
929442
func NewDefaultConfig() Config {
	// Default max parallelism to half the CPU cores, but at least always one.
	maxparallelism := runtime.NumCPU() / 2
	if maxparallelism <= 0 {
		maxparallelism = 1
	}

	return Config{
		FuncSnippetEnabled:      true,
		GocodeCompletionEnabled: false,
		FormatTool:              formatToolGoimports,
		LintTool:                lintToolNone,
		DiagnosticsEnabled:      false,
		MaxParallelism:          maxparallelism,
		UseBinaryPkgCache:       true,
	}
}
506355
func NewDefaultServerClientWithOptions(options CodeStoreOptions) (Client, error) {
	idStore, err := newIDStore(_GlobalCSVStore)
	if err != nil {
		return nil, err
	}
	return NewServerClient(idStore, options)
}
31587
func SetupDefaultConfig(dockerConfig *Config) *Config {

	defaultConfig := DefaultConfig()

	if dockerConfig.EventMetadataExtractor == nil {
		dockerConfig.EventMetadataExtractor = defaultConfig.EventMetadataExtractor
	}
	if dockerConfig.SocketType == "" {
		dockerConfig.SocketType = defaultConfig.SocketType
	}
	if dockerConfig.SocketAddress == "" {
		dockerConfig.SocketAddress = defaultConfig.SocketAddress
	}
	return dockerConfig
}
1206801
func NewPool(context interface{}, name string, config *PoolConfig) (*WorkPool, error) {
	if config.MinWorkers <= 0 {
		return nil, ErrInvalidMinWorkers
	}

	if config.MaxWorkers <= 0 || config.MaxWorkers < config.MinWorkers {
		return nil, ErrInvalidMaxWorkers
	}

	pool := WorkPool{
		PoolConfig: config,
		name:       name,

		shutdown: make(chan struct{}),
		kill:     make(chan struct{}),
		commands: make(chan int),

		tasks: make(chan doWork),
	}

	pool.manage()

	pool.Add(context, int(pool.MinWorkers))

	//  pool.Add()
	return &pool, nil
}
283362
func (builder *SearchCommandBuilder) WithDefaultOperation(op string) *SearchCommandBuilder {
	builder.protobuf.Op = []byte(op)
	return builder
}
278231
func NewPool(opts ...Option) *Pool {
	pool := &Pool{}
	for _, opt := range opts {
		opt(pool)
	}
	return pool
}
292778
func NewDynamicClientPool(cfg *restclient.Config) ClientPool {
	// restMapper is not needed when using LegacyAPIPathResolverFunc
	emptyMapper := meta.MultiRESTMapper{}
	return NewClientPool(cfg, emptyMapper, LegacyAPIPathResolverFunc)
}
1189979
func DefaultConfig() Config {
	return Config{
		Indent:        false,
		UnEscapeHTML:  false,
		Prefix:        []byte(""),
		StreamingJSON: false,
	}
}
328489
func SetupDefaultConfig(cniConfig *Config) *Config {

	defaultConfig := DefaultConfig()

	if cniConfig.EventMetadataExtractor == nil {
		cniConfig.EventMetadataExtractor = defaultConfig.EventMetadataExtractor
	}

	return cniConfig
}
208002
func defaultStoragePool(modelType ModelType, cfg *config.Config, kind storage.StorageKind, cons StorageConstraints) (string, error) {
	switch kind {
	case storage.StorageKindBlock:
		fallbackPool := string(provider.LoopProviderType)
		if modelType == ModelTypeCAAS {
			fallbackPool = string(k8sprovider.K8s_ProviderType)
		}

		emptyConstraints := StorageConstraints{}
		if cons == emptyConstraints {
			// No constraints at all: use fallback.
			return fallbackPool, nil
		}
		// Either size or count specified, use env default.
		defaultPool, ok := cfg.StorageDefaultBlockSource()
		if !ok {
			defaultPool = fallbackPool
		}
		return defaultPool, nil

	case storage.StorageKindFilesystem:
		fallbackPool := string(provider.RootfsProviderType)
		if modelType == ModelTypeCAAS {
			fallbackPool = string(k8sprovider.K8s_ProviderType)
		}
		emptyConstraints := StorageConstraints{}
		if cons == emptyConstraints {
			return fallbackPool, nil
		}

		// If a filesystem source is specified in config,
		// use that; otherwise if a block source is specified,
		// use that and create a filesystem within.
		defaultPool, ok := cfg.StorageDefaultFilesystemSource()
		if !ok {
			defaultPool, ok = cfg.StorageDefaultBlockSource()
			if !ok {
				// No filesystem or block source,
				// so just use rootfs.
				defaultPool = fallbackPool
			}
		}
		return defaultPool, nil
	}
	return "", ErrNoDefaultStoragePool
}
1290805
func NewWithDefaults(
	serverID string,
	collector collector.EventCollector,
	service packetprocessor.PacketProcessor,
	secrets secrets.Secrets,
	mode constants.ModeType,
	procMountPoint string,
	targetNetworks []string,
) *Datapath {

	if collector == nil {
		zap.L().Fatal("Collector must be given to NewDefaultDatapathEnforcer")
	}

	defaultMutualAuthorization := false
	defaultFQConfig := fqconfig.NewFilterQueueWithDefaults()
	defaultValidity := time.Hour * 8760
	defaultExternalIPCacheTimeout, err := time.ParseDuration(enforcerconstants.DefaultExternalIPTimeout)
	if err != nil {
		defaultExternalIPCacheTimeout = time.Second
	}
	defaultPacketLogs := false

	tokenAccessor, err := tokenaccessor.New(serverID, defaultValidity, secrets)
	if err != nil {
		zap.L().Fatal("Cannot create a token engine", zap.Error(err))
	}

	puFromContextID := cache.NewCache("puFromContextID")

	e := New(
		defaultMutualAuthorization,
		defaultFQConfig,
		collector,
		serverID,
		defaultValidity,
		service,
		secrets,
		mode,
		procMountPoint,
		defaultExternalIPCacheTimeout,
		defaultPacketLogs,
		tokenAccessor,
		puFromContextID,
		&runtime.Configuration{TCPTargetNetworks: targetNetworks},
	)

	conntrackClient, err := flowtracking.NewClient(context.Background())
	if err != nil {
		return nil
	}
	e.conntrack = conntrackClient

	return e
}
298700
func NewBucketizedObjectPool(sizes []Bucket, opts ObjectPoolOptions) BucketizedObjectPool {
	if opts == nil {
		opts = NewObjectPoolOptions()
	}

	sizesAsc := make([]Bucket, len(sizes))
	copy(sizesAsc, sizes)
	sort.Sort(BucketByCapacity(sizesAsc))

	var maxBucketCapacity int
	if len(sizesAsc) != 0 {
		maxBucketCapacity = sizesAsc[len(sizesAsc)-1].Capacity
	}

	iopts := opts.InstrumentOptions()

	return &bucketizedObjectPool{
		opts:              opts,
		sizesAsc:          sizesAsc,
		maxBucketCapacity: maxBucketCapacity,
		maxAlloc:          iopts.MetricsScope().Counter("alloc-max"),
	}
}
949188
func NewDefaultConfig() *Config {
	return &Config{
		TTL:                env.GetOrDefaultInt("ALICLOUD_TTL", 600),
		PropagationTimeout: env.GetOrDefaultSecond("ALICLOUD_PROPAGATION_TIMEOUT", dns01.DefaultPropagationTimeout),
		PollingInterval:    env.GetOrDefaultSecond("ALICLOUD_POLLING_INTERVAL", dns01.DefaultPollingInterval),
		HTTPTimeout:        env.GetOrDefaultSecond("ALICLOUD_HTTP_TIMEOUT", 10*time.Second),
	}
}
726776
func NewDefaultConfig() *Config {
	return &Config{
		PropagationTimeout: env.GetOrDefaultSecond("INWX_PROPAGATION_TIMEOUT", dns01.DefaultPropagationTimeout),
		PollingInterval:    env.GetOrDefaultSecond("INWX_POLLING_INTERVAL", dns01.DefaultPollingInterval),
		TTL:                env.GetOrDefaultInt("INWX_TTL", 300),
		Sandbox:            env.GetOrDefaultBool("INWX_SANDBOX", false),
	}
}