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
go fmt
Chris Lu0c8dea9de8df
diff --git a/weed/filer/filechunks_read.go b/weed/filer/filechunks_read.goindex 742f050be4..33ee6d1383 100644--- a/weed/filer/filechunks_read.go+++ b/weed/filer/filechunks_read.go@@ -40,7 +40,7 @@ func readResolvedChunks(chunks []*filer_pb.FileChunk) (visibles []VisibleIntervafor _, point := range points {if point.isStart {if len(queue) > 0 {- lastIndex := len(queue) -1+ lastIndex := len(queue) - 1lastPoint := queue[lastIndex]if point.x != prevX && lastPoint.ts < point.ts {visibles = addToVisibles(visibles, prevX, lastPoint, point)diff --git a/weed/filer/filechunks_read_test.go b/weed/filer/filechunks_read_test.goindex ff0cd9f4b3..e70c66e6f8 100644--- a/weed/filer/filechunks_read_test.go+++ b/weed/filer/filechunks_read_test.go@@ -52,7 +52,7 @@ func TestReadResolvedChunks(t *testing.T) {func TestRandomizedReadResolvedChunks(t *testing.T) {- var limit int64 = 1024*1024+ var limit int64 = 1024 * 1024array := make([]int64, limit)var chunks []*filer_pb.FileChunkfor ts := int64(0); ts < 1024; ts++ {@@ -75,7 +75,7 @@ func TestRandomizedReadResolvedChunks(t *testing.T) {visibles := readResolvedChunks(chunks)for _, visible := range visibles {- for i := visible.start; i<visible.stop;i++{+ for i := visible.start; i < visible.stop; i++ {if array[i] != visible.modifiedTime {t.Errorf("position %d expected ts %d actual ts %d", i, array[i], visible.modifiedTime)}@@ -101,12 +101,12 @@ func randomWrite(array []int64, start int64, size int64, ts int64) *filer_pb.Filfunc TestSequentialReadResolvedChunks(t *testing.T) {- var chunkSize int64 = 1024*1024*2+ var chunkSize int64 = 1024 * 1024 * 2var chunks []*filer_pb.FileChunkfor ts := int64(0); ts < 13; ts++ {chunks = append(chunks, &filer_pb.FileChunk{FileId: "",- Offset: chunkSize*ts,+ Offset: chunkSize * ts,Size: uint64(chunkSize),Mtime: 1,})diff --git a/weed/filer/filer_delete_entry.go b/weed/filer/filer_delete_entry.goindex 116f5cd2fd..cc33811aaa 100644--- a/weed/filer/filer_delete_entry.go+++ b/weed/filer/filer_delete_entry.go@@ -70,7 +70,7 @@ func (f *Filer) DeleteEntryMetaAndData(ctx context.Context, p util.FullPath, isRreturn nil}-func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry, isRecursive, ignoreRecursiveError, shouldDeleteChunks, isDeletingBucket, isFromOtherCluster bool, signatures []int32, onChunksFn OnChunksFunc, onHardLinkIdsFn OnHardLinkIdsFunc)(err error) {+func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry, isRecursive, ignoreRecursiveError, shouldDeleteChunks, isDeletingBucket, isFromOtherCluster bool, signatures []int32, onChunksFn OnChunksFunc, onHardLinkIdsFn OnHardLinkIdsFunc) (err error) {lastFileName := ""includeLastFile := falsediff --git a/weed/filer/redis2/universal_redis_store.go b/weed/filer/redis2/universal_redis_store.goindex f9798cf2f6..deccf8922d 100644--- a/weed/filer/redis2/universal_redis_store.go+++ b/weed/filer/redis2/universal_redis_store.go@@ -134,8 +134,8 @@ func (store *UniversalRedis2Store) DeleteFolderChildren(ctx context.Context, ful}members, err := store.Client.ZRangeByLex(ctx, genDirectoryListKey(string(fullpath)), &redis.ZRangeBy{- Min: "-",- Max: "+",+ Min: "-",+ Max: "+",}).Result()if err != nil {return fmt.Errorf("DeleteFolderChildren %s : %v", fullpath, err)diff --git a/weed/filesys/dir_rename.go b/weed/filesys/dir_rename.goindex d2288e3bd1..8a80559f67 100644--- a/weed/filesys/dir_rename.go+++ b/weed/filesys/dir_rename.go@@ -67,7 +67,6 @@ func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirectorreturn nil}-func (dir *Dir) handleRenameResponse(ctx context.Context, resp *filer_pb.StreamRenameEntryResponse) error {// comes from filer StreamRenameEntry, can only be create or delete entry@@ -119,7 +118,7 @@ func (dir *Dir) handleRenameResponse(ctx context.Context, resp *filer_pb.StreamR}dir.wfs.handlesLock.Unlock()- }else if resp.EventNotification.OldEntry != nil {+ } else if resp.EventNotification.OldEntry != nil {// without new entry, only old entry name exists. This is the second step to delete old entryif err := dir.wfs.metaCache.AtomicUpdateEntryFromFiler(ctx, util.NewFullPath(resp.Directory, resp.EventNotification.OldEntry.Name), nil); err != nil {return errdiff --git a/weed/server/filer_grpc_server_rename.go b/weed/server/filer_grpc_server_rename.goindex 278ecadbd8..a7f428848f 100644--- a/weed/server/filer_grpc_server_rename.go+++ b/weed/server/filer_grpc_server_rename.go@@ -161,7 +161,7 @@ func (fs *FilerServer) moveSelfEntry(ctx context.Context, stream filer_pb.Seaweeif err := stream.Send(&filer_pb.StreamRenameEntryResponse{Directory: string(newParent),EventNotification: &filer_pb.EventNotification{- OldEntry: &filer_pb.Entry{+ OldEntry: &filer_pb.Entry{Name: entry.Name(),},NewEntry: newEntry.ToProtoEntry(),diff --git a/weed/server/master_server_cluster.go b/weed/server/master_server_cluster.goindex 52e1526f97..19ecaff0a0 100644--- a/weed/server/master_server_cluster.go+++ b/weed/server/master_server_cluster.go@@ -56,7 +56,7 @@ func (cluster *Cluster) RemoveClusterNode(nodeType string, address pb.ServerAddr}}-func (cluster *Cluster) ListClusterNode(nodeType string) (nodes []*ClusterNode){+func (cluster *Cluster) ListClusterNode(nodeType string) (nodes []*ClusterNode) {switch nodeType {case "filer":cluster.filersLock.RLock()diff --git a/weed/server/volume_grpc_copy.go b/weed/server/volume_grpc_copy.goindex 28018f3443..9630b322e9 100644--- a/weed/server/volume_grpc_copy.go+++ b/weed/server/volume_grpc_copy.go@@ -80,7 +80,7 @@ func (vs *VolumeServer) VolumeCopy(req *volume_server_pb.VolumeCopyRequest, stre// println("source:", volFileInfoResp.String())copyResponse := &volume_server_pb.VolumeCopyResponse{}- reportInterval := int64(1024*1024*128)+ reportInterval := int64(1024 * 1024 * 128)nextReportTarget := reportIntervalvar modifiedTsNs int64var sendErr errordiff --git a/weed/server/volume_grpc_vacuum.go b/weed/server/volume_grpc_vacuum.goindex 57bf8d8671..0ab782b02e 100644--- a/weed/server/volume_grpc_vacuum.go+++ b/weed/server/volume_grpc_vacuum.go@@ -27,7 +27,7 @@ func (vs *VolumeServer) VacuumVolumeCheck(ctx context.Context, req *volume_servefunc (vs *VolumeServer) VacuumVolumeCompact(req *volume_server_pb.VacuumVolumeCompactRequest, stream volume_server_pb.VolumeServer_VacuumVolumeCompactServer) error {resp := &volume_server_pb.VacuumVolumeCompactResponse{}- reportInterval := int64(1024*1024*128)+ reportInterval := int64(1024 * 1024 * 128)nextReportTarget := reportIntervalvar sendErr errordiff --git a/weed/storage/backend/s3_backend/s3_upload.go b/weed/storage/backend/s3_backend/s3_upload.goindex bc1c82730d..cb5ce83e59 100644--- a/weed/storage/backend/s3_backend/s3_upload.go+++ b/weed/storage/backend/s3_backend/s3_upload.go@@ -49,10 +49,10 @@ func uploadToS3(sess s3iface.S3API, filename string, destBucket string, destKey// Upload the file to S3.var result *s3manager.UploadOutputresult, err = uploader.Upload(&s3manager.UploadInput{- Bucket: aws.String(destBucket),- Key: aws.String(destKey),- Body: fileReader,- StorageClass: aws.String("STANDARD_IA"),+ Bucket: aws.String(destBucket),+ Key: aws.String(destKey),+ Body: fileReader,+ StorageClass: aws.String("STANDARD_IA"),})//in case it fails to upload