aboutsummaryrefslogtreecommitdiff
path: root/weed/filer2/abstract_sql
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2020-08-31 10:22:14 -0700
committerGitHub <noreply@github.com>2020-08-31 10:22:14 -0700
commitedb9d65e056e245731769bbefaa722e2587cdd98 (patch)
treeb0d61c25d97805ba44e78725c515c880c3efb211 /weed/filer2/abstract_sql
parent408e339c53b9b6626e81f1c3f0f2399494bf4ce6 (diff)
parent9a195bebfd6c803161d07ca80b227dd058719aa5 (diff)
downloadseaweedfs-edb9d65e056e245731769bbefaa722e2587cdd98.tar.xz
seaweedfs-edb9d65e056e245731769bbefaa722e2587cdd98.zip
Merge pull request #1431 from kmlebedev/wip-prefix-search
Wip prefix search
Diffstat (limited to 'weed/filer2/abstract_sql')
-rw-r--r--weed/filer2/abstract_sql/abstract_sql_store.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/weed/filer2/abstract_sql/abstract_sql_store.go b/weed/filer2/abstract_sql/abstract_sql_store.go
index 3dd4af103..ce6377aac 100644
--- a/weed/filer2/abstract_sql/abstract_sql_store.go
+++ b/weed/filer2/abstract_sql/abstract_sql_store.go
@@ -4,7 +4,6 @@ import (
"context"
"database/sql"
"fmt"
-
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
@@ -164,14 +163,13 @@ func (store *AbstractSqlStore) DeleteFolderChildren(ctx context.Context, fullpat
return nil
}
-func (store *AbstractSqlStore) ListDirectoryEntries(ctx context.Context, fullpath util.FullPath, startFileName string, inclusive bool, limit int) (entries []*filer2.Entry, err error) {
-
+func (store *AbstractSqlStore) ListDirectoryPrefixedEntries(ctx context.Context, fullpath util.FullPath, startFileName string, inclusive bool, limit int, prefix string) (entries []*filer2.Entry, err error) {
sqlText := store.SqlListExclusive
if inclusive {
sqlText = store.SqlListInclusive
}
- rows, err := store.getTxOrDB(ctx).QueryContext(ctx, sqlText, util.HashStringToLong(string(fullpath)), startFileName, string(fullpath), limit)
+ rows, err := store.getTxOrDB(ctx).QueryContext(ctx, sqlText, util.HashStringToLong(string(fullpath)), startFileName, string(fullpath), prefix, limit)
if err != nil {
return nil, fmt.Errorf("list %s : %v", fullpath, err)
}
@@ -199,6 +197,10 @@ func (store *AbstractSqlStore) ListDirectoryEntries(ctx context.Context, fullpat
return entries, nil
}
+func (store *AbstractSqlStore) ListDirectoryEntries(ctx context.Context, fullpath util.FullPath, startFileName string, inclusive bool, limit int) (entries []*filer2.Entry, err error) {
+ return store.ListDirectoryPrefixedEntries(ctx, fullpath, startFileName, inclusive, limit, "")
+}
+
func (store *AbstractSqlStore) Shutdown() {
store.DB.Close()
}