From 1bf22c0b5b1ecd99cb1631800e5a6818e8d8d1b1 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 16 Dec 2020 09:14:05 -0800 Subject: [PATCH] go fmt --- weed/command/benchmark.go | 4 ++-- weed/command/filer_copy.go | 6 +++--- weed/command/filer_sync.go | 4 ++-- weed/command/mount.go | 2 +- weed/command/mount_std.go | 2 +- weed/command/upload.go | 2 +- weed/command/volume.go | 2 +- weed/filer/abstract_sql/abstract_sql_store_kv.go | 2 +- weed/filer/entry.go | 2 +- weed/filer/entry_codec.go | 2 +- weed/filer/filer_deletion.go | 1 - weed/filer/read_write.go | 12 ++++++------ weed/filesys/wfs.go | 4 ++-- weed/filesys/wfs_write.go | 2 +- weed/operation/assign_file_id.go | 10 +++++----- weed/operation/submit.go | 8 ++++---- weed/replication/sink/filersink/fetch_write.go | 2 +- weed/replication/sink/filersink/filer_sink.go | 2 +- weed/s3api/auth_credentials.go | 1 - weed/s3api/s3_constants/s3_actions.go | 1 - weed/server/common.go | 2 +- weed/server/filer_grpc_server.go | 2 +- weed/server/filer_server_handlers_write_autochunk.go | 2 +- weed/server/filer_server_handlers_write_cipher.go | 2 +- weed/server/master_grpc_server_volume.go | 2 +- weed/server/master_server_handlers_admin.go | 2 +- weed/server/webdav_server.go | 4 ++-- weed/shell/command_volume_server_evacuate.go | 2 +- weed/storage/disk_location.go | 8 ++++---- weed/storage/volume_info.go | 6 +++--- weed/storage/volume_loading.go | 8 ++++---- weed/storage/volume_type.go | 2 +- weed/topology/topology_test.go | 4 ++-- weed/topology/volume_growth.go | 2 +- weed/topology/volume_layout.go | 4 ++-- weed/util/config.go | 10 +++++----- 36 files changed, 65 insertions(+), 68 deletions(-) diff --git a/weed/command/benchmark.go b/weed/command/benchmark.go index 9a66083f1..351efd3dc 100644 --- a/weed/command/benchmark.go +++ b/weed/command/benchmark.go @@ -35,7 +35,7 @@ type BenchmarkOptions struct { sequentialRead *bool collection *string replication *string - diskType *string + diskType *string cpuprofile *string maxCpu *int grpcDialOption grpc.DialOption @@ -236,7 +236,7 @@ func writeFiles(idChan chan int, fileIdLineChan chan string, s *stat) { Count: 1, Collection: *b.collection, Replication: *b.replication, - DiskType: *b.diskType, + DiskType: *b.diskType, } if assignResult, err := operation.Assign(b.masterClient.GetMaster(), b.grpcDialOption, ar); err == nil { fp.Server, fp.Fid, fp.Collection = assignResult.Url, assignResult.Fid, *b.collection diff --git a/weed/command/filer_copy.go b/weed/command/filer_copy.go index 1b5f4c849..9b4c02904 100644 --- a/weed/command/filer_copy.go +++ b/weed/command/filer_copy.go @@ -37,7 +37,7 @@ type CopyOptions struct { replication *string collection *string ttl *string - diskType *string + diskType *string maxMB *int masterClient *wdclient.MasterClient concurrenctFiles *int @@ -313,7 +313,7 @@ func (worker *FileCopyWorker) uploadFileAsOne(task FileCopyTask, f *os.File) err Replication: *worker.options.replication, Collection: *worker.options.collection, TtlSec: worker.options.ttlSec, - DiskType: *worker.options.diskType, + DiskType: *worker.options.diskType, Path: task.destinationUrlPath, } @@ -408,7 +408,7 @@ func (worker *FileCopyWorker) uploadFileInChunks(task FileCopyTask, f *os.File, Replication: *worker.options.replication, Collection: *worker.options.collection, TtlSec: worker.options.ttlSec, - DiskType: *worker.options.diskType, + DiskType: *worker.options.diskType, Path: task.destinationUrlPath + fileName, } diff --git a/weed/command/filer_sync.go b/weed/command/filer_sync.go index 07a4f8ffb..050fef7d4 100644 --- a/weed/command/filer_sync.go +++ b/weed/command/filer_sync.go @@ -31,8 +31,8 @@ type SyncOptions struct { bCollection *string aTtlSec *int bTtlSec *int - aDiskType *string - bDiskType *string + aDiskType *string + bDiskType *string aDebug *bool bDebug *bool } diff --git a/weed/command/mount.go b/weed/command/mount.go index dc0bb5488..e380ff57c 100644 --- a/weed/command/mount.go +++ b/weed/command/mount.go @@ -12,7 +12,7 @@ type MountOptions struct { dirAutoCreate *bool collection *string replication *string - diskType *string + diskType *string ttlSec *int chunkSizeLimitMB *int concurrentWriters *int diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go index e3bfba9fb..0798d18af 100644 --- a/weed/command/mount_std.go +++ b/weed/command/mount_std.go @@ -181,7 +181,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool { Collection: *option.collection, Replication: *option.replication, TtlSec: int32(*option.ttlSec), - DiskType: diskType, + DiskType: diskType, ChunkSizeLimit: int64(chunkSizeLimitMB) * 1024 * 1024, ConcurrentWriters: *option.concurrentWriters, CacheDir: *option.cacheDir, diff --git a/weed/command/upload.go b/weed/command/upload.go index 8ffc0c2b8..592f71610 100644 --- a/weed/command/upload.go +++ b/weed/command/upload.go @@ -23,7 +23,7 @@ type UploadOptions struct { collection *string dataCenter *string ttl *string - diskType *string + diskType *string maxMB *int usePublicUrl *bool } diff --git a/weed/command/volume.go b/weed/command/volume.go index b90dc5967..fa7dcaa06 100644 --- a/weed/command/volume.go +++ b/weed/command/volume.go @@ -49,7 +49,7 @@ type VolumeServerOptions struct { rack *string whiteList []string indexType *string - diskType *string + diskType *string fixJpgOrientation *bool readRedirect *bool cpuProfile *string diff --git a/weed/filer/abstract_sql/abstract_sql_store_kv.go b/weed/filer/abstract_sql/abstract_sql_store_kv.go index 81d105134..792a45ff4 100644 --- a/weed/filer/abstract_sql/abstract_sql_store_kv.go +++ b/weed/filer/abstract_sql/abstract_sql_store_kv.go @@ -34,7 +34,7 @@ func (store *AbstractSqlStore) KvPut(ctx context.Context, key []byte, value []by } _, err = res.RowsAffected() - if err != nil { + if err != nil { return fmt.Errorf("kv upsert no rows affected: %s", err) } return nil diff --git a/weed/filer/entry.go b/weed/filer/entry.go index 987ea8cca..b7c8370e6 100644 --- a/weed/filer/entry.go +++ b/weed/filer/entry.go @@ -18,7 +18,7 @@ type Attr struct { Replication string // replication Collection string // collection name TtlSec int32 // ttl in seconds - DiskType string + DiskType string UserName string GroupNames []string SymlinkTarget string diff --git a/weed/filer/entry_codec.go b/weed/filer/entry_codec.go index cc7353974..4c613f068 100644 --- a/weed/filer/entry_codec.go +++ b/weed/filer/entry_codec.go @@ -56,7 +56,7 @@ func EntryAttributeToPb(entry *Entry) *filer_pb.FuseAttributes { Collection: entry.Attr.Collection, Replication: entry.Attr.Replication, TtlSec: entry.Attr.TtlSec, - DiskType: entry.Attr.DiskType, + DiskType: entry.Attr.DiskType, UserName: entry.Attr.UserName, GroupName: entry.Attr.GroupNames, SymlinkTarget: entry.Attr.SymlinkTarget, diff --git a/weed/filer/filer_deletion.go b/weed/filer/filer_deletion.go index 09af80b42..9eee38277 100644 --- a/weed/filer/filer_deletion.go +++ b/weed/filer/filer_deletion.go @@ -151,4 +151,3 @@ func (f *Filer) deleteChunksIfNotNew(oldEntry, newEntry *Entry) { } f.DeleteChunks(toDelete) } - diff --git a/weed/filer/read_write.go b/weed/filer/read_write.go index 548473116..1f78057ef 100644 --- a/weed/filer/read_write.go +++ b/weed/filer/read_write.go @@ -82,8 +82,8 @@ func SaveInsideFiler(client filer_pb.SeaweedFilerClient, dir, name string, conte if err == filer_pb.ErrNotFound { err = filer_pb.CreateEntry(client, &filer_pb.CreateEntryRequest{ - Directory: dir, - Entry: &filer_pb.Entry{ + Directory: dir, + Entry: &filer_pb.Entry{ Name: name, IsDirectory: false, Attributes: &filer_pb.FuseAttributes{ @@ -92,7 +92,7 @@ func SaveInsideFiler(client filer_pb.SeaweedFilerClient, dir, name string, conte FileMode: uint32(0644), Collection: "", Replication: "", - FileSize: uint64(len(content)), + FileSize: uint64(len(content)), }, Content: content, }, @@ -103,10 +103,10 @@ func SaveInsideFiler(client filer_pb.SeaweedFilerClient, dir, name string, conte entry.Attributes.Mtime = time.Now().Unix() entry.Attributes.FileSize = uint64(len(content)) err = filer_pb.UpdateEntry(client, &filer_pb.UpdateEntryRequest{ - Directory: dir, - Entry: entry, + Directory: dir, + Entry: entry, }) } return err -} \ No newline at end of file +} diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go index 48893f80a..d8f865be7 100644 --- a/weed/filesys/wfs.go +++ b/weed/filesys/wfs.go @@ -31,7 +31,7 @@ type Option struct { Collection string Replication string TtlSec int32 - DiskType storage.DiskType + DiskType storage.DiskType ChunkSizeLimit int64 ConcurrentWriters int CacheDir string @@ -178,7 +178,7 @@ func (wfs *WFS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse. Collection: wfs.option.Collection, Replication: wfs.option.Replication, Ttl: fmt.Sprintf("%ds", wfs.option.TtlSec), - DiskType: string(wfs.option.DiskType), + DiskType: string(wfs.option.DiskType), } glog.V(4).Infof("reading filer stats: %+v", request) diff --git a/weed/filesys/wfs_write.go b/weed/filesys/wfs_write.go index 903fed810..92ff5c8da 100644 --- a/weed/filesys/wfs_write.go +++ b/weed/filesys/wfs_write.go @@ -26,7 +26,7 @@ func (wfs *WFS) saveDataAsChunk(fullPath util.FullPath) filer.SaveDataAsChunkFun Replication: wfs.option.Replication, Collection: wfs.option.Collection, TtlSec: wfs.option.TtlSec, - DiskType: string(wfs.option.DiskType), + DiskType: string(wfs.option.DiskType), DataCenter: wfs.option.DataCenter, Path: string(fullPath), } diff --git a/weed/operation/assign_file_id.go b/weed/operation/assign_file_id.go index bb0b8e6df..b2fcf0c96 100644 --- a/weed/operation/assign_file_id.go +++ b/weed/operation/assign_file_id.go @@ -18,7 +18,7 @@ type VolumeAssignRequest struct { Replication string Collection string Ttl string - DiskType string + DiskType string DataCenter string Rack string DataNode string @@ -55,7 +55,7 @@ func Assign(server string, grpcDialOption grpc.DialOption, primaryRequest *Volum Replication: request.Replication, Collection: request.Collection, Ttl: request.Ttl, - DiskType: request.DiskType, + DiskType: request.DiskType, DataCenter: request.DataCenter, Rack: request.Rack, DataNode: request.DataNode, @@ -107,7 +107,7 @@ func LookupJwt(master string, fileId string) security.EncodedJwt { type StorageOption struct { Replication string - DiskType string + DiskType string Collection string DataCenter string Rack string @@ -126,7 +126,7 @@ func (so *StorageOption) ToAssignRequests(count int) (ar *VolumeAssignRequest, a Replication: so.Replication, Collection: so.Collection, Ttl: so.TtlString(), - DiskType: so.DiskType, + DiskType: so.DiskType, DataCenter: so.DataCenter, Rack: so.Rack, WritableVolumeCount: so.VolumeGrowthCount, @@ -137,7 +137,7 @@ func (so *StorageOption) ToAssignRequests(count int) (ar *VolumeAssignRequest, a Replication: so.Replication, Collection: so.Collection, Ttl: so.TtlString(), - DiskType: so.DiskType, + DiskType: so.DiskType, DataCenter: "", Rack: "", WritableVolumeCount: so.VolumeGrowthCount, diff --git a/weed/operation/submit.go b/weed/operation/submit.go index bcdf9ddce..907825311 100644 --- a/weed/operation/submit.go +++ b/weed/operation/submit.go @@ -25,7 +25,7 @@ type FilePart struct { Collection string DataCenter string Ttl string - DiskType string + DiskType string Server string //this comes from assign result Fid string //this comes from assign result, but customizable Fsync bool @@ -50,7 +50,7 @@ func SubmitFiles(master string, grpcDialOption grpc.DialOption, files []FilePart Collection: collection, DataCenter: dataCenter, Ttl: ttl, - DiskType: diskType, + DiskType: diskType, } ret, err := Assign(master, grpcDialOption, ar) if err != nil { @@ -146,7 +146,7 @@ func (fi FilePart) Upload(maxMB int, master string, usePublicUrl bool, jwt secur Replication: fi.Replication, Collection: fi.Collection, Ttl: fi.Ttl, - DiskType: fi.DiskType, + DiskType: fi.DiskType, } ret, err = Assign(master, grpcDialOption, ar) if err != nil { @@ -160,7 +160,7 @@ func (fi FilePart) Upload(maxMB int, master string, usePublicUrl bool, jwt secur Replication: fi.Replication, Collection: fi.Collection, Ttl: fi.Ttl, - DiskType: fi.DiskType, + DiskType: fi.DiskType, } ret, err = Assign(master, grpcDialOption, ar) if err != nil { diff --git a/weed/replication/sink/filersink/fetch_write.go b/weed/replication/sink/filersink/fetch_write.go index bdd2ba585..6b51a7966 100644 --- a/weed/replication/sink/filersink/fetch_write.go +++ b/weed/replication/sink/filersink/fetch_write.go @@ -77,7 +77,7 @@ func (fs *FilerSink) fetchAndWrite(sourceChunk *filer_pb.FileChunk, path string) Collection: fs.collection, TtlSec: fs.ttlSec, DataCenter: fs.dataCenter, - DiskType: fs.diskType, + DiskType: fs.diskType, Path: path, } diff --git a/weed/replication/sink/filersink/filer_sink.go b/weed/replication/sink/filersink/filer_sink.go index 579883d62..a69c9dc8e 100644 --- a/weed/replication/sink/filersink/filer_sink.go +++ b/weed/replication/sink/filersink/filer_sink.go @@ -23,7 +23,7 @@ type FilerSink struct { replication string collection string ttlSec int32 - diskType string + diskType string dataCenter string grpcDialOption grpc.DialOption } diff --git a/weed/s3api/auth_credentials.go b/weed/s3api/auth_credentials.go index da0a38dbf..93544b75e 100644 --- a/weed/s3api/auth_credentials.go +++ b/weed/s3api/auth_credentials.go @@ -79,7 +79,6 @@ func (iam *IdentityAccessManagement) loadS3ApiConfigurationFromBytes(content []b return nil } - func (iam *IdentityAccessManagement) loadS3ApiConfiguration(config *iam_pb.S3ApiConfiguration) error { var identities []*Identity for _, ident := range config.Identities { diff --git a/weed/s3api/s3_constants/s3_actions.go b/weed/s3api/s3_constants/s3_actions.go index f6056ef78..4e484ac98 100644 --- a/weed/s3api/s3_constants/s3_actions.go +++ b/weed/s3api/s3_constants/s3_actions.go @@ -7,4 +7,3 @@ const ( ACTION_TAGGING = "Tagging" ACTION_LIST = "List" ) - diff --git a/weed/server/common.go b/weed/server/common.go index 545703095..0ce846ed7 100644 --- a/weed/server/common.go +++ b/weed/server/common.go @@ -131,7 +131,7 @@ func submitForClientHandler(w http.ResponseWriter, r *http.Request, masterUrl st Replication: r.FormValue("replication"), Collection: r.FormValue("collection"), Ttl: r.FormValue("ttl"), - DiskType: r.FormValue("disk"), + DiskType: r.FormValue("disk"), } assignResult, ae := operation.Assign(masterUrl, grpcDialOption, ar) if ae != nil { diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.go index e8a57261d..7f3012e96 100644 --- a/weed/server/filer_grpc_server.go +++ b/weed/server/filer_grpc_server.go @@ -405,7 +405,7 @@ func (fs *FilerServer) Statistics(ctx context.Context, req *filer_pb.StatisticsR Replication: req.Replication, Collection: req.Collection, Ttl: req.Ttl, - DiskType: req.DiskType, + DiskType: req.DiskType, }) if grpcErr != nil { return grpcErr diff --git a/weed/server/filer_server_handlers_write_autochunk.go b/weed/server/filer_server_handlers_write_autochunk.go index 0cfbeba47..963f1cd11 100644 --- a/weed/server/filer_server_handlers_write_autochunk.go +++ b/weed/server/filer_server_handlers_write_autochunk.go @@ -163,7 +163,7 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa Replication: so.Replication, Collection: so.Collection, TtlSec: so.TtlSeconds, - DiskType: so.DiskType, + DiskType: so.DiskType, Mime: contentType, Md5: md5bytes, FileSize: uint64(chunkOffset), diff --git a/weed/server/filer_server_handlers_write_cipher.go b/weed/server/filer_server_handlers_write_cipher.go index f9310bdd2..8334d1618 100644 --- a/weed/server/filer_server_handlers_write_cipher.go +++ b/weed/server/filer_server_handlers_write_cipher.go @@ -68,7 +68,7 @@ func (fs *FilerServer) encrypt(ctx context.Context, w http.ResponseWriter, r *ht Replication: so.Replication, Collection: so.Collection, TtlSec: so.TtlSeconds, - DiskType: so.DiskType, + DiskType: so.DiskType, Mime: pu.MimeType, Md5: util.Base64Md5ToBytes(pu.ContentMd5), }, diff --git a/weed/server/master_grpc_server_volume.go b/weed/server/master_grpc_server_volume.go index debb21b94..f1d65896a 100644 --- a/weed/server/master_grpc_server_volume.go +++ b/weed/server/master_grpc_server_volume.go @@ -70,7 +70,7 @@ func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest Collection: req.Collection, ReplicaPlacement: replicaPlacement, Ttl: ttl, - DiskType: diskType, + DiskType: diskType, Prealloacte: ms.preallocateSize, DataCenter: req.DataCenter, Rack: req.Rack, diff --git a/weed/server/master_server_handlers_admin.go b/weed/server/master_server_handlers_admin.go index 1f340cb11..5b0fe26de 100644 --- a/weed/server/master_server_handlers_admin.go +++ b/weed/server/master_server_handlers_admin.go @@ -174,7 +174,7 @@ func (ms *MasterServer) getVolumeGrowOption(r *http.Request) (*topology.VolumeGr Collection: r.FormValue("collection"), ReplicaPlacement: replicaPlacement, Ttl: ttl, - DiskType: diskType, + DiskType: diskType, Prealloacte: preallocate, DataCenter: r.FormValue("dataCenter"), Rack: r.FormValue("rack"), diff --git a/weed/server/webdav_server.go b/weed/server/webdav_server.go index 04b7e0519..6694086af 100644 --- a/weed/server/webdav_server.go +++ b/weed/server/webdav_server.go @@ -33,7 +33,7 @@ type WebDavOption struct { BucketsPath string GrpcDialOption grpc.DialOption Collection string - DiskType string + DiskType string Uid uint32 Gid uint32 Cipher bool @@ -379,7 +379,7 @@ func (f *WebDavFile) saveDataAsChunk(reader io.Reader, name string, offset int64 Count: 1, Replication: "", Collection: f.fs.option.Collection, - DiskType: f.fs.option.DiskType, + DiskType: f.fs.option.DiskType, Path: name, } diff --git a/weed/shell/command_volume_server_evacuate.go b/weed/shell/command_volume_server_evacuate.go index 59303ec55..1539ccb19 100644 --- a/weed/shell/command_volume_server_evacuate.go +++ b/weed/shell/command_volume_server_evacuate.go @@ -175,7 +175,7 @@ func moveAwayOneEcVolume(commandEnv *CommandEnv, ecShardInfo *master_pb.VolumeEc func moveAwayOneNormalVolume(commandEnv *CommandEnv, volumeReplicas map[uint32][]*VolumeReplica, vol *master_pb.VolumeInformationMessage, thisNode *Node, otherNodes []*Node, applyChange bool) (hasMoved bool, err error) { sort.Slice(otherNodes, func(i, j int) bool { - return otherNodes[i].localVolumeRatio(capacityByMaxVolumeCount) + otherNodes[i].localVolumeRatio(capacityByMaxSsdVolumeCount) < otherNodes[j].localVolumeRatio(capacityByMaxVolumeCount) + otherNodes[j].localVolumeRatio(capacityByMaxSsdVolumeCount) + return otherNodes[i].localVolumeRatio(capacityByMaxVolumeCount)+otherNodes[i].localVolumeRatio(capacityByMaxSsdVolumeCount) < otherNodes[j].localVolumeRatio(capacityByMaxVolumeCount)+otherNodes[j].localVolumeRatio(capacityByMaxSsdVolumeCount) }) for i := 0; i < len(otherNodes); i++ { diff --git a/weed/storage/disk_location.go b/weed/storage/disk_location.go index c6619b260..271a36ef7 100644 --- a/weed/storage/disk_location.go +++ b/weed/storage/disk_location.go @@ -19,7 +19,7 @@ import ( type DiskLocation struct { Directory string IdxDirectory string - DiskType DiskType + DiskType DiskType MaxVolumeCount int OriginalMaxVolumeCount int MinFreeSpacePercent float32 @@ -43,7 +43,7 @@ func NewDiskLocation(dir string, maxVolumeCount int, minFreeSpacePercent float32 location := &DiskLocation{ Directory: dir, IdxDirectory: idxDir, - DiskType: diskType, + DiskType: diskType, MaxVolumeCount: maxVolumeCount, OriginalMaxVolumeCount: maxVolumeCount, MinFreeSpacePercent: minFreeSpacePercent, @@ -117,7 +117,7 @@ func (l *DiskLocation) loadExistingVolume(fileInfo os.FileInfo, needleMapKind Ne glog.V(0).Infof("new volume %s error %s", volumeName, e) return false } - + l.SetVolume(vid, v) size, _, _ := v.FileStat() @@ -362,4 +362,4 @@ func (l *DiskLocation) GetDiskType() string { return "SSD" } return "HDD" -} \ No newline at end of file +} diff --git a/weed/storage/volume_info.go b/weed/storage/volume_info.go index e9ecb500a..9c64c9682 100644 --- a/weed/storage/volume_info.go +++ b/weed/storage/volume_info.go @@ -14,7 +14,7 @@ type VolumeInfo struct { Size uint64 ReplicaPlacement *super_block.ReplicaPlacement Ttl *needle.TTL - DiskType string + DiskType string Collection string Version needle.Version FileCount int @@ -41,7 +41,7 @@ func NewVolumeInfo(m *master_pb.VolumeInformationMessage) (vi VolumeInfo, err er ModifiedAtSecond: m.ModifiedAtSecond, RemoteStorageName: m.RemoteStorageName, RemoteStorageKey: m.RemoteStorageKey, - DiskType: m.DiskType, + DiskType: m.DiskType, } rp, e := super_block.NewReplicaPlacementFromByte(byte(m.ReplicaPlacement)) if e != nil { @@ -93,7 +93,7 @@ func (vi VolumeInfo) ToVolumeInformationMessage() *master_pb.VolumeInformationMe ModifiedAtSecond: vi.ModifiedAtSecond, RemoteStorageName: vi.RemoteStorageName, RemoteStorageKey: vi.RemoteStorageKey, - DiskType: vi.DiskType, + DiskType: vi.DiskType, } } diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.go index 34eee876d..a6efc630d 100644 --- a/weed/storage/volume_loading.go +++ b/weed/storage/volume_loading.go @@ -92,7 +92,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind if err == nil && alsoLoadIndex { // adjust for existing volumes with .idx together with .dat files if v.dirIdx != v.dir { - if util.FileExists(v.DataFileName()+".idx") { + if util.FileExists(v.DataFileName() + ".idx") { v.dirIdx = v.dir } } @@ -100,12 +100,12 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind if v.noWriteOrDelete { glog.V(0).Infoln("open to read file", v.FileName(".idx")) if indexFile, err = os.OpenFile(v.FileName(".idx"), os.O_RDONLY, 0644); err != nil { - return fmt.Errorf("cannot read Volume Index %s: %v", v.FileName(".idx"), err) + return fmt.Errorf("cannot read Volume Index %s: %v", v.FileName(".idx"), err) } } else { glog.V(1).Infoln("open to write file", v.FileName(".idx")) if indexFile, err = os.OpenFile(v.FileName(".idx"), os.O_RDWR|os.O_CREATE, 0644); err != nil { - return fmt.Errorf("cannot write Volume Index %s: %v", v.FileName(".idx"), err) + return fmt.Errorf("cannot write Volume Index %s: %v", v.FileName(".idx"), err) } } if v.lastAppendAtNs, err = CheckAndFixVolumeDataIntegrity(v, indexFile); err != nil { @@ -115,7 +115,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind if v.noWriteOrDelete || v.noWriteCanDelete { if v.nm, err = NewSortedFileNeedleMap(v.IndexFileName(), indexFile); err != nil { - glog.V(0).Infof("loading sorted db %s error: %v", v.FileName(".sdx"), err) + glog.V(0).Infof("loading sorted db %s error: %v", v.FileName(".sdx"), err) } } else { switch needleMapKind { diff --git a/weed/storage/volume_type.go b/weed/storage/volume_type.go index 05cd6b2c3..3e8d5ffb5 100644 --- a/weed/storage/volume_type.go +++ b/weed/storage/volume_type.go @@ -6,7 +6,7 @@ type DiskType string const ( HardDriveType DiskType = "" - SsdType = "ssd" + SsdType = "ssd" ) func ToDiskType(vt string) (diskType DiskType, err error) { diff --git a/weed/topology/topology_test.go b/weed/topology/topology_test.go index 92dcb9a22..b7088947c 100644 --- a/weed/topology/topology_test.go +++ b/weed/topology/topology_test.go @@ -60,7 +60,7 @@ func TestHandlingVolumeServerHeartbeat(t *testing.T) { ReplicaPlacement: uint32(0), Version: uint32(needle.CurrentVersion), Ttl: 0, - DiskType: "ssd", + DiskType: "ssd", } volumeMessages = append(volumeMessages, volumeMessage) } @@ -168,7 +168,7 @@ func TestAddRemoveVolume(t *testing.T) { Id: needle.VolumeId(1), Size: 100, Collection: "xcollection", - DiskType: "ssd", + DiskType: "ssd", FileCount: 123, DeleteCount: 23, DeletedByteCount: 45, diff --git a/weed/topology/volume_growth.go b/weed/topology/volume_growth.go index b2f1fe3d5..260013c38 100644 --- a/weed/topology/volume_growth.go +++ b/weed/topology/volume_growth.go @@ -27,7 +27,7 @@ type VolumeGrowOption struct { Collection string ReplicaPlacement *super_block.ReplicaPlacement Ttl *needle.TTL - DiskType storage.DiskType + DiskType storage.DiskType Prealloacte int64 DataCenter string Rack string diff --git a/weed/topology/volume_layout.go b/weed/topology/volume_layout.go index ba30eca49..3b1feefa4 100644 --- a/weed/topology/volume_layout.go +++ b/weed/topology/volume_layout.go @@ -103,7 +103,7 @@ func (v *volumesBinaryState) copyState(list *VolumeLocationList) copyState { type VolumeLayout struct { rp *super_block.ReplicaPlacement ttl *needle.TTL - diskType storage.DiskType + diskType storage.DiskType vid2location map[needle.VolumeId]*VolumeLocationList writables []needle.VolumeId // transient array of writable volume id readonlyVolumes *volumesBinaryState // readonly volumes @@ -123,7 +123,7 @@ func NewVolumeLayout(rp *super_block.ReplicaPlacement, ttl *needle.TTL, diskType return &VolumeLayout{ rp: rp, ttl: ttl, - diskType: diskType, + diskType: diskType, vid2location: make(map[needle.VolumeId]*VolumeLocationList), writables: *new([]needle.VolumeId), readonlyVolumes: NewVolumesBinaryState(readOnlyState, rp, ExistCopies()), diff --git a/weed/util/config.go b/weed/util/config.go index 47f433028..94e621e34 100644 --- a/weed/util/config.go +++ b/weed/util/config.go @@ -19,11 +19,11 @@ type Configuration interface { func LoadConfiguration(configFileName string, required bool) (loaded bool) { // find a filer store - viper.SetConfigName(configFileName) // name of config file (without extension) - viper.AddConfigPath(".") // optionally look for config in the working directory - viper.AddConfigPath("$HOME/.seaweedfs") // call multiple times to add many search paths - viper.AddConfigPath("/usr/local/etc/seaweedfs/") // search path for bsd-style config directory in - viper.AddConfigPath("/etc/seaweedfs/") // path to look for the config file in + viper.SetConfigName(configFileName) // name of config file (without extension) + viper.AddConfigPath(".") // optionally look for config in the working directory + viper.AddConfigPath("$HOME/.seaweedfs") // call multiple times to add many search paths + viper.AddConfigPath("/usr/local/etc/seaweedfs/") // search path for bsd-style config directory in + viper.AddConfigPath("/etc/seaweedfs/") // path to look for the config file in glog.V(1).Infof("Reading %s.toml from %s", configFileName, viper.ConfigFileUsed())