// Open opens and initializes the engine.
422019
func (e *Engine) Open(ctx context.Context) (err error) {
	span, ctx := tracing.StartSpanFromContext(ctx)
	defer span.Finish()

	defer func() {
		if err != nil {
			e.Close()
		}
	}()

	e.indexref, err = e.index.Acquire()
	if err != nil {
		return err
	}

	e.sfileref, err = e.sfile.Acquire()
	if err != nil {
		return err
	}

	e.initTrackers()

	if err := os.MkdirAll(e.path, 0777); err != nil {
		return err
	}

	if err := e.cleanup(); err != nil {
		return err
	}

	if err := e.FileStore.Open(ctx); err != nil {
		return err
	}

	e.Compactor.Open()

	if e.enableCompactionsOnOpen {
		e.SetCompactionsEnabled(true)
	}

	return nil
}
37848
func (f *Function) Open(environment string) error {
	f.defaults()

	f.Log = f.Log.WithFields(log.Fields{
		"function": f.Name,
		"env":      environment,
	})

	f.Log.Debug("open")

	if err := f.loadConfig(environment); err != nil {
		return errors.Wrap(err, "loading config")
	}

	if err := f.hookOpen(); err != nil {
		return errors.Wrap(err, "open hook")
	}

	if err := validator.Validate(&f.Config); err != nil {
		return errors.Wrap(err, "validating")
	}

	ignoreFile, err := utils.ReadIgnoreFile(f.Path)
	if err != nil {
		return errors.Wrap(err, "reading ignore file")
	}

	f.IgnoreFile = append(f.IgnoreFile, []byte("\n")...)
	f.IgnoreFile = append(f.IgnoreFile, ignoreFile...)

	return nil
}
422421
func (e *baseExecutor) Open(ctx context.Context) error {
	for _, child := range e.children {
		err := child.Open(ctx)
		if err != nil {
			return err
		}
	}
	return nil
}
752621
func (c *Client) Open(ctx context.Context, logger chronograf.Logger, build chronograf.BuildInfo, opts ...Option) error {
	if c.db == nil {
		if _, err := os.Stat(c.Path); os.IsNotExist(err) {
			c.isNew = true
		} else if err != nil {
			return err
		}

		// Open database file.
		db, err := bolt.Open(c.Path, 0600, &bolt.Options{Timeout: 1 * time.Second})
		if err != nil {
			return fmt.Errorf("unable to open boltdb; is there a chronograf already running?  %v", err)
		}
		c.db = db
		c.logger = logger

		for _, opt := range opts {
			if opt.Backup() {
				if err = c.backup(ctx, build); err != nil {
					return fmt.Errorf("unable to backup your database prior to migrations:  %v", err)
				}
			}
		}
	}

	if err := c.initialize(ctx); err != nil {
		return fmt.Errorf("unable to boot boltdb:  %v", err)
	}
	if err := c.migrate(ctx, build); err != nil {
		return fmt.Errorf("unable to migrate boltdb:  %v", err)
	}

	return nil
}
1238479
func (t *ConsoleTarget) Open(io.Writer) error {
	t.Filter.Init()
	if t.Writer == nil {
		return errors.New("ConsoleTarget.Writer cannot be nil")
	}
	if runtime.GOOS == "windows" {
		t.ColorMode = false
	}
	return nil
}
1233226
func Open(cfg RawConfig) (*Client, error) {
	client, err := OpenForSender(cfg, &senderOpener{})
	return client, errors.Trace(err)
}
1244589
func (o *openHelper) Open(ctx context.Context, op opener) {
	if o.err != nil {
		return
	}
	o.err = op.Open(ctx)
	if o.err == nil {
		o.opened = append(o.opened, op)
	}
}
461566
func (m *PerformanceQueryImpl) Open() error {
	if m.query != 0 {
		err := m.Close()
		if err != nil {
			return err
		}
	}
	var handle PDH_HQUERY

	if ret := PdhOpenQuery(0, 0, &handle); ret != ERROR_SUCCESS {
		return NewPdhError(ret)
	}
	m.query = handle
	return nil
}
20252
func (e *ReplaceExec) Open(ctx context.Context) error {
	if e.SelectExec != nil {
		return e.SelectExec.Open(ctx)
	}
	e.initEvalBuffer()
	return nil
}
1158723
func (o *LinuxOpener) Open(u string, windowType WindowType, autoRaise bool) error {
	if getEnv("DISPLAY", o.Env) == "" {
		return &RequireXError{}
	}
	cmd := exec.Command("xdg-open", u)
	return cmd.Run()
}
89379
func (s *Server) Open(l int) *Client {
	c := NewClient(l)
	c.Attach(s)
	return c
}
652155
func (store *MemoryStore) Open() {
	store.Lock()
	defer store.Unlock()
	store.opened = true
	DEBUG.Println(STR, "memorystore initialized")
}
785615
func (e *LoadDataExec) Open(ctx context.Context) error {
	if e.loadDataInfo.insertColumns != nil {
		e.loadDataInfo.initEvalBuffer()
	}
	return nil
}
970246
func (d Datastore) Open(ctx context.Context, name string) (*DatastoreFile, error) {
	return &DatastoreFile{
		d:      d,
		name:   name,
		length: -1,
		ctx:    ctx,
	}, nil
}
201584
func Open(path string) (*File, error) {
	f, err := os.Open(path)
	if err != nil {
		return nil, err
	}
	stat, err := f.Stat()
	if err != nil {
		f.Close()
		return nil, err
	}

	contentType, err := api.DetectContentType(f.Name(), f)
	if err != nil {
		return nil, err
	}

	return &File{
		ReadCloser: f,
		ManifestEntry: api.ManifestEntry{
			ContentType: contentType,
			Mode:        int64(stat.Mode()),
			Size:        stat.Size(),
			ModTime:     stat.ModTime(),
		},
	}, nil
}
636361
func (c *Config) Open(id string, logger log.Logger) (connector.Connector, error) {
	return &callback{logger: logger, pathSuffix: "/" + id}, nil
}
483853
func (s *Stream) Open() (io.ReadCloser, error) {
	return s.wim.resourceReader(&s.offset)
}