Documentation
¶
Overview ¶
Package indexer provides the indexer HTTP server for federated file access.
Index ¶
- func GetShardForRepo(repoName string, totalShards int) int
- type ReplaceExecuteRequest
- type Server
- type ServerConfig
- type ShardConfig
- type Worker
- func (w *Worker) CloneRepository(ctx context.Context, url string, name string, conn *repos.Connection) (string, error)
- func (w *Worker) FetchRepository(ctx context.Context, repoPath string, conn *repos.Connection) error
- func (w *Worker) IndexRepository(ctx context.Context, repoPath string, branches []string) error
- func (w *Worker) Run(ctx context.Context) error
- func (w *Worker) SetSCIPService(svc *scipkg.Service)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetShardForRepo ¶
GetShardForRepo returns the shard index for a repository name.
Types ¶
type ReplaceExecuteRequest ¶
type ReplaceExecuteRequest struct {
SearchPattern string `json:"search_pattern"`
ReplaceWith string `json:"replace_with"`
IsRegex bool `json:"is_regex"`
CaseSensitive bool `json:"case_sensitive"`
Matches []queue.ReplaceMatch `json:"matches"`
BranchName string `json:"branch_name,omitempty"`
MRTitle string `json:"mr_title,omitempty"`
MRDescription string `json:"mr_description,omitempty"`
UserTokens map[string]string `json:"user_tokens,omitempty"`
ReposReadOnly bool `json:"repos_readonly"`
}
ReplaceExecuteRequest is the request body for federated replace execution.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server provides HTTP endpoints for federated file access in sharded deployments. Each indexer runs this server to expose its local repos for browsing and replace operations.
func NewServer ¶
func NewServer( cfg ServerConfig, logger *zap.Logger, filesService *files.Service, replaceService *replace.Service, scipService *scip.Service, q *queue.Queue, ) *Server
NewServer creates a new indexer HTTP server.
type ServerConfig ¶
ServerConfig holds configuration for the indexer HTTP server.
type ShardConfig ¶
ShardConfig holds sharding configuration. Delegates to the shared sharding package.
func GetShardConfig ¶
func GetShardConfig() ShardConfig
GetShardConfig reads sharding configuration from environment.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker processes index jobs from the queue.
func NewWorker ¶
func NewWorker( cfg *config.Config, logger *zap.Logger, q *queue.Queue, pool db.Pool, tokenEncryptor *crypto.TokenEncryptor, ) *Worker
NewWorker creates a new indexer worker.
func (*Worker) CloneRepository ¶
func (w *Worker) CloneRepository( ctx context.Context, url string, name string, conn *repos.Connection, ) (string, error)
CloneRepository clones a repository to the local filesystem.
func (*Worker) FetchRepository ¶
func (w *Worker) FetchRepository( ctx context.Context, repoPath string, conn *repos.Connection, ) error
FetchRepository fetches updates for a repository.
func (*Worker) IndexRepository ¶
IndexRepository indexes a single repository.
func (*Worker) Run ¶
Run starts the worker loop. It supports graceful shutdown: when ctx is canceled, it will finish processing the current job before returning (up to shutdownTimeout).
func (*Worker) SetSCIPService ¶
SetSCIPService sets the optional SCIP service for code intelligence indexing.