refactoring

This commit is contained in:
Chris Lu
2019-03-19 05:19:37 -07:00
parent ece9d13312
commit eb4a54d9fe
5 changed files with 26 additions and 38 deletions

View File

@@ -116,3 +116,9 @@ 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 {
return withMasterClient(ctx, mc.currentMaster, mc.grpcDialOption, func(ctx context.Context, client master_pb.SeaweedClient) error {
return fn(ctx, client)
})
}