aboutsummaryrefslogtreecommitdiff
path: root/weed
diff options
context:
space:
mode:
Diffstat (limited to 'weed')
-rw-r--r--weed/command/backup.go2
-rw-r--r--weed/server/volume_grpc_follow.go14
-rw-r--r--weed/server/volume_grpc_replicate.go2
-rw-r--r--weed/server/volume_grpc_sync.go25
-rw-r--r--weed/shell/command_fs_du.go6
-rw-r--r--weed/storage/volume_follow.go17
-rw-r--r--weed/storage/volume_sync.go18
7 files changed, 34 insertions, 50 deletions
diff --git a/weed/command/backup.go b/weed/command/backup.go
index 9c0bcbc52..48e2eba89 100644
--- a/weed/command/backup.go
+++ b/weed/command/backup.go
@@ -98,7 +98,7 @@ func runBackup(cmd *Command, args []string) bool {
return true
}
v.SuperBlock.CompactRevision = uint16(stats.CompactRevision)
- v.DataFile().WriteAt(v.SuperBlock.Bytes(),0)
+ v.DataFile().WriteAt(v.SuperBlock.Bytes(), 0)
}
if uint64(v.Size()) > stats.TailOffset {
diff --git a/weed/server/volume_grpc_follow.go b/weed/server/volume_grpc_follow.go
index 6b3330a0d..cc5dcc78e 100644
--- a/weed/server/volume_grpc_follow.go
+++ b/weed/server/volume_grpc_follow.go
@@ -1,6 +1,7 @@
package weed_server
import (
+ "context"
"fmt"
"github.com/chrislusf/seaweedfs/weed/storage/types"
"io"
@@ -34,6 +35,19 @@ func (vs *VolumeServer) VolumeFollow(req *volume_server_pb.VolumeFollowRequest,
}
+func (vs *VolumeServer) VolumeSyncStatus(ctx context.Context, req *volume_server_pb.VolumeSyncStatusRequest) (*volume_server_pb.VolumeSyncStatusResponse, error) {
+
+ v := vs.store.GetVolume(storage.VolumeId(req.VolumeId))
+ if v == nil {
+ return nil, fmt.Errorf("not found volume id %d", req.VolumeId)
+ }
+
+ resp := v.GetVolumeSyncStatus()
+
+ return resp, nil
+
+}
+
func sendFileContent(datFile *os.File, buf []byte, startOffset, stopOffset int64, stream volume_server_pb.VolumeServer_VolumeFollowServer) error {
var blockSizeLimit = int64(len(buf))
for i := int64(0); i < stopOffset-startOffset; i += blockSizeLimit {
diff --git a/weed/server/volume_grpc_replicate.go b/weed/server/volume_grpc_replicate.go
index 20a85fd6f..1a31a37f3 100644
--- a/weed/server/volume_grpc_replicate.go
+++ b/weed/server/volume_grpc_replicate.go
@@ -113,7 +113,7 @@ func (vs *VolumeServer) ReadVolumeFileStatus(ctx context.Context, req *volume_se
return resp, nil
}
-func (vs *VolumeServer) CopyFile(req *volume_server_pb.CopyFileRequest, stream volume_server_pb.VolumeServer_CopyFileServer) (error) {
+func (vs *VolumeServer) CopyFile(req *volume_server_pb.CopyFileRequest, stream volume_server_pb.VolumeServer_CopyFileServer) error {
v := vs.store.GetVolume(storage.VolumeId(req.VolumeId))
if v == nil {
diff --git a/weed/server/volume_grpc_sync.go b/weed/server/volume_grpc_sync.go
deleted file mode 100644
index 8b7b5934c..000000000
--- a/weed/server/volume_grpc_sync.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package weed_server
-
-import (
- "context"
- "fmt"
-
- "github.com/chrislusf/seaweedfs/weed/glog"
- "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
- "github.com/chrislusf/seaweedfs/weed/storage"
-)
-
-func (vs *VolumeServer) VolumeSyncStatus(ctx context.Context, req *volume_server_pb.VolumeSyncStatusRequest) (*volume_server_pb.VolumeSyncStatusResponse, error) {
-
- v := vs.store.GetVolume(storage.VolumeId(req.VolumeId))
- if v == nil {
- return nil, fmt.Errorf("not found volume id %d", req.VolumeId)
- }
-
- resp := v.GetVolumeSyncStatus()
-
- glog.V(2).Infof("volume sync status %d", req.VolumeId)
-
- return resp, nil
-
-}
diff --git a/weed/shell/command_fs_du.go b/weed/shell/command_fs_du.go
index 1206596b0..3fecac9a8 100644
--- a/weed/shell/command_fs_du.go
+++ b/weed/shell/command_fs_du.go
@@ -42,10 +42,10 @@ func (c *commandFsDu) Do(args []string, commandEnv *commandEnv, writer io.Writer
dir, name := filer2.FullPath(path).DirAndName()
if strings.HasSuffix(path, "/") {
- if path == "/"{
+ if path == "/" {
dir, name = "/", ""
- }else{
- dir, name = path[0 : len(path)-1], ""
+ } else {
+ dir, name = path[0:len(path)-1], ""
}
}
diff --git a/weed/storage/volume_follow.go b/weed/storage/volume_follow.go
index e1a5fcb83..b8353f9d1 100644
--- a/weed/storage/volume_follow.go
+++ b/weed/storage/volume_follow.go
@@ -11,6 +11,19 @@ import (
"os"
)
+func (v *Volume) GetVolumeSyncStatus() *volume_server_pb.VolumeSyncStatusResponse {
+ var syncStatus = &volume_server_pb.VolumeSyncStatusResponse{}
+ if stat, err := v.dataFile.Stat(); err == nil {
+ syncStatus.TailOffset = uint64(stat.Size())
+ }
+ syncStatus.Collection = v.Collection
+ syncStatus.IdxFileSize = v.nm.IndexFileSize()
+ syncStatus.CompactRevision = uint32(v.SuperBlock.CompactRevision)
+ syncStatus.Ttl = v.SuperBlock.Ttl.String()
+ syncStatus.Replication = v.SuperBlock.ReplicaPlacement.String()
+ return syncStatus
+}
+
// The volume sync with a master volume via 2 steps:
// 1. The slave checks master side to find subscription checkpoint
// to setup the replication.
@@ -41,7 +54,7 @@ update needle map when receiving new .dat bytes. But seems not necessary now.)
*/
-func (v *Volume) Follow(volumeServer string, grpcDialOption grpc.DialOption) (error) {
+func (v *Volume) Follow(volumeServer string, grpcDialOption grpc.DialOption) error {
ctx := context.Background()
@@ -88,7 +101,7 @@ func (v *Volume) Follow(volumeServer string, grpcDialOption grpc.DialOption) (er
}
// add to needle map
- return ScanVolumeFileFrom(v.version, v.dataFile, startFromOffset, &VolumeFileScanner4GenIdx{v:v})
+ return ScanVolumeFileFrom(v.version, v.dataFile, startFromOffset, &VolumeFileScanner4GenIdx{v: v})
}
diff --git a/weed/storage/volume_sync.go b/weed/storage/volume_sync.go
deleted file mode 100644
index 199561302..000000000
--- a/weed/storage/volume_sync.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package storage
-
-import (
- "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
-)
-
-func (v *Volume) GetVolumeSyncStatus() *volume_server_pb.VolumeSyncStatusResponse {
- var syncStatus = &volume_server_pb.VolumeSyncStatusResponse{}
- if stat, err := v.dataFile.Stat(); err == nil {
- syncStatus.TailOffset = uint64(stat.Size())
- }
- syncStatus.Collection = v.Collection
- syncStatus.IdxFileSize = v.nm.IndexFileSize()
- syncStatus.CompactRevision = uint32(v.SuperBlock.CompactRevision)
- syncStatus.Ttl = v.SuperBlock.Ttl.String()
- syncStatus.Replication = v.SuperBlock.ReplicaPlacement.String()
- return syncStatus
-} \ No newline at end of file