sourcegraph/internal/codeintel/codenav/init.go
Christoph Hegemann dd863f052b
Adds a search client to the codenav service (#63180)
Closes https://linear.app/sourcegraph/issue/GRAPH-665/add-a-search-client-to-the-codenav-service

This change is preparation for pre-filtering syntactic occurrences via search.

## Test plan

CI passing means things are wired up correctly
2024-06-11 20:04:51 +08:00

39 lines
1.1 KiB
Go

package codenav
import (
"github.com/sourcegraph/log"
"github.com/sourcegraph/sourcegraph/internal/codeintel/codenav/internal/lsifstore"
codeintelshared "github.com/sourcegraph/sourcegraph/internal/codeintel/shared"
"github.com/sourcegraph/sourcegraph/internal/database"
"github.com/sourcegraph/sourcegraph/internal/gitserver"
"github.com/sourcegraph/sourcegraph/internal/observation"
searchClient "github.com/sourcegraph/sourcegraph/internal/search/client"
)
func NewService(
observationCtx *observation.Context,
db database.DB,
codeIntelDB codeintelshared.CodeIntelDB,
uploadSvc UploadService,
gitserver gitserver.Client,
) *Service {
lsifStore := lsifstore.New(scopedContext("lsifstore", observationCtx), codeIntelDB)
logger := log.Scoped("codenav")
searcher := searchClient.New(logger, db, gitserver)
return newService(
observationCtx,
db.Repos(),
lsifStore,
uploadSvc,
gitserver,
searcher,
logger,
)
}
func scopedContext(component string, parent *observation.Context) *observation.Context {
return observation.ScopedContext("codeintel", "codenav", component, parent)
}