cmd/stindex: Add index checking mode ("idxck") (#5262)

This commit is contained in:
Jakob Borg authored and Audrius Butkevicius committed 2018-10-11 20:48:39 +01:00
1 parent 0690fe7585
commit 7b0c49a1b6
3 files changed
+260 -4

No files matched your search

+12
View File
@@ -43,7 +43,19 @@ func Open(location string) (*Lowlevel, error) {
OpenFilesCacheCapacity: dbMaxOpenFiles,
WriteBuffer: dbWriteBuffer,
}
return open(location, opts)
}
// OpenRO attempts to open the database at the given location, read only.
func OpenRO(location string) (*Lowlevel, error) {
opts := &opt.Options{
OpenFilesCacheCapacity: dbMaxOpenFiles,
ReadOnly: true,
}
return open(location, opts)
}
func open(location string, opts *opt.Options) (*Lowlevel, error) {
db, err := leveldb.OpenFile(location, opts)
if leveldbIsCorrupted(err) {
db, err = leveldb.RecoverFile(location, opts)