mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
style: go fmt for all
This commit is contained in:
parent
82e06a780b
commit
32f93fb09e
|
@ -1,10 +1,10 @@
|
|||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/chrislusf/raft/protobuf"
|
||||
"github.com/chrislusf/seaweedfs/weed/security"
|
||||
"github.com/spf13/viper"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
|
|
|
@ -79,10 +79,10 @@ func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServ
|
|||
}
|
||||
if len(heartbeat.NewVolumes) > 0 || len(heartbeat.DeletedVolumes) > 0 {
|
||||
// process delta volume ids if exists for fast volume id updates
|
||||
for _, volInfo := range heartbeat.NewVolumes{
|
||||
for _, volInfo := range heartbeat.NewVolumes {
|
||||
message.NewVids = append(message.NewVids, volInfo.Id)
|
||||
}
|
||||
for _, volInfo := range heartbeat.DeletedVolumes{
|
||||
for _, volInfo := range heartbeat.DeletedVolumes {
|
||||
message.DeletedVids = append(message.DeletedVids, volInfo.Id)
|
||||
}
|
||||
// update master internal volume layouts
|
||||
|
|
|
@ -99,7 +99,7 @@ func (vs *VolumeServer) doHeartbeat(ctx context.Context, masterNode, masterGrpcA
|
|||
select {
|
||||
case volumeMessage := <-vs.store.NewVolumesChan:
|
||||
deltaBeat := &master_pb.Heartbeat{
|
||||
NewVolumes:[]*master_pb.VolumeShortInformationMessage{
|
||||
NewVolumes: []*master_pb.VolumeShortInformationMessage{
|
||||
&volumeMessage,
|
||||
},
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ func (vs *VolumeServer) doHeartbeat(ctx context.Context, masterNode, masterGrpcA
|
|||
}
|
||||
case volumeMessage := <-vs.store.DeletedVolumesChan:
|
||||
deltaBeat := &master_pb.Heartbeat{
|
||||
DeletedVolumes:[]*master_pb.VolumeShortInformationMessage{
|
||||
DeletedVolumes: []*master_pb.VolumeShortInformationMessage{
|
||||
&volumeMessage,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ func (c *commandVolumeUnmount) Do(args []string, commandEnv *commandEnv, writer
|
|||
|
||||
}
|
||||
|
||||
|
||||
func unmountVolume(ctx context.Context, grpcDialOption grpc.DialOption, volumeId needle.VolumeId, sourceVolumeServer string) (err error) {
|
||||
return operation.WithVolumeServerClient(sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
|
||||
_, unmountErr := volumeServerClient.VolumeUnmount(ctx, &volume_server_pb.VolumeUnmountRequest{
|
||||
|
|
|
@ -188,4 +188,3 @@ func ParseNeedleIdCookie(key_hash_string string) (NeedleId, Cookie, error) {
|
|||
func (n *Needle) LastModifiedString() string {
|
||||
return time.Unix(int64(n.LastModified), 0).Format("2006-01-02T15:04:05")
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ func (n *Needle) ReadData(r *os.File, offset int64, size uint32, version Version
|
|||
case Version2, Version3:
|
||||
err = n.readNeedleDataVersion2(bytes[NeedleHeaderSize : NeedleHeaderSize+int(n.Size)])
|
||||
}
|
||||
if err != nil && err != io.EOF{
|
||||
if err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
if size > 0 {
|
||||
|
@ -390,4 +390,3 @@ func (n *Needle) SetHasPairs() {
|
|||
func getActualSize(size uint32, version Version) int64 {
|
||||
return NeedleHeaderSize + NeedleBodyLength(size, version)
|
||||
}
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ package needle
|
|||
import "testing"
|
||||
|
||||
func TestNewVolumeId(t *testing.T) {
|
||||
if _,err := NewVolumeId("1"); err != nil {
|
||||
if _, err := NewVolumeId("1"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if _, err := NewVolumeId("a");err != nil {
|
||||
if _, err := NewVolumeId("a"); err != nil {
|
||||
t.Logf("a is not legal volume id, %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ func CheckVolumeDataIntegrity(v *Volume, indexFile *os.File) (lastAppendAtNs uin
|
|||
return 0, fmt.Errorf("verifyIndexFileIntegrity %s failed: %v", indexFile.Name(), e)
|
||||
}
|
||||
if indexSize == 0 {
|
||||
return 0,nil
|
||||
return 0, nil
|
||||
}
|
||||
var lastIdxEntry []byte
|
||||
if lastIdxEntry, e = readIndexEntryAtOffset(indexFile, indexSize-NeedleMapEntrySize); e != nil {
|
||||
|
@ -23,7 +23,7 @@ func CheckVolumeDataIntegrity(v *Volume, indexFile *os.File) (lastAppendAtNs uin
|
|||
}
|
||||
key, offset, size := IdxFileEntry(lastIdxEntry)
|
||||
if offset.IsZero() {
|
||||
return 0,nil
|
||||
return 0, nil
|
||||
}
|
||||
if size == TombstoneFileSize {
|
||||
size = 0
|
||||
|
|
|
@ -114,10 +114,10 @@ func TestHandlingVolumeServerHeartbeat(t *testing.T) {
|
|||
nil,
|
||||
dn)
|
||||
|
||||
for vid, _ := range layout.vid2location{
|
||||
for vid, _ := range layout.vid2location {
|
||||
println("after add volume id", vid)
|
||||
}
|
||||
for _, vid := range layout.writables{
|
||||
for _, vid := range layout.writables {
|
||||
println("after add writable volume id", vid)
|
||||
}
|
||||
|
||||
|
|
|
@ -91,4 +91,3 @@ func UnGzipData(input []byte) ([]byte, error) {
|
|||
|
||||
return false, false
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue