示例#1
0
文件: client.go 项目: missmayo/cfs
func New(address string) (*Client, error) {
	conn, err := grpc.Dial(address)
	if err != nil {
		return nil, err
	}
	fc := pb.NewCfsClient(conn)
	sc := pb.NewStatsClient(conn)

	return &Client{grpcConn: conn, fileClient: fc, statsClient: sc}, nil
}
示例#2
0
文件: client.go 项目: wangtuanjie/cfs
func New(clientID int64, address string) (*Client, error) {
	header := &pb.RequestHeader{ClientID: clientID}
	conn, err := grpc.Dial(address)
	if err != nil {
		return nil, err
	}
	fc := pb.NewCfsClient(conn)
	sc := pb.NewStatsClient(conn)

	return &Client{header: header, grpcConn: conn, fileClient: fc, statsClient: sc}, nil
}