aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@uber.com>2019-03-19 23:01:23 -0700
committerChris Lu <chris.lu@uber.com>2019-03-19 23:01:23 -0700
commit88ab932f7d439715698183fbdfbd4ade71596b67 (patch)
treeafb6d86a39145bc944dbd9986ec05c31d4298aa3
parent5ae4b963a47a98426392b5434a9c3e26ad550e27 (diff)
downloadseaweedfs-88ab932f7d439715698183fbdfbd4ade71596b67.tar.xz
seaweedfs-88ab932f7d439715698183fbdfbd4ade71596b67.zip
refactoring function parameter
-rw-r--r--weed/server/filer_grpc_server.go2
-rw-r--r--weed/shell/command_collection_list.go4
-rw-r--r--weed/shell/command_volume_list.go3
-rw-r--r--weed/wdclient/masterclient.go4
4 files changed, 7 insertions, 6 deletions
diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.go
index 6f7cf1ad6..c9cb6dbe7 100644
--- a/weed/server/filer_grpc_server.go
+++ b/weed/server/filer_grpc_server.go
@@ -238,7 +238,7 @@ func (fs *FilerServer) AssignVolume(ctx context.Context, req *filer_pb.AssignVol
func (fs *FilerServer) DeleteCollection(ctx context.Context, req *filer_pb.DeleteCollectionRequest) (resp *filer_pb.DeleteCollectionResponse, err error) {
- err = fs.filer.MasterClient.WithClient(ctx, func(ctx context.Context, client master_pb.SeaweedClient) error {
+ err = fs.filer.MasterClient.WithClient(ctx, func(client master_pb.SeaweedClient) error {
_, err := client.CollectionDelete(ctx, &master_pb.CollectionDeleteRequest{
Name: req.GetCollection(),
})
diff --git a/weed/shell/command_collection_list.go b/weed/shell/command_collection_list.go
index 0797e56fb..0db74ef20 100644
--- a/weed/shell/command_collection_list.go
+++ b/weed/shell/command_collection_list.go
@@ -25,8 +25,8 @@ func (c *commandCollectionList) Help() string {
func (c *commandCollectionList) Do(args []string, commandEnv *commandEnv, writer io.Writer) (err error) {
var resp *master_pb.CollectionListResponse
-
- err = commandEnv.masterClient.WithClient(context.Background(), func(ctx context.Context, client master_pb.SeaweedClient) error {
+ ctx := context.Background()
+ err = commandEnv.masterClient.WithClient(ctx, func(client master_pb.SeaweedClient) error {
resp, err = client.CollectionList(ctx, &master_pb.CollectionListRequest{})
return err
})
diff --git a/weed/shell/command_volume_list.go b/weed/shell/command_volume_list.go
index 52ac4865a..5be5be569 100644
--- a/weed/shell/command_volume_list.go
+++ b/weed/shell/command_volume_list.go
@@ -25,7 +25,8 @@ func (c *commandVolumeList) Help() string {
func (c *commandVolumeList) Do(args []string, commandEnv *commandEnv, writer io.Writer) (err error) {
var resp *master_pb.VolumeListResponse
- err = commandEnv.masterClient.WithClient(context.Background(), func(ctx context.Context, client master_pb.SeaweedClient) error {
+ ctx := context.Background()
+ err = commandEnv.masterClient.WithClient(ctx, func(client master_pb.SeaweedClient) error {
resp, err = client.VolumeList(ctx, &master_pb.VolumeListRequest{})
return err
})
diff --git a/weed/wdclient/masterclient.go b/weed/wdclient/masterclient.go
index 29fe50d80..794471f7b 100644
--- a/weed/wdclient/masterclient.go
+++ b/weed/wdclient/masterclient.go
@@ -117,8 +117,8 @@ func withMasterClient(ctx context.Context, master string, grpcDialOption grpc.Di
return fn(ctx, client)
}
-func (mc *MasterClient) WithClient(ctx context.Context, fn func(ctx context.Context, client master_pb.SeaweedClient) error) error {
+func (mc *MasterClient) WithClient(ctx context.Context, fn func(client master_pb.SeaweedClient) error) error {
return withMasterClient(ctx, mc.currentMaster, mc.grpcDialOption, func(ctx context.Context, client master_pb.SeaweedClient) error {
- return fn(ctx, client)
+ return fn(client)
})
}