func (this *Controller) executeRead(context context.Context, partition *PartitionController, request *api.ReadRequest, stream api.Edgy_ReadServer) (*api.OffsetData, error) { reply, err := partition.HandleReadRequest(request) if err != nil { return nil, err } if len(reply.Messages) == 0 { // We are at the end of the stream return nil, io.EOF } if err := stream.Send(reply); err != nil { return nil, err } return reply.Offset, nil }