// NewEngine returns a new Engine
547177
func NewEngine(sess session.Session, g *secure.Guard) *Engine {
	return &Engine{sess: sess, guard: g}
}
789761
func NewEngine(cfg *config.Config, t *http.Transport, options ...func(*Engine)) *Engine {
	engine := &Engine{
		config:        cfg,
		stop:          make(chan struct{}),
		targetVersion: "unknown",
		client:        &http.Client{Transport: t},
	}

	for _, opt := range options {
		opt(engine)
	}

	if engine.timeManager == nil {
		engine.timeManager = defaultTimeManager{}
	}

	return engine
}
1012291
func NewVerificationEngine(context string) (VerificationEngine, error) {

	engine := VerificationEngine{}

	if context == "" {
		return engine, errors.New("Context cannot be empty when initializing the Verification Engine")
	}

	// try to load the public key and if it succeed, then return both the keys
	publicFile := fmt.Sprintf(publicKeySuffixFormat, sanitizeIdentifier(context))
	// if the key exists
	if keyFileExists(publicFile) {
		// try to read it
		public, err := readKey(publicFile, keysFolderPrefixFormat)
		if err != nil {
			// in case of error return it
			return engine, err
		}

		// if we reached here, it means that both the public key
		// existed and was loaded successfull
		engine.publicKey = public
	}

	return engine, nil

}
1209934
func (s *Configuration) SetEngineType(v string) *Configuration {
	s.EngineType = &v
	return s
}
133084
func New(cfg ...Config) *Engine {
	c := DefaultConfig()
	if len(cfg) > 0 {
		c = cfg[0]
	}

	// cuz mergo has a little bug on maps
	if c.Helpers == nil {
		c.Helpers = make(map[string]interface{}, 0)
	}

	e := &Engine{Config: c, templateCache: make(map[string]*raymond.Template, 0)}

	raymond.RegisterHelper("render", func(partial string, binding interface{}) raymond.SafeString {
		contents, err := e.executeTemplateBuf(partial, binding)
		if err != nil {
			return raymond.SafeString("Template with name: " + partial + " couldn't not be found.")
		}
		return raymond.SafeString(contents)
	})

	return e
}
243789
func (loader *TemplateLoader) CreateTemplateEngine(templateEngineName string) (TemplateEngine, error) {
	if "" == templateEngineName {
		templateEngineName = GO_TEMPLATE
	}
	factory := templateLoaderMap[templateEngineName]
	if nil == factory {
		fmt.Printf("registered factories %#v\n %s \n", templateLoaderMap, templateEngineName)
		return nil, errors.New("Unknown template engine name - " + templateEngineName + ".")
	}
	templateEngine, err := factory(loader)
	if nil != err {
		return nil, errors.New("Failed to init template engine (" + templateEngineName + "), " + err.Error())
	}

	templateLog.Debug("CreateTemplateEngine: init templates", "name", templateEngineName)
	return templateEngine, nil
}
318697
func (s *CreateDBClusterInput) SetEngine(v string) *CreateDBClusterInput {
	s.Engine = &v
	return s
}
1109522
func (s *GlobalCluster) SetEngine(v string) *GlobalCluster {
	s.Engine = &v
	return s
}
1223424
func NewEngine(path string, idx *tsi1.Index, config Config, options ...EngineOption) *Engine {
	fs := NewFileStore(path)
	fs.openLimiter = limiter.NewFixed(config.MaxConcurrentOpens)
	fs.tsmMMAPWillNeed = config.MADVWillNeed

	cache := NewCache(uint64(config.Cache.MaxMemorySize))

	c := NewCompactor()
	c.Dir = path
	c.FileStore = fs
	c.RateLimit = limiter.NewRate(
		int(config.Compaction.Throughput),
		int(config.Compaction.ThroughputBurst))

	// determine max concurrent compactions informed by the system
	maxCompactions := config.Compaction.MaxConcurrent
	if maxCompactions == 0 {
		maxCompactions = runtime.GOMAXPROCS(0) / 2 // Default to 50% of cores for compactions

		// On systems with more cores, cap at 4 to reduce disk utilization.
		if maxCompactions > 4 {
			maxCompactions = 4
		}

		if maxCompactions < 1 {
			maxCompactions = 1
		}
	}

	// Don't allow more compactions to run than cores.
	if maxCompactions > runtime.GOMAXPROCS(0) {
		maxCompactions = runtime.GOMAXPROCS(0)
	}

	logger := zap.NewNop()
	e := &Engine{
		path:        path,
		index:       idx,
		sfile:       idx.SeriesFile(),
		logger:      logger,
		traceLogger: logger,

		WAL:   NopWAL{},
		Cache: cache,

		FileStore: fs,
		Compactor: c,
		CompactionPlan: NewDefaultPlanner(fs,
			time.Duration(config.Compaction.FullWriteColdDuration)),

		CacheFlushMemorySizeThreshold: uint64(config.Cache.SnapshotMemorySize),
		CacheFlushWriteColdDuration:   time.Duration(config.Cache.SnapshotWriteColdDuration),
		enableCompactionsOnOpen:       true,
		formatFileName:                DefaultFormatFileName,
		compactionLimiter:             limiter.NewFixed(maxCompactions),
		scheduler:                     newScheduler(maxCompactions),
	}

	for _, option := range options {
		option(e)
	}

	return e
}
1044419
func (r *EtcdRegistry) UpdateEngineVersion(from, to int) error {
	key := r.engineVersionPath()

	strTo := strconv.Itoa(to)
	strFrom := strconv.Itoa(from)

	opts := &etcd.SetOptions{
		PrevValue: strFrom,
	}
	_, err := r.kAPI.Set(context.Background(), key, strTo, opts)
	if err == nil {
		return nil
	} else if !isEtcdError(err, etcd.ErrorCodeKeyNotFound) {
		return err
	}

	opts = &etcd.SetOptions{
		PrevExist: etcd.PrevNoExist,
	}
	_, err = r.kAPI.Set(context.Background(), key, strTo, opts)
	return err
}
284162
func (s *CreateConfigurationRequest) SetEngineType(v string) *CreateConfigurationRequest {
	s.EngineType = &v
	return s
}
1060246
func NewEngineCommand(dockerCli command.Cli) *cobra.Command {
	cmd := &cobra.Command{
		Use:   "engine COMMAND",
		Short: "Manage the docker engine",
		Args:  cli.NoArgs,
		RunE:  command.ShowHelp(dockerCli.Err()),
	}
	cmd.AddCommand(
		newActivateCommand(dockerCli),
		newCheckForUpdatesCommand(dockerCli),
		newUpdateCommand(dockerCli),
	)
	return cmd
}
712562
func New(endpoint protocol.EngineEndpoint) (e *Engine, err error) {

	e = &Engine{
		endpoint: endpoint,
	}

	e.stop = make(chan bool)

	e.opsExecutors = map[int]executor{
		parser.CreateToken:   createExecutor,
		parser.TableToken:    createTableExecutor,
		parser.SelectToken:   selectExecutor,
		parser.InsertToken:   insertIntoTableExecutor,
		parser.DeleteToken:   deleteExecutor,
		parser.UpdateToken:   updateExecutor,
		parser.IfToken:       ifExecutor,
		parser.NotToken:      notExecutor,
		parser.ExistsToken:   existsExecutor,
		parser.TruncateToken: truncateExecutor,
		parser.DropToken:     dropExecutor,
		parser.GrantToken:    grantExecutor,
	}

	e.relations = make(map[string]*Relation)

	err = e.start()
	if err != nil {
		return nil, err
	}

	return
}
950279
func (s *RestoreDBInstanceToPointInTimeInput) SetEngine(v string) *RestoreDBInstanceToPointInTimeInput {
	s.Engine = &v
	return s
}
804283
func NewEngine(name string, database DatabaseProxy, cache CacheProxy) Engine {
	eng := &engine{
		name:     name,
		database: database,
		cache:    cache,
		indexes:  make(map[string]map[string]Index),
	}
	if eng.cache == nil {
		eng.cache = NullCacheProxy
	}
	return eng
}
589003
func (s *RestoreDBClusterFromSnapshotInput) SetEngine(v string) *RestoreDBClusterFromSnapshotInput {
	s.Engine = &v
	return s
}
368501
func New(cfg ...Config) *Engine {
	c := DefaultConfig()
	if len(cfg) > 0 {
		c = cfg[0]
	}
	// cuz mergo has a little bug on maps
	if c.Globals == nil {
		c.Globals = make(map[string]interface{}, 0)
	}
	if c.Filters == nil {
		c.Filters = make(map[string]FilterFunction, 0)
	}

	return &Engine{Config: c, templateCache: make(map[string]*pongo2.Template)}
}