Skip to content

Commit 6522def

Browse files
author
Beau Shinkle
committed
Expose checkStoragePermission as a public function
1 parent f16f7bd commit 6522def

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

pkg/persistence/disk_persistence.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const (
1818

1919
// NewDiskHandle creates on-disk data persistence handle
2020
func NewDiskHandle(path string) (Handle, error) {
21-
err := checkStoragePermission(path)
21+
err := CheckStoragePermission(path)
2222
if err != nil {
2323
return nil, err
2424
}
@@ -152,7 +152,8 @@ func (ds *diskPersistence) getStorageCurrentDirPath() string {
152152
return fmt.Sprintf("%s/%s", ds.dataDir, currentDir)
153153
}
154154

155-
func checkStoragePermission(dirBasePath string) error {
155+
// CheckStoragePermission returns an error if we don't have both read and write access to a directory.
156+
func CheckStoragePermission(dirBasePath string) error {
156157
_, err := ioutil.ReadDir(dirBasePath)
157158
if err != nil {
158159
return fmt.Errorf("cannot read from the storage directory: [%v]", err)

0 commit comments

Comments
 (0)