refactor(rcp): move health interface to core package

This commit is contained in:
Bo-Yi Wu 2022-11-09 14:07:51 +08:00
parent 4be2c8036d
commit e13a05bc08
2 changed files with 4 additions and 5 deletions

View File

@ -1,8 +1,6 @@
package rpc package core
import ( import "context"
"context"
)
// Health defines a health-check connection. // Health defines a health-check connection.
type Health interface { type Health interface {

View File

@ -3,6 +3,7 @@ package rpc
import ( import (
"context" "context"
"github.com/appleboy/gorush/core"
"github.com/appleboy/gorush/rpc/proto" "github.com/appleboy/gorush/rpc/proto"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -19,7 +20,7 @@ type healthClient struct {
} }
// NewGrpcHealthClient returns a new grpc Client. // NewGrpcHealthClient returns a new grpc Client.
func NewGrpcHealthClient(conn *grpc.ClientConn) Health { func NewGrpcHealthClient(conn *grpc.ClientConn) core.Health {
client := new(healthClient) client := new(healthClient)
client.client = proto.NewHealthClient(conn) client.client = proto.NewHealthClient(conn)
client.conn = conn client.conn = conn