Пример #1
0
func (t *Arith) Div(args *message.ArithRequest, reply *message.ArithResponse) error {
	if args.GetB() == 0 {
		return errors.New("divide by zero")
	}
	reply.C = args.GetA() / args.GetB()
	return nil
}
Пример #2
0
func (t *Arith) Mul(args *message.ArithRequest, reply *message.ArithResponse) error {
	reply.C = args.GetA() * args.GetB()
	return nil
}
Пример #3
0
func (t *Arith) Mul(args *message.ArithRequest, reply *message.ArithResponse) error {
	reply.C = args.A * args.B
	return nil
}
Пример #4
0
func (t *Arith) Add(args *message.ArithRequest, reply *message.ArithResponse) error {
	reply.C = args.GetA() + args.GetB()
	log.Infof("Arith.Add(%v, %v): %v", args.GetA(), args.GetB(), reply.GetC())
	return nil
}
Пример #5
0
func (t *Arith) Add(args *message.ArithRequest, reply *message.ArithResponse) error {
	reply.C = args.A + args.B
	log.Infof("Arith.Add(%v, %v): %v", args.A, args.B, reply.C)
	return nil
}