func Serve(
	rawTCPAddr string,
	rawTCPServerOpts rawtcpserver.Options,
	httpAddr string,
	httpServerOpts httpserver.Options,
	aggregator aggregator.Aggregator,
	doneCh chan struct{},
) error {
	log := rawTCPServerOpts.InstrumentOptions().Logger()
	defer aggregator.Close()
	rawTCPServer := rawtcpserver.NewServer(rawTCPAddr, aggregator, rawTCPServerOpts)
	if err := rawTCPServer.ListenAndServe(); err != nil {
		return fmt.Errorf("could not start raw TCP server at %s: %v", rawTCPAddr, err)
	}
	defer rawTCPServer.Close()
	log.Infof("raw TCP server: listening on %s", rawTCPAddr)
	httpServer := httpserver.NewServer(httpAddr, aggregator, httpServerOpts)
	if err := httpServer.ListenAndServe(); err != nil {
		return fmt.Errorf("could not start http server at %s: %v", httpAddr, err)
	}
	defer httpServer.Close()
	log.Infof("http server: listening on %s", httpAddr)
	<-doneCh
	return nil
}
Serve starts serving RPC traffic.
package serve
import (
	"fmt"
	"github.com/m3db/m3aggregator/aggregator"
	httpserver "github.com/m3db/m3aggregator/server/http"
	rawtcpserver "github.com/m3db/m3aggregator/server/rawtcp"
)