server

package
v1.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 26 Imported by: 0

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

func CreateIndexDir(d string) error

Types

type DefaultIndexBuilder

type DefaultIndexBuilder struct {
	IndexDir               string
	KnowledgeGraphIndexURL 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) GraphIndexRepository added in v1.2.0

func (b DefaultIndexBuilder) GraphIndexRepository(ctx context.Context, req GraphIndexRequest, callbackFunc callback.CallbackFunc) error

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 GitalyConnectionInfo struct {
	Address string `json:"Address"`
	Token   string `json:"Token"`
	Storage string `json:"Storage"`
	Path    string `json:"Path"`
}

type GraphIndexRequest added in v1.2.0

type GraphIndexRequest struct {
	Timeout              string                   `json:"Timeout"`
	RepoID               uint64                   `json:"RepoId"`
	NamespaceID          uint64                   `json:"NamespaceId"`
	GitalyConnectionInfo *GitalyConnectionInfo    `json:"GitalyConnectionInfo"`
	Parallelism          uint16                   `json:"Parallelism"`
	Callback             *callback.CallbackParams `json:"Callback"`
}

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"`
	Metadata             map[string]string        `json:"Metadata"`
}

type IndexServer

type IndexServer struct {
	IndexServerMode
	PathPrefix   string
	IndexBuilder indexBuilder
	CallbackAPI  callback.CallbackAPI

	IndexingLock      *indexing_lock.IndexingLock
	GraphIndexingLock *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 IndexServerMode interface {
	Init(version string)
	Services() []string
}

type KnowledgeGraphServerMode added in v1.7.0

type KnowledgeGraphServerMode struct {
	// contains filtered or unexported fields
}

func (KnowledgeGraphServerMode) Init added in v1.7.0

func (m KnowledgeGraphServerMode) Init(version string)

func (KnowledgeGraphServerMode) Services added in v1.7.0

func (m KnowledgeGraphServerMode) Services() []string

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL