server

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 25 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
	GraphIndexDir string
}

func (DefaultIndexBuilder) DeleteRepository

func (b DefaultIndexBuilder) DeleteRepository(req DeleteRequest, callbackFunc callback.CallbackFunc, lock *indexing_lock.IndexingLock) error

func (DefaultIndexBuilder) GetGraphIndexDir added in v1.2.0

func (b DefaultIndexBuilder) GetGraphIndexDir() string

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 {
	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

Jump to

Keyboard shortcuts

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