Browse Source

go fmt

pull/2348/head
Chris Lu 3 years ago
parent
commit
2789d10342
  1. 20
      weed/command/webdav.go
  2. 2
      weed/ftpd/ftp_server.go
  3. 10
      weed/iamapi/iamapi_server.go
  4. 2
      weed/operation/lookup.go
  5. 2
      weed/pb/grpc_client_server.go
  6. 2
      weed/remote_storage/s3/s3_storage_client.go
  7. 2
      weed/server/filer_grpc_server_remote.go
  8. 2
      weed/server/filer_server_handlers_read.go
  9. 2
      weed/server/master_grpc_server.go
  10. 10
      weed/server/master_grpc_server_volume.go
  11. 2
      weed/server/volume_grpc_remote.go
  12. 24
      weed/server/webdav_server.go
  13. 2
      weed/shell/command_remote_cache.go
  14. 1
      weed/shell/command_remote_unmount.go
  15. 4
      weed/topology/topology_test.go
  16. 6
      weed/util/network.go

20
weed/command/webdav.go

@ -103,16 +103,16 @@ func (wo *WebDavOption) startWebDav() bool {
}
ws, webdavServer_err := weed_server.NewWebDavServer(&weed_server.WebDavOption{
Filer: filerAddress,
GrpcDialOption: grpcDialOption,
Collection: *wo.collection,
Replication: *wo.replication,
DiskType: *wo.disk,
Uid: uid,
Gid: gid,
Cipher: cipher,
CacheDir: util.ResolvePath(*wo.cacheDir),
CacheSizeMB: *wo.cacheSizeMB,
Filer: filerAddress,
GrpcDialOption: grpcDialOption,
Collection: *wo.collection,
Replication: *wo.replication,
DiskType: *wo.disk,
Uid: uid,
Gid: gid,
Cipher: cipher,
CacheDir: util.ResolvePath(*wo.cacheDir),
CacheSizeMB: *wo.cacheSizeMB,
})
if webdavServer_err != nil {
glog.Fatalf("WebDav Server startup error: %v", webdavServer_err)

2
weed/ftpd/ftp_server.go

@ -3,8 +3,8 @@ package ftpd
import (
"crypto/tls"
"errors"
"net"
"github.com/chrislusf/seaweedfs/weed/util"
"net"
ftpserver "github.com/fclairamb/ftpserverlib"
"google.golang.org/grpc"

10
weed/iamapi/iamapi_server.go

@ -33,10 +33,10 @@ type IamS3ApiConfigure struct {
}
type IamServerOption struct {
Masters []pb.ServerAddress
Filer pb.ServerAddress
Port int
GrpcDialOption grpc.DialOption
Masters []pb.ServerAddress
Filer pb.ServerAddress
Port int
GrpcDialOption grpc.DialOption
}
type IamApiServer struct {
@ -49,7 +49,7 @@ var s3ApiConfigure IamS3ApiConfig
func NewIamApiServer(router *mux.Router, option *IamServerOption) (iamApiServer *IamApiServer, err error) {
s3ApiConfigure = IamS3ApiConfigure{
option: option,
masterClient: wdclient.NewMasterClient(option.GrpcDialOption, pb.AdminShellClient, "", "",option.Masters),
masterClient: wdclient.NewMasterClient(option.GrpcDialOption, pb.AdminShellClient, "", "", option.Masters),
}
s3Option := s3api.S3ApiServerOption{Filer: option.Filer}
iamApiServer = &IamApiServer{

2
weed/operation/lookup.go

@ -96,7 +96,7 @@ func LookupVolumeIds(masterFn GetMasterFn, grpcDialOption grpc.DialOption, vids
locations = append(locations, Location{
Url: loc.Url,
PublicUrl: loc.PublicUrl,
GrpcPort: int(loc.GrpcPort),
GrpcPort: int(loc.GrpcPort),
})
}
if vidLocations.Error != "" {

2
weed/pb/grpc_client_server.go

@ -244,4 +244,4 @@ func WithOneOfGrpcFilerClients(filerAddresses []ServerAddress, grpcDialOption gr
}
return err
}
}

2
weed/remote_storage/s3/s3_storage_client.go

@ -269,7 +269,7 @@ func (s *s3RemoteStorageClient) CreateBucket(name string) (err error) {
func (s *s3RemoteStorageClient) DeleteBucket(name string) (err error) {
_, err = s.conn.DeleteBucket(&s3.DeleteBucketInput{
Bucket: aws.String(name),
Bucket: aws.String(name),
})
if err != nil {
return fmt.Errorf("delete bucket %s: %v", name, err)

2
weed/server/filer_grpc_server_remote.go

@ -116,7 +116,7 @@ func (fs *FilerServer) DownloadToLocal(ctx context.Context, req *filer_pb.Downlo
replicas = append(replicas, &volume_server_pb.FetchAndWriteNeedleRequest_Replica{
Url: r.Url,
PublicUrl: r.PublicUrl,
GrpcPort: int32(r.GrpcPort),
GrpcPort: int32(r.GrpcPort),
})
}

2
weed/server/filer_server_handlers_read.go

@ -64,7 +64,7 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
// set etag
etag := filer.ETagEntry(entry)
if ifm := r.Header.Get("If-Match"); ifm != "" && (ifm != "\""+etag+"\"" && ifm != etag){
if ifm := r.Header.Get("If-Match"); ifm != "" && (ifm != "\""+etag+"\"" && ifm != etag) {
w.WriteHeader(http.StatusPreconditionFailed)
return
}

2
weed/server/master_grpc_server.go

@ -24,7 +24,7 @@ func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServ
defer func() {
if dn != nil {
dn.Counter--
if dn.Counter > 0 {
if dn.Counter > 0 {
glog.V(0).Infof("disconnect phantom volume server %s:%d remaining %d", dn.Ip, dn.Port, dn.Counter)
return
}

10
weed/server/master_grpc_server_volume.go

@ -155,19 +155,19 @@ func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest
replicas = append(replicas, &master_pb.Location{
Url: r.Url(),
PublicUrl: r.PublicUrl,
GrpcPort: uint32(r.GrpcPort),
GrpcPort: uint32(r.GrpcPort),
})
}
return &master_pb.AssignResponse{
Fid: fid,
Fid: fid,
Location: &master_pb.Location{
Url: dn.Url(),
PublicUrl: dn.PublicUrl,
GrpcPort: uint32(dn.GrpcPort),
},
Count: count,
Auth: string(security.GenJwt(ms.guard.SigningKey, ms.guard.ExpiresAfterSec, fid)),
Replicas: replicas,
Count: count,
Auth: string(security.GenJwt(ms.guard.SigningKey, ms.guard.ExpiresAfterSec, fid)),
Replicas: replicas,
}, nil
}
//glog.V(4).Infoln("waiting for volume growing...")

2
weed/server/volume_grpc_remote.go

@ -53,7 +53,7 @@ func (vs *VolumeServer) FetchAndWriteNeedle(ctx context.Context, req *volume_ser
}
}
}()
if len(req.Replicas)>0{
if len(req.Replicas) > 0 {
fileId := needle.NewFileId(v.Id, req.NeedleId, req.Cookie)
for _, replica := range req.Replicas {
wg.Add(1)

24
weed/server/webdav_server.go

@ -27,18 +27,18 @@ import (
)
type WebDavOption struct {
Filer pb.ServerAddress
DomainName string
BucketsPath string
GrpcDialOption grpc.DialOption
Collection string
Replication string
DiskType string
Uid uint32
Gid uint32
Cipher bool
CacheDir string
CacheSizeMB int64
Filer pb.ServerAddress
DomainName string
BucketsPath string
GrpcDialOption grpc.DialOption
Collection string
Replication string
DiskType string
Uid uint32
Gid uint32
Cipher bool
CacheDir string
CacheSizeMB int64
}
type WebDavServer struct {

2
weed/shell/command_remote_cache.go

@ -79,7 +79,7 @@ func (c *commandRemoteCache) Do(args []string, commandEnv *CommandEnv, writer io
return nil
}
func (c *commandRemoteCache) doCacheOneDirectory(commandEnv *CommandEnv, writer io.Writer, dir string, fileFiler *FileFilter, concurrency int) (error) {
func (c *commandRemoteCache) doCacheOneDirectory(commandEnv *CommandEnv, writer io.Writer, dir string, fileFiler *FileFilter, concurrency int) error {
mappings, localMountedDir, remoteStorageMountedLocation, remoteStorageConf, detectErr := detectMountInfo(commandEnv, writer, dir)
if detectErr != nil {
jsonPrintln(writer, mappings)

1
weed/shell/command_remote_unmount.go

@ -118,4 +118,3 @@ func (c *commandRemoteUnmount) purgeMountedData(commandEnv *CommandEnv, dir stri
return nil
}

4
weed/topology/topology_test.go

@ -31,7 +31,7 @@ func TestHandlingVolumeServerHeartbeat(t *testing.T) {
maxVolumeCounts := make(map[string]uint32)
maxVolumeCounts[""] = 25
maxVolumeCounts["ssd"] = 12
dn := rack.GetOrCreateDataNode("127.0.0.1", 34534, 0,"127.0.0.1", maxVolumeCounts)
dn := rack.GetOrCreateDataNode("127.0.0.1", 34534, 0, "127.0.0.1", maxVolumeCounts)
{
volumeCount := 7
@ -177,7 +177,7 @@ func TestAddRemoveVolume(t *testing.T) {
maxVolumeCounts := make(map[string]uint32)
maxVolumeCounts[""] = 25
maxVolumeCounts["ssd"] = 12
dn := rack.GetOrCreateDataNode("127.0.0.1", 34534, 0,"127.0.0.1", maxVolumeCounts)
dn := rack.GetOrCreateDataNode("127.0.0.1", 34534, 0, "127.0.0.1", maxVolumeCounts)
v := storage.VolumeInfo{
Id: needle.VolumeId(1),

6
weed/util/network.go

@ -15,11 +15,11 @@ func DetectedHostAddress() string {
return ""
}
if v4Address := selectIpV4(netInterfaces, true); v4Address != ""{
if v4Address := selectIpV4(netInterfaces, true); v4Address != "" {
return v4Address
}
if v6Address := selectIpV4(netInterfaces, false); v6Address != ""{
if v6Address := selectIpV4(netInterfaces, false); v6Address != "" {
return v6Address
}
@ -59,4 +59,4 @@ func JoinHostPort(host string, port int) string {
return host + ":" + portStr
}
return net.JoinHostPort(host, portStr)
}
}
Loading…
Cancel
Save