// Open implements environs.EnvironProvider.
498029
func (e *EnvironProvider) Open(params environs.OpenParams) (environs.Environ, error) {
	logger.Infof("opening model %q", params.Config.Name())

	if err := validateCloudSpec(params.Cloud); err != nil {
		return nil, errors.Trace(err)
	}

	creds := params.Cloud.Credential.Attributes()
	jujuConfig := common.JujuConfigProvider{
		Key:         []byte(creds["key"]),
		Fingerprint: creds["fingerprint"],
		Passphrase:  creds["pass-phrase"],
		Tenancy:     creds["tenancy"],
		User:        creds["user"],
		OCIRegion:   creds["region"],
	}
	provider, err := jujuConfig.Config()
	if err != nil {
		return nil, errors.Trace(err)
	}
	compute, err := ociCore.NewComputeClientWithConfigurationProvider(provider)
	if err != nil {
		return nil, errors.Trace(err)
	}

	networking, err := ociCore.NewVirtualNetworkClientWithConfigurationProvider(provider)
	if err != nil {
		return nil, errors.Trace(err)
	}

	storage, err := ociCore.NewBlockstorageClientWithConfigurationProvider(provider)
	if err != nil {
		return nil, errors.Trace(err)
	}

	identity, err := ociIdentity.NewIdentityClientWithConfigurationProvider(provider)
	if err != nil {
		return nil, errors.Trace(err)
	}

	env := &Environ{
		Compute:    compute,
		Networking: networking,
		Storage:    storage,
		Firewall:   networking,
		Identity:   identity,
		ociConfig:  provider,
		clock:      clock.WallClock,
		p:          e,
	}

	if err := env.SetConfig(params.Config); err != nil {
		return nil, err
	}

	env.namespace, err = instance.NewNamespace(env.Config().UUID())

	cfg := env.ecfg()
	if cfg.compartmentID() == nil {
		return nil, errors.New("compartment-id may not be empty")
	}

	addressSpace := cfg.addressSpace()
	if _, ipNET, err := net.ParseCIDR(*addressSpace); err == nil {
		size, _ := ipNET.Mask.Size()
		if size > 16 {
			return nil, errors.Errorf("configured subnet (%q) is not large enough. Please use a prefix length in the range /8 to /16. Current prefix length is /%d", *addressSpace, size)
		}
	} else {
		return nil, errors.Trace(err)
	}

	return env, nil
}
886505
func (l *httpFileSystemLoader) Open(name string) (io.ReadCloser, error) {
	if l.fs == nil {
		return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
	}
	return l.fs.Open(name)
}
811398
func environ() map[string]string {
	if env == nil {
		env = make(map[string]string)
		envVars := os.Environ()
		for _, envVar := range envVars {
			kv := strings.SplitN(envVar, "=", 2)
			if len(kv) != 2 {
				continue
			}
			env[kv[0]] = kv[1]
		}
	}
	return env
}
563304
func environ() (env []string) {
	for _, v := range os.Environ() {
		if !strings.HasPrefix(v, "GOPATH=") {
			env = append(env, v)
		}
	}
	env = append(env, "GOPATH="+gopath)
	return
}
945426
func Open(repoPath string) (repo.Repo, error) {
	fn := func() (repo.Repo, error) {
		return open(repoPath)
	}
	return onlyOne.Open(repoPath, fn)
}
446879
func (s *S3) Open(ctx context.Context, path string) (*File, error) {
	return nil, fmt.Errorf("Open not implemented for S3")
}
263599
func (ec *Envcfg) Env() string {
	if env := ec.GetKey(ec.envKey); env != "" {
		return env
	}
	return DefaultEnvironment
}
344908
func Open(paths ...string) gkv.KV {
	var path string
	if len(paths) != 0 {
		path = paths[0]
	} else {
		path = filepath.Join(gkv.ProjectDir(), "data")
	}
	f, err := os.Stat(path)
	if err != nil {
		if os.IsNotExist(err) {
			err = os.MkdirAll(path, 0755)
		}
		if err != nil {
			panic(err)
		}
	} else if !f.IsDir() {
		path = filepath.Dir(path)
	}

	opts := badger.DefaultOptions
	opts.Dir = path
	opts.ValueDir = path
	opts.MaxTableSize = 1 << 15
	opts.LevelOneSize = 4 << 15
	opts.SyncWrites = false

	db, err := badger.Open(opts)
	if err != nil {
		panic(err)
	}
	return &KV{
		db: db,
	}
}
876420
func (a *AtomicFS) Open(ctx context.Context, path string) (ctxvfs.ReadSeekCloser, error) {
	fs := a.v.Load().(ctxvfs.NameSpace)
	return fs.Open(ctx, path)
}
232550
func (o *ResourceHolder) Open() (io.Reader, error) {
	if o.Resource == nil {
		return nil, fmt.Errorf("ResourceHolder %q is not bound", o.Name)
	}
	return o.Resource.Open()
}
1233226
func Open(cfg RawConfig) (*Client, error) {
	client, err := OpenForSender(cfg, &senderOpener{})
	return client, errors.Trace(err)
}
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
}
567479
func (c *Config) Open(logger log.Logger) (storage.Storage, error) {
	cli, err := c.open(logger, false)
	if err != nil {
		return nil, err
	}
	return cli, nil
}
1188227
func (p pfx) Open(ctx context.Context, path string) (*File, error) {
	return p.fs.Open(ctx, p.addPrefix(path))
}
466165
func (i *item) Open() (io.ReadCloser, error) {
	return os.Open(i.path)
}
706228
func (m *mem) Open(_ context.Context, path string) (*File, error) {
	m.RLock()
	f, ok := m.data[path]
	m.RUnlock()

	if ok {
		return &File{
			ReadCloser: f.readCloser(),
			Name:       f.name,
			ModTime:    f.modTime,
			Size:       f.size(),
		}, nil
	}
	return nil, &notExistError{
		Path: path,
	}
}
637082
func Open(location string) (*Lowlevel, error) {
	opts := &opt.Options{
		OpenFilesCacheCapacity: dbMaxOpenFiles,
		WriteBuffer:            dbWriteBuffer,
	}
	return open(location, opts)
}