|
@ -4,9 +4,10 @@ import ( |
|
|
"bytes" |
|
|
"bytes" |
|
|
"context" |
|
|
"context" |
|
|
"crypto/md5" |
|
|
"crypto/md5" |
|
|
|
|
|
"errors" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"github.com/syndtr/goleveldb/leveldb" |
|
|
"github.com/syndtr/goleveldb/leveldb" |
|
|
"github.com/syndtr/goleveldb/leveldb/errors" |
|
|
|
|
|
|
|
|
leveldb_errors "github.com/syndtr/goleveldb/leveldb/errors" |
|
|
"github.com/syndtr/goleveldb/leveldb/opt" |
|
|
"github.com/syndtr/goleveldb/leveldb/opt" |
|
|
leveldb_util "github.com/syndtr/goleveldb/leveldb/util" |
|
|
leveldb_util "github.com/syndtr/goleveldb/leveldb/util" |
|
|
"io" |
|
|
"io" |
|
@ -52,7 +53,7 @@ func (store *LevelDB2Store) initialize(dir string, dbCount int) (err error) { |
|
|
dbFolder := fmt.Sprintf("%s/%02d", dir, d) |
|
|
dbFolder := fmt.Sprintf("%s/%02d", dir, d) |
|
|
os.MkdirAll(dbFolder, 0755) |
|
|
os.MkdirAll(dbFolder, 0755) |
|
|
db, dbErr := leveldb.OpenFile(dbFolder, opts) |
|
|
db, dbErr := leveldb.OpenFile(dbFolder, opts) |
|
|
if errors.IsCorrupted(dbErr) { |
|
|
|
|
|
|
|
|
if leveldb_errors.IsCorrupted(dbErr) { |
|
|
db, dbErr = leveldb.RecoverFile(dbFolder, opts) |
|
|
db, dbErr = leveldb.RecoverFile(dbFolder, opts) |
|
|
} |
|
|
} |
|
|
if dbErr != nil { |
|
|
if dbErr != nil { |
|
@ -168,7 +169,7 @@ func (store *LevelDB2Store) DeleteFolderChildren(ctx context.Context, fullpath w |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (store *LevelDB2Store) ListDirectoryPrefixedEntries(ctx context.Context, fullpath weed_util.FullPath, startFileName string, inclusive bool, limit int, prefix string) (entries []*filer2.Entry, err error) { |
|
|
func (store *LevelDB2Store) ListDirectoryPrefixedEntries(ctx context.Context, fullpath weed_util.FullPath, startFileName string, inclusive bool, limit int, prefix string) (entries []*filer2.Entry, err error) { |
|
|
return nil, fmt.Errorf("UNSUPPORTED") |
|
|
|
|
|
|
|
|
return nil, errors.New(filer2.UnsupportedListDirectoryPrefixedErr) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (store *LevelDB2Store) ListDirectoryEntries(ctx context.Context, fullpath weed_util.FullPath, startFileName string, inclusive bool, |
|
|
func (store *LevelDB2Store) ListDirectoryEntries(ctx context.Context, fullpath weed_util.FullPath, startFileName string, inclusive bool, |
|
|