tracking

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package tracking provides progress tracking and reporting types for long-running tasks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReferenceType

type ReferenceType string

ReferenceType represents types of git references that can be tracked.

const (
	ReferenceTypeBranch    ReferenceType = "branch"
	ReferenceTypeTag       ReferenceType = "tag"
	ReferenceTypeCommitSHA ReferenceType = "commit_sha"
)

ReferenceType values.

func (ReferenceType) String

func (r ReferenceType) String() string

String returns the string representation.

type RepositoryStatusSummary

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

RepositoryStatusSummary provides a summary of repository indexing status. It aggregates task status information into a high-level view.

func NewRepositoryStatusSummary

func NewRepositoryStatusSummary(status snippet.IndexStatus, message string, updatedAt time.Time) RepositoryStatusSummary

NewRepositoryStatusSummary creates a new RepositoryStatusSummary.

func StatusSummaryFromTasks

func StatusSummaryFromTasks(tasks []task.Status, pendingTaskCount int) RepositoryStatusSummary

StatusSummaryFromTasks derives a RepositoryStatusSummary from task statuses. Priority: in_progress/started > pending_queue > completed_with_errors/failed > completed > pending. When all tasks are terminal and failures exist, returns completed_with_errors if more tasks succeeded than failed, otherwise returns failed.

func (RepositoryStatusSummary) Message

func (s RepositoryStatusSummary) Message() string

Message returns the status message (typically error message if failed).

func (RepositoryStatusSummary) Status

Status returns the overall indexing status.

func (RepositoryStatusSummary) UpdatedAt

func (s RepositoryStatusSummary) UpdatedAt() time.Time

UpdatedAt returns the timestamp of the most recent activity.

type Resolver

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

Resolver resolves trackables to ordered lists of commit SHAs. This is a domain service that orchestrates multiple repositories (branches, tags, commits) to resolve references.

func NewResolver

func NewResolver(
	commitStore repository.CommitStore,
	branchStore repository.BranchStore,
	tagStore repository.TagStore,
	logger *slog.Logger,
) *Resolver

NewResolver creates a new trackable resolver.

func (*Resolver) Commits

func (r *Resolver) Commits(ctx context.Context, trackable Trackable, limit int) ([]string, error)

Commits resolves a trackable to an ordered list of commit SHAs. Returns commits from newest to oldest based on git history.

type Trackable

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

Trackable represents a trackable reference point in a git repository. It is an immutable value object that identifies a specific point in git history.

func NewTrackable

func NewTrackable(refType ReferenceType, identifier string, repoID int64) Trackable

NewTrackable creates a new Trackable.

func (Trackable) Identifier

func (t Trackable) Identifier() string

Identifier returns the identifier (branch name, tag name, or commit SHA).

func (Trackable) IsBranch

func (t Trackable) IsBranch() bool

IsBranch returns true if this is a branch reference.

func (Trackable) IsCommitSHA

func (t Trackable) IsCommitSHA() bool

IsCommitSHA returns true if this is a direct commit SHA reference.

func (Trackable) IsTag

func (t Trackable) IsTag() bool

IsTag returns true if this is a tag reference.

func (Trackable) RepoID

func (t Trackable) RepoID() int64

RepoID returns the repository ID.

func (Trackable) Type

func (t Trackable) Type() ReferenceType

Type returns the reference type (branch, tag, or commit_sha).

Jump to

Keyboard shortcuts

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