Commit 26642ade authored by Boris Mühmer's avatar Boris Mühmer
Browse files

splitted type and server funcs and added docs

parent 4629178a
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -2,21 +2,13 @@ package rpcexamplelib

import "errors"

type Args struct {
	A, B int
}

type Quotient struct {
	Quo, Rem int
}

type Arith int

// Multiply is an rpc multiplication.
func (t *Arith) Multiply(args *Args, reply *int) error {
	*reply = args.A * args.B
	return nil
}

// Divide provides a rpc division resulting in a quotient and reminder.
func (t *Arith) Divide(args *Args, quo *Quotient) error {
	if args.B == 0 {
		return errors.New("divide by zero")
+14 −0
Original line number Diff line number Diff line
package rpcexamplelib

// Args is a wrapper for calling rpcs
type Args struct {
	A, B int
}

// Quotient is the result of Divide
type Quotient struct {
	Quo, Rem int
}

// Arith is the interface type
type Arith int