code: func OpenFile(path string, readOnly bool) (Storage, error) {
  	if fi, err := os.Stat(path); err == nil {
  		if !fi.IsDir() {
  			return nil, fmt.Errorf("leveldb/storage: open %s: not a directory", path)
  		}
  	} else if os.IsNotExist(err) && !readOnly {
  		if err := os.MkdirAll(path, 0755); err != nil {
  			return nil, err
  		}
  	} else {
  		return nil, err
  	}
  
  	flock, err := newFileLock(filepath.Join(path, "LOCK"), readOnly)
  	if err != nil {
  		return nil, err
  	}
  
  	defer func() {
  		if err != nil {
  			flock.release()
  		}
  	}()
  
  	var (
  		logw    *os.File
  		logSize int64
  	)
  	if !readOnly {
  		logw, err = os.OpenFile(filepath.Join(path, "LOG"), os.O_WRONLY|os.O_CREATE, 0644)
  		if err != nil {
  			return nil, err
  		}
  		logSize, err = logw.Seek(0, os.SEEK_END)
  		if err != nil {
  			logw.Close()
  			return nil, err
  		}
  	}
  
  	fs := &fileStorage{
  		path:     path,
  		readOnly: readOnly,
  		flock:    flock,
  		logw:     logw,
  		logSize:  logSize,
  	}
  	runtime.SetFinalizer(fs, (*fileStorage).Close)
  	return fs, nil
  }
docs: // OpenFile returns a new filesystem-backed storage implementation with the given
  // path. This also acquire a file lock, so any subsequent attempt to open the
  // same path will fail.
  //
  // The storage must be closed after use, by calling Close method.