handler

package
v1.0.0-rc.6b4eaf6 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package handler provides task handlers for processing queued operations.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoHandler = errors.New("no handler registered")

ErrNoHandler indicates no handler is registered for the operation.

Functions

func ExtractInt64

func ExtractInt64(payload map[string]any, key string) (int64, error)

ExtractInt64 extracts an int64 value from the payload.

func ExtractString

func ExtractString(payload map[string]any, key string) (string, error)

ExtractString extracts a string value from the payload.

func ShortSHA

func ShortSHA(sha string) string

ShortSHA returns the first 8 characters of a SHA for display purposes.

Types

type CommitPayload

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

CommitPayload holds the common repository_id and commit_sha fields extracted from task payloads.

func ExtractCommitPayload

func ExtractCommitPayload(payload map[string]any) (CommitPayload, error)

ExtractCommitPayload extracts the common repository_id and commit_sha fields from a task payload.

func (CommitPayload) CommitSHA

func (p CommitPayload) CommitSHA() string

CommitSHA returns the commit SHA.

func (CommitPayload) RepoID

func (p CommitPayload) RepoID() int64

RepoID returns the repository ID.

type EnrichmentContext

type EnrichmentContext struct {
	Enrichments  enrichment.EnrichmentStore
	Associations enrichment.AssociationStore
	Enricher     domainservice.Enricher
	Tracker      TrackerFactory
	Logger       *slog.Logger
}

EnrichmentContext holds the stores and services shared by all enrichment handlers.

type GitInfrastructure

type GitInfrastructure struct {
	Adapter git.Adapter
	Cloner  domainservice.Cloner
	Scanner domainservice.Scanner
}

GitInfrastructure provides git cloning, updating, and scanning operations.

type Handler

type Handler interface {
	Execute(ctx context.Context, payload map[string]any) error
}

Handler defines the interface for task operation handlers.

type Registry

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

Registry maps task operations to their handlers.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new handler registry.

func (*Registry) Handler

func (r *Registry) Handler(operation task.Operation) (Handler, error)

Handler returns the handler for a task operation. Returns ErrNoHandler if no handler is registered.

func (*Registry) HasHandler

func (r *Registry) HasHandler(operation task.Operation) bool

HasHandler checks if a handler is registered for the operation.

func (*Registry) Operations

func (r *Registry) Operations() []task.Operation

Operations returns all registered operations.

func (*Registry) Register

func (r *Registry) Register(operation task.Operation, handler Handler)

Register adds a handler for a task operation. Subsequent registrations for the same operation will overwrite the previous handler.

type RepositoryStores

type RepositoryStores struct {
	Repositories repository.RepositoryStore
	Commits      repository.CommitStore
	Branches     repository.BranchStore
	Tags         repository.TagStore
	Files        repository.FileStore
}

RepositoryStores groups the persistence stores for repository-related entities.

type Tracker

type Tracker interface {
	SetTotal(ctx context.Context, total int)
	SetCurrent(ctx context.Context, current int, message string)
	Skip(ctx context.Context, message string)
	Fail(ctx context.Context, message string)
	Complete(ctx context.Context)
}

Tracker provides progress tracking for task execution.

type TrackerFactory

type TrackerFactory interface {
	ForOperation(operation task.Operation, trackableType task.TrackableType, trackableID int64) Tracker
}

TrackerFactory creates trackers for progress reporting.

type VectorIndex

type VectorIndex struct {
	Embedding domainservice.Embedding
	Store     search.VectorStore
}

VectorIndex pairs an embedding domain service with its backing vector store.

Directories

Path Synopsis
Package enrichment provides task handlers for enrichment operations.
Package enrichment provides task handlers for enrichment operations.

Jump to

Keyboard shortcuts

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