coveragedb

package
v0.0.0-...-0f61b41 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DayPeriod     = "day"
	MonthPeriod   = "month"
	QuarterPeriod = "quarter"
)

Variables

This section is empty.

Functions

func DeleteGarbage

func DeleteGarbage(ctx context.Context) (int64, error)

DeleteGarbage removes orphaned file entries from the database.

It identifies files in the "files" table that are not referenced by any entries in the "merge_history" table, indicating they are no longer associated with an active merge session.

To avoid exceeding Spanner transaction limits, orphaned files are deleted in batches of 10,000. Note that in case of an error during batch deletion, some files may be deleted but not counted in the total.

Returns the number of orphaned file entries successfully deleted.

func MinMaxDays

func MinMaxDays(periodType string) (int, int, error)

func PeriodOps

func PeriodOps(periodType string) (periodOps, error)

func ReadLinesHitCount

func ReadLinesHitCount(ctx context.Context, ns, commit, file string, tp TimePeriod,
) (map[int]int, error)

func SaveMergeResult

func SaveMergeResult(ctx context.Context, client spannerclient.SpannerClient, descr *HistoryRecord, dec *json.Decoder,
	sss []*subsystem.Subsystem) (int, error)

Types

type Coverage

type Coverage struct {
	Instrumented      int64
	Covered           int64
	LinesInstrumented []int64
	HitCounts         []int64
}

func (*Coverage) AddLineHitCount

func (c *Coverage) AddLineHitCount(line, hitCount int)

type DayPeriodOps

type DayPeriodOps struct{}

func (*DayPeriodOps) IsValidPeriod

func (dpo *DayPeriodOps) IsValidPeriod(p TimePeriod) bool

type FileSubsystems

type FileSubsystems struct {
	Namespace  string
	FilePath   string
	Subsystems []string
}

type FilesRecord

type FilesRecord struct {
	Session           string
	FilePath          string
	Instrumented      int64
	Covered           int64
	LinesInstrumented []int64
	HitCounts         []int64
	Manager           string // "*" means "collected from all managers"
}

type HistoryRecord

type HistoryRecord struct {
	Session   string
	Time      time.Time
	Namespace string
	Repo      string
	Commit    string
	Duration  int64
	DateTo    civil.Date
	TotalRows int64
}

type MergedCoverageRecord

type MergedCoverageRecord struct {
	Manager  string
	FilePath string
	FileData *Coverage
}

type MonthPeriodOps

type MonthPeriodOps struct{}

func (*MonthPeriodOps) IsValidPeriod

func (m *MonthPeriodOps) IsValidPeriod(p TimePeriod) bool

type QuarterPeriodOps

type QuarterPeriodOps struct{}

func (*QuarterPeriodOps) IsValidPeriod

func (q *QuarterPeriodOps) IsValidPeriod(p TimePeriod) bool

type TimePeriod

type TimePeriod struct {
	DateTo civil.Date
	Days   int
	Type   string // DayPeriod, MonthPeriod, QuarterPeriod.
}

func AtMostNLatestPeriods

func AtMostNLatestPeriods(periods []TimePeriod, n int) []TimePeriod

func GenNPeriodsTill

func GenNPeriodsTill(n int, d civil.Date, periodType string) ([]TimePeriod, error)

func MakeTimePeriod

func MakeTimePeriod(targetDate civil.Date, periodType string) (TimePeriod, error)

func NsDataMerged

func NsDataMerged(ctx context.Context, projectID, ns string) ([]TimePeriod, []int64, error)

func PeriodsToMerge

func PeriodsToMerge(srcDates, mergedPeriods []TimePeriod, srcRows, mergedRows []int64, ops periodOps) []TimePeriod

func (*TimePeriod) DatesFromTo

func (tp *TimePeriod) DatesFromTo() (civil.Date, civil.Date)

DatesFromTo returns the closed range [fromDate, toDate].

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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