Skip to content

Commit

Permalink
Move ListDirectoryEntries logic to ListDirectoryPrefixedEntries in et…
Browse files Browse the repository at this point in the history
…cd meta storage backend (seaweedfs#5416)

Move ListDirectoryEntries logic to ListDirectoryPrefixedEntries
  • Loading branch information
sample authored Mar 24, 2024
1 parent 2dd2bb3 commit 9ca871a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions weed/filer/etcd/etcd_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,7 @@ func (store *EtcdStore) DeleteFolderChildren(ctx context.Context, fullpath weed_
}

func (store *EtcdStore) ListDirectoryPrefixedEntries(ctx context.Context, dirPath weed_util.FullPath, startFileName string, includeStartFile bool, limit int64, prefix string, eachEntryFunc filer.ListEachEntryFunc) (lastFileName string, err error) {
return lastFileName, filer.ErrUnsupportedListDirectoryPrefixed
}

func (store *EtcdStore) ListDirectoryEntries(ctx context.Context, dirPath weed_util.FullPath, startFileName string, includeStartFile bool, limit int64, eachEntryFunc filer.ListEachEntryFunc) (lastFileName string, err error) {
directoryPrefix := genDirectoryKeyPrefix(dirPath, "")
directoryPrefix := genDirectoryKeyPrefix(dirPath, prefix)
lastFileStart := directoryPrefix
if startFileName != "" {
lastFileStart = genDirectoryKeyPrefix(dirPath, startFileName)
Expand Down Expand Up @@ -224,6 +220,10 @@ func (store *EtcdStore) ListDirectoryEntries(ctx context.Context, dirPath weed_u
return lastFileName, err
}

func (store *EtcdStore) ListDirectoryEntries(ctx context.Context, dirPath weed_util.FullPath, startFileName string, includeStartFile bool, limit int64, eachEntryFunc filer.ListEachEntryFunc) (lastFileName string, err error) {
return store.ListDirectoryPrefixedEntries(ctx, dirPath, startFileName, includeStartFile, limit, "", eachEntryFunc)
}

func genKey(dirPath, fileName string) (key []byte) {
key = []byte(dirPath)
key = append(key, DIR_FILE_SEPARATOR)
Expand Down

0 comments on commit 9ca871a

Please sign in to comment.