Пример #1
0
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
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
}