SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
implement sql changes
Chris Luc0bcf6f6e161
diff --git a/weed/filer/abstract_sql/abstract_sql_store.go b/weed/filer/abstract_sql/abstract_sql_store.goindex da104358bb..475dec2bed 100644--- a/weed/filer/abstract_sql/abstract_sql_store.go+++ b/weed/filer/abstract_sql/abstract_sql_store.go@@ -172,15 +172,15 @@ func (store *AbstractSqlStore) DeleteFolderChildren(ctx context.Context, fullpatreturn nil}-func (store *AbstractSqlStore) ListDirectoryPrefixedEntries(ctx context.Context, fullpath util.FullPath, startFileName string, inclusive bool, limit int, prefix string) (entries []*filer.Entry, err error) {+func (store *AbstractSqlStore) ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int, prefix string) (entries []*filer.Entry, hasMore bool, err error) {sqlText := store.SqlListExclusive- if inclusive {+ if includeStartFile {sqlText = store.SqlListInclusive}- rows, err := store.getTxOrDB(ctx).QueryContext(ctx, sqlText, util.HashStringToLong(string(fullpath)), startFileName, string(fullpath), prefix+"%", limit)+ rows, err := store.getTxOrDB(ctx).QueryContext(ctx, sqlText, util.HashStringToLong(string(dirPath)), startFileName, string(dirPath), prefix+"%", limit+1)if err != nil {- return nil, fmt.Errorf("list %s : %v", fullpath, err)+ return nil, false, fmt.Errorf("list %s : %v", dirPath, err)}defer rows.Close()@@ -188,26 +188,31 @@ func (store *AbstractSqlStore) ListDirectoryPrefixedEntries(ctx context.Context,var name stringvar data []byteif err = rows.Scan(&name, &data); err != nil {- glog.V(0).Infof("scan %s : %v", fullpath, err)- return nil, fmt.Errorf("scan %s: %v", fullpath, err)+ glog.V(0).Infof("scan %s : %v", dirPath, err)+ return nil, false, fmt.Errorf("scan %s: %v", dirPath, err)}entry := &filer.Entry{- FullPath: util.NewFullPath(string(fullpath), name),+ FullPath: util.NewFullPath(string(dirPath), name),}if err = entry.DecodeAttributesAndChunks(util.MaybeDecompressData(data)); err != nil {glog.V(0).Infof("scan decode %s : %v", entry.FullPath, err)- return nil, fmt.Errorf("scan decode %s : %v", entry.FullPath, err)+ return nil, false, fmt.Errorf("scan decode %s : %v", entry.FullPath, err)}entries = append(entries, entry)}- return entries, nil+ hasMore = len(entries) == limit + 1+ if hasMore {+ entries = entries[:limit]+ }++ return entries, hasMore, nil}-func (store *AbstractSqlStore) ListDirectoryEntries(ctx context.Context, fullpath util.FullPath, startFileName string, inclusive bool, limit int) (entries []*filer.Entry, err error) {- return store.ListDirectoryPrefixedEntries(ctx, fullpath, startFileName, inclusive, limit, "")+func (store *AbstractSqlStore) ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int) (entries []*filer.Entry, hasMore bool, err error) {+ return store.ListDirectoryPrefixedEntries(ctx, dirPath, startFileName, includeStartFile, limit, "")}func (store *AbstractSqlStore) Shutdown() {