Example #1
0
func (self *TileRouter) getTile(conn *gopnikrpc.RenderClient, coord gopnik.TileCoord) (img []byte, err error) {
	resp, err := conn.Render(gopnikrpcutils.CoordToRPC(&coord), gopnikrpc.Priority_HIGH, false)
	if err != nil {
		return nil, err
	}

	if len(resp.Tiles) != 1 {
		return nil, fmt.Errorf("Invalid render response size %v", len(resp.Tiles))
	}

	return resp.Tiles[0].Image, err
}
Example #2
0
func (self *connection) callRender(coord gopnik.TileCoord) (*perflog.PerfLogEntry, error) {
	resp, err := self.renderClient.Render(gopnikrpcutils.CoordToRPC(&coord), gopnikrpc.Priority_LOW, true)
	if err != nil {
		return nil, err
	}

	return &perflog.PerfLogEntry{
		Coord:      coord,
		Timestamp:  time.Now(),
		RenderTime: time.Duration(resp.RenderTime),
		SaverTime:  time.Duration(resp.SaveTime),
	}, nil
}