Skip to content

Commit 63e27dd

Browse files
authored
Merge pull request #77 from keep-network/expose-checkStoragePermission
Expose checkStoragePermission as a Public Function What we really want here is to adjust persistence.Handle to provide support for multiple storage areas, some of which need the current/archive/snapshot behavior and some of which just store data normally. For now, we expose functions like this one until time can be invested to export a higher-level abstraction and unexport these lower-level details.
2 parents f16f7bd + 6522def commit 63e27dd

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)