Skip to content

Commit b35ff00

Browse files
committed
db: re-export base.LockDirectory, base.DirLock
This function and type are used by the users of Pebble, so they need to be exported from a non-internal package.
1 parent 7d7e2f4 commit b35ff00

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

options.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,21 @@ type UserKeyPrefixBound = sstable.UserKeyPrefixBound
7676
// IterKeyType configures which types of keys an iterator should surface.
7777
type IterKeyType int8
7878

79+
// DirLock represents a file lock on a directory. It may be passed to Open through
80+
// Options.Lock to elide lock aquisition during Open.
81+
type DirLock = base.DirLock
82+
83+
// LockDirectory acquires the directory lock in the named directory, preventing
84+
// another process from opening the database. LockDirectory returns a
85+
// handle to the held lock that may be passed to Open, skipping lock acquisition
86+
// during Open.
87+
//
88+
// LockDirectory may be used to expand the critical section protected by the
89+
// database lock to include setup before the call to Open.
90+
func LockDirectory(dirname string, fs vfs.FS) (*DirLock, error) {
91+
return base.LockDirectory(dirname, fs)
92+
}
93+
7994
const (
8095
// IterKeyTypePointsOnly configures an iterator to iterate over point keys
8196
// only.

0 commit comments

Comments
 (0)