// Open opens the named file relative to the Datastore.
970246
func (d Datastore) Open(ctx context.Context, name string) (*DatastoreFile, error) {
	return &DatastoreFile{
		d:      d,
		name:   name,
		length: -1,
		ctx:    ctx,
	}, nil
}
1286908
func (s *KVStore) Open(ctx context.Context) error {
	// Ensure the required directory structure exists.
	if err := os.MkdirAll(filepath.Dir(s.path), 0700); err != nil {
		return fmt.Errorf("unable to create directory %s: %v", s.path, err)
	}

	if _, err := os.Stat(s.path); err != nil && !os.IsNotExist(err) {
		return err
	}

	// Open database file.
	db, err := bolt.Open(s.path, 0600, &bolt.Options{Timeout: 1 * time.Second})
	if err != nil {
		return fmt.Errorf("unable to open boltdb file %v", err)
	}
	s.db = db

	s.logger.Info("Resources opened", zap.String("path", s.path))
	return nil
}
1292119
func (fs *LanguageFs) Open(name string) (afero.File, error) {
	name, err := fs.realName(name)
	if err != nil {
		return nil, err
	}
	f, err := fs.Fs.Open(name)

	if err != nil {
		return nil, err
	}
	return &languageFile{File: f, fs: fs}, nil
}
195790
func Open(filename string) (*os.File, error) {
	return OpenFile(filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666)
}
38990
func (fi *FileInfo) Open() (hugio.ReadSeekCloser, error) {
	f, err := fi.sp.SourceFs.Open(fi.Filename())
	return f, err
}
37723
func (fs *gcsFS) Open(name string) (wkfs.File, error) {
	bucket, fileName, err := fs.parseName(name)
	if err != nil {
		return nil, err
	}
	obj := fs.sc.Bucket(bucket).Object(fileName)
	attrs, err := obj.Attrs(fs.ctx)
	if err != nil {
		return nil, err
	}
	size := attrs.Size
	if size > maxSize {
		return nil, fmt.Errorf("file %s too large (%d bytes) for /gcs/ filesystem", name, size)
	}
	rc, err := obj.NewReader(fs.ctx)
	if err != nil {
		return nil, err
	}
	defer rc.Close()

	slurp, err := ioutil.ReadAll(io.LimitReader(rc, size))
	if err != nil {
		return nil, err
	}
	return &file{
		name:   name,
		Reader: bytes.NewReader(slurp),
	}, 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)
}
1212010
func (lfs localFileSystem) Open(fn string) (ReadCloser, error) {
	file, err := villa.Path(fn).Open()
	if err != nil {
		return nil, err
	}

	return BufferedFileReader{
		file:   file,
		Reader: bufio.NewReader(file),
	}, nil
}
984212
func Open(driverName, dataSourceName string) (*DB, error) {
	db, err := sql.Open(driverName, dataSourceName)
	if err != nil {
		return nil, err
	}
	return &DB{DB: db, driverName: driverName, Mapper: mapper()}, err
}
1308079
func (t *tOps) open(f *tFile) (ch *cache.Handle, err error) {
	ch = t.cache.Get(0, uint64(f.fd.Num), func() (size int, value cache.Value) {
		var r storage.Reader
		r, err = t.s.stor.Open(f.fd)
		if err != nil {
			return 0, nil
		}

		var bcache *cache.NamespaceGetter
		if t.bcache != nil {
			bcache = &cache.NamespaceGetter{Cache: t.bcache, NS: uint64(f.fd.Num)}
		}

		var tr *table.Reader
		tr, err = table.NewReader(r, f.size, f.fd, bcache, t.bpool, t.s.o.Options)
		if err != nil {
			r.Close()
			return 0, nil
		}
		return 1, tr

	})
	if ch == nil && err == nil {
		err = ErrClosed
	}
	return
}
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,
	}
}
561017
func (m *Multi) Open(name string) (io.ReadCloser, error) {
	for _, loader := range m.loaders {
		if f, err := loader.Open(name); err == nil {
			return f, nil
		}
	}
	return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
}
438487
func (f *IndexFile) Open() error {
	defer func() {
		if err := recover(); err != nil {
			err = fmt.Errorf("[Index file: %s] %v", f.path, err)
			panic(err)
		}
	}()

	// Extract identifier from path name.
	f.id, f.level = ParseFilename(f.Path())

	data, err := mmap.Map(f.Path(), 0)
	if err != nil {
		return err
	}

	return f.UnmarshalBinary(data)
}
777969
func Open(driverName, dsn string) (*DB, error) {
	sqlDB, err := sql.Open(driverName, dsn)
	if err != nil {
		return nil, err
	}

	return NewFromDB(sqlDB, driverName), nil
}
193821
func (rfs *RootFS) Open(filename string) (f billy.File, err error) {
	if !rootWrappedNodeNames[filename] {
		// In particular, this FS doesn't let you open the folderlist
		// directories or anything in them.
		return nil, os.ErrNotExist
	}

	switch filename {
	case StatusFileName:
		return &wrappedReadFile{
			name: StatusFileName,
			reader: func(ctx context.Context) ([]byte, time.Time, error) {
				return GetEncodedStatus(ctx, rfs.config)
			},
			log: rfs.log,
		}, nil
	default:
		panic(fmt.Sprintf("Name %s was in map, but not in switch", filename))
	}
}
9850
func (w *Writer) open(filepath string) error {
	f, err := os.Create(filepath)
	if err != nil {
		return err
	}
	w.File = f
	return nil
}
1020536
func (s *Server) Open() error {
	opts := stand.GetDefaultOptions()
	opts.StoreType = stores.TypeFile
	opts.ID = ServerName
	opts.FilestoreDir = s.config.FilestoreDir
	server, err := stand.RunServerWithOpts(opts, nil)
	if err != nil {
		return err
	}

	s.Server = server

	return nil
}