Documentation
¶
Overview ¶
Package server implements a complete HTTP API server for the GitLab Zoekt indexer service. It provides endpoints for managing code search indexes, including creation, deletion, status checking, and maintenance operations.
The package consists of several components: - IndexServer: The main server that handles HTTP requests and manages the indexing process - Router: Configures routes and middleware for the HTTP API - DefaultIndexBuilder: Implements repository indexing and deletion operations - Request/response types: Defines the data structures for API communication
The server handles concurrent indexing requests with locking mechanisms, tracks metrics via Prometheus, implements callbacks to report operation results back to GitLab, and provides standardized JSON responses for all API operations. It integrates with Gitaly for repository access and manages the lifecycle of search indexes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateIndexDir ¶ added in v0.8.4
Types ¶
type DefaultIndexBuilder ¶
type DefaultIndexBuilder struct {
IndexDir string
}
func (DefaultIndexBuilder) DeleteRepository ¶
func (b DefaultIndexBuilder) DeleteRepository(req DeleteRequest, callbackFunc callback.CallbackFunc, lock *indexing_lock.IndexingLock) error
func (DefaultIndexBuilder) GetIndexDir ¶
func (b DefaultIndexBuilder) GetIndexDir() string
func (DefaultIndexBuilder) IndexRepository ¶
func (b DefaultIndexBuilder) IndexRepository(ctx context.Context, req IndexRequest, callbackFunc callback.CallbackFunc) error
type DeleteRequest ¶
type DeleteRequest struct {
RepoID uint64 `json:"RepoID"`
Callback *callback.CallbackParams `json:"Callback"`
}
type GitalyConnectionInfo ¶
type IndexRequest ¶
type IndexRequest struct {
Timeout string `json:"Timeout"`
RepoID uint64 `json:"RepoID"`
GitalyConnectionInfo *GitalyConnectionInfo `json:"GitalyConnectionInfo"`
FileSizeLimit int `json:"FileSizeLimit"`
FileCountLimit uint32 `json:"FileCountLimit"`
Callback *callback.CallbackParams `json:"Callback"`
Force bool `json:"Force"`
MissingRepo bool `json:"MissingRepo"`
Parallelism int `json:"Parallelism"`
TrigramMax int `json:"TrigramMax"` // Validated by Rails to be positive
Metadata map[string]string `json:"Metadata"`
}
type IndexServer ¶
type IndexServer struct {
IndexServerMode
PathPrefix string
IndexBuilder indexBuilder
CallbackAPI callback.CallbackAPI
IndexingLock *indexing_lock.IndexingLock
Auth *authentication.Auth
JWTEnabled bool
// contains filtered or unexported fields
}
func (*IndexServer) Router ¶
func (s *IndexServer) Router() *chi.Mux
func (*IndexServer) StartFileCleaner ¶
func (s *IndexServer) StartFileCleaner(ctx context.Context) error
func (*IndexServer) StartIndexingAPI ¶ added in v0.15.0
func (s *IndexServer) StartIndexingAPI(httpServer *http.Server) error
type IndexServerMode ¶ added in v1.7.0
type ZoektServerMode ¶ added in v1.7.0
type ZoektServerMode struct {
// contains filtered or unexported fields
}
func (ZoektServerMode) Init ¶ added in v1.7.0
func (m ZoektServerMode) Init(version string)
func (ZoektServerMode) Services ¶ added in v1.7.0
func (m ZoektServerMode) Services() []string