Example #1
0
// Implementation of the Increment interface function.
func (c countersServiceImpl) Increment(in *counters.CountRequest, out *counters.CountResponse) error {
	counts[in.GetName()] += 1
	out.SetCount(counts[in.GetName()])

	log.Println(fmt.Sprintf("Incrementing %s to %d", in.GetName(), counts[in.GetName()]))

	return nil
}
Example #2
0
// Implementation of the Get interface function.
func (c countersServiceImpl) Get(in *counters.CountRequest, out *counters.CountResponse) error {
	out.SetCount(counts[in.GetName()])
	log.Println(fmt.Sprintf("Getting %s: %d", in.GetName(), counts[in.GetName()]))
	return nil
}