From b142f9f1d57cebd1445baed7ce7fc88bb0f450f0 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 18 Apr 2019 00:19:18 -0700 Subject: [PATCH] go fmt --- weed/server/filer_grpc_server_rename.go | 2 +- weed/server/volume_grpc_copy.go | 8 ++++---- weed/shell/command_fs_meta_load.go | 4 ++-- weed/shell/commands.go | 2 +- weed/storage/needle/compact_map.go | 12 ++++++------ weed/storage/needle_map.go | 6 +++--- weed/storage/needle_map_metric.go | 1 - weed/storage/types/needle_types.go | 12 ++++++------ weed/storage/volume.go | 10 +++++----- 9 files changed, 28 insertions(+), 29 deletions(-) diff --git a/weed/server/filer_grpc_server_rename.go b/weed/server/filer_grpc_server_rename.go index c0edd559b..bd9f8c0be 100644 --- a/weed/server/filer_grpc_server_rename.go +++ b/weed/server/filer_grpc_server_rename.go @@ -88,7 +88,7 @@ func (fs *FilerServer) moveFolderSubEntries(ctx context.Context, oldParent filer return nil } -func (fs *FilerServer) moveSelfEntry(ctx context.Context, oldParent filer2.FullPath, entry *filer2.Entry, newParent filer2.FullPath, newName string, events *MoveEvents) (error) { +func (fs *FilerServer) moveSelfEntry(ctx context.Context, oldParent filer2.FullPath, entry *filer2.Entry, newParent filer2.FullPath, newName string, events *MoveEvents) error { oldPath, newPath := oldParent.Child(entry.Name()), newParent.Child(newName) diff --git a/weed/server/volume_grpc_copy.go b/weed/server/volume_grpc_copy.go index c32755f2f..2bac7d2ee 100644 --- a/weed/server/volume_grpc_copy.go +++ b/weed/server/volume_grpc_copy.go @@ -83,7 +83,7 @@ func (vs *VolumeServer) VolumeCopy(ctx context.Context, req *volume_server_pb.Vo return nil, err } - if err = checkCopyFiles(volFileInfoResp, idxFileName, datFileName); err != nil { // added by panyc16 + if err = checkCopyFiles(volFileInfoResp, idxFileName, datFileName); err != nil { // added by panyc16 return nil, err } @@ -97,9 +97,9 @@ func (vs *VolumeServer) VolumeCopy(ctx context.Context, req *volume_server_pb.Vo } /** - only check the the differ of the file size - todo: maybe should check the received count and deleted count of the volume - */ +only check the the differ of the file size +todo: maybe should check the received count and deleted count of the volume +*/ func checkCopyFiles(originFileInf *volume_server_pb.ReadVolumeFileStatusResponse, idxFileName, datFileName string) error { stat, err := os.Stat(idxFileName) if err != nil { diff --git a/weed/shell/command_fs_meta_load.go b/weed/shell/command_fs_meta_load.go index 35fa632b0..0991c039c 100644 --- a/weed/shell/command_fs_meta_load.go +++ b/weed/shell/command_fs_meta_load.go @@ -56,7 +56,7 @@ func (c *commandFsMetaLoad) Do(args []string, commandEnv *commandEnv, writer io. for { if n, err := dst.Read(sizeBuf); n != 4 { - if err == io.EOF{ + if err == io.EOF { return nil } return err @@ -100,4 +100,4 @@ func (c *commandFsMetaLoad) Do(args []string, commandEnv *commandEnv, writer io. } return err -} \ No newline at end of file +} diff --git a/weed/shell/commands.go b/weed/shell/commands.go index 50b70498d..6fade6e9d 100644 --- a/weed/shell/commands.go +++ b/weed/shell/commands.go @@ -51,7 +51,7 @@ func (ce *commandEnv) parseUrl(input string) (filerServer string, filerPort int6 func (ce *commandEnv) isDirectory(ctx context.Context, filerServer string, filerPort int64, path string) bool { - return ce.checkDirectory(ctx,filerServer,filerPort,path) == nil + return ce.checkDirectory(ctx, filerServer, filerPort, path) == nil } diff --git a/weed/storage/needle/compact_map.go b/weed/storage/needle/compact_map.go index cb0bf2e51..a15035961 100644 --- a/weed/storage/needle/compact_map.go +++ b/weed/storage/needle/compact_map.go @@ -279,10 +279,10 @@ func toNeedleValue(snve SectionalNeedleValueExtra, snv SectionalNeedleValue, cs func (nv NeedleValue) toSectionalNeedleValue(cs *CompactSection) (SectionalNeedleValue, SectionalNeedleValueExtra) { return SectionalNeedleValue{ - SectionalNeedleId(nv.Key - cs.start), - nv.Offset.OffsetLower, - nv.Size, - }, SectionalNeedleValueExtra{ - nv.Offset.OffsetHigher, - } + SectionalNeedleId(nv.Key - cs.start), + nv.Offset.OffsetLower, + nv.Size, + }, SectionalNeedleValueExtra{ + nv.Offset.OffsetHigher, + } } diff --git a/weed/storage/needle_map.go b/weed/storage/needle_map.go index 92fc06aae..56dbd7c06 100644 --- a/weed/storage/needle_map.go +++ b/weed/storage/needle_map.go @@ -15,9 +15,9 @@ type NeedleMapType int const ( NeedleMapInMemory NeedleMapType = iota - NeedleMapLevelDb // small memory footprint, 4MB total, 1 write buffer, 3 block buffer - NeedleMapLevelDbMedium // medium memory footprint, 8MB total, 3 write buffer, 5 block buffer - NeedleMapLevelDbLarge // large memory footprint, 12MB total, 4write buffer, 8 block buffer + NeedleMapLevelDb // small memory footprint, 4MB total, 1 write buffer, 3 block buffer + NeedleMapLevelDbMedium // medium memory footprint, 8MB total, 3 write buffer, 5 block buffer + NeedleMapLevelDbLarge // large memory footprint, 12MB total, 4write buffer, 8 block buffer ) type NeedleMapper interface { diff --git a/weed/storage/needle_map_metric.go b/weed/storage/needle_map_metric.go index 0e2e16964..8cd16aedf 100644 --- a/weed/storage/needle_map_metric.go +++ b/weed/storage/needle_map_metric.go @@ -60,7 +60,6 @@ func (mm mapMetric) MaybeSetMaxFileKey(key NeedleId) { } } - func newNeedleMapMetricFromIndexFile(r *os.File) (mm *mapMetric, err error) { mm = &mapMetric{} var bf *bloom.BloomFilter diff --git a/weed/storage/types/needle_types.go b/weed/storage/types/needle_types.go index b591dd7c3..2815acaa2 100644 --- a/weed/storage/types/needle_types.go +++ b/weed/storage/types/needle_types.go @@ -22,12 +22,12 @@ type OffsetLower struct { type Cookie uint32 const ( - SizeSize = 4 // uint32 size - NeedleEntrySize = CookieSize + NeedleIdSize + SizeSize - TimestampSize = 8 // int64 size - NeedlePaddingSize = 8 - TombstoneFileSize = math.MaxUint32 - CookieSize = 4 + SizeSize = 4 // uint32 size + NeedleEntrySize = CookieSize + NeedleIdSize + SizeSize + TimestampSize = 8 // int64 size + NeedlePaddingSize = 8 + TombstoneFileSize = math.MaxUint32 + CookieSize = 4 ) func CookieToBytes(bytes []byte, cookie Cookie) { diff --git a/weed/storage/volume.go b/weed/storage/volume.go index 572040d61..54769eaca 100644 --- a/weed/storage/volume.go +++ b/weed/storage/volume.go @@ -79,22 +79,22 @@ func (v *Volume) Size() int64 { return 0 // -1 causes integer overflow and the volume to become unwritable. } -func (v *Volume)IndexFileSize() uint64 { +func (v *Volume) IndexFileSize() uint64 { return v.nm.IndexFileSize() } -func (v *Volume)DataFileSize() uint64 { +func (v *Volume) DataFileSize() uint64 { return uint64(v.Size()) } /** unix time in seconds - */ -func (v *Volume)LastModifiedTime() uint64 { +*/ +func (v *Volume) LastModifiedTime() uint64 { return v.lastModifiedTime } -func (v *Volume)FileCount() uint64 { +func (v *Volume) FileCount() uint64 { return uint64(v.nm.FileCount()) }