<commit_before>package api

import (
	"net/http"
	"time"

	"github.com/pivotal-golang/lager"
	"github.com/tedsuo/rata"

	"github.com/concourse/atc/api/buildserver"
	"github.com/concourse/atc/api/jobserver"
	"github.com/concourse/atc/api/pipes"
	"github.com/concourse/atc/builder"
	"github.com/concourse/atc/logfanout"
)

func NewHandler(
	logger lager.Logger,
	buildsDB buildserver.BuildsDB,
	jobsDB jobserver.JobsDB,
	builder builder.Builder,
	tracker *logfanout.Tracker,
	pingInterval time.Duration,
	peerAddr string,
) (http.Handler, error) {
	buildServer := buildserver.NewServer(logger, buildsDB, builder, tracker, pingInterval)
	jobServer := jobserver.NewServer(logger, jobsDB)
	pipeServer := pipes.NewServer(logger, peerAddr)

	handlers := map[string]http.Handler{
		CreateBuild: http.HandlerFunc(buildServer.CreateBuild),
		ListBuilds:  http.HandlerFunc(buildServer.ListBuilds),
		BuildEvents: http.HandlerFunc(buildServer.BuildEvents),
		AbortBuild:  http.HandlerFunc(buildServer.AbortBuild),
		HijackBuild: http.HandlerFunc(buildServer.HijackBuild),

		ListJobBuilds: http.HandlerFunc(jobServer.ListJobBuilds),
		GetJobBuild:   http.HandlerFunc(jobServer.GetJobBuild),

		CreatePipe: http.HandlerFunc(pipeServer.CreatePipe),
		WritePipe:  http.HandlerFunc(pipeServer.WritePipe),
		ReadPipe:   http.HandlerFunc(pipeServer.ReadPipe),
	}

	return rata.NewRouter(Routes, handlers)
}
<commit_msg>take full db, pass sub-interface to sub-handlers<commit_after>package api

import (
	"net/http"
	"time"

	"github.com/pivotal-golang/lager"
	"github.com/tedsuo/rata"

	"github.com/concourse/atc/api/buildserver"
	"github.com/concourse/atc/api/jobserver"
	"github.com/concourse/atc/api/pipes"
	"github.com/concourse/atc/builder"
	"github.com/concourse/atc/db"
	"github.com/concourse/atc/logfanout"
)

func NewHandler(
	logger lager.Logger,
	db db.DB,
	builder builder.Builder,
	tracker *logfanout.Tracker,
	pingInterval time.Duration,
	peerAddr string,
) (http.Handler, error) {
	buildServer := buildserver.NewServer(logger, db, builder, tracker, pingInterval)
	jobServer := jobserver.NewServer(logger, db)
	pipeServer := pipes.NewServer(logger, peerAddr)

	handlers := map[string]http.Handler{
		CreateBuild: http.HandlerFunc(buildServer.CreateBuild),
		ListBuilds:  http.HandlerFunc(buildServer.ListBuilds),
		BuildEvents: http.HandlerFunc(buildServer.BuildEvents),
		AbortBuild:  http.HandlerFunc(buildServer.AbortBuild),
		HijackBuild: http.HandlerFunc(buildServer.HijackBuild),

		ListJobBuilds: http.HandlerFunc(jobServer.ListJobBuilds),
		GetJobBuild:   http.HandlerFunc(jobServer.GetJobBuild),

		CreatePipe: http.HandlerFunc(pipeServer.CreatePipe),
		WritePipe:  http.HandlerFunc(pipeServer.WritePipe),
		ReadPipe:   http.HandlerFunc(pipeServer.ReadPipe),
	}

	return rata.NewRouter(Routes, handlers)
}

{'fraction_non_alphanumeric': 0.12202063322660975, 'fraction_numerical': 0.0, 'mean_word_length': 5.94320987654321, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5124102', 'n_tokens_mistral': 1045, 'n_tokens_neox': 999, 'n_words': 139}