Documentation
¶
Index ¶
- Constants
- func DeleteGarbage(ctx context.Context, client spannerclient.SpannerClient) (int64, error)
- func FilesCoverageStream(ctx context.Context, client spannerclient.SpannerClient, ns string, ...) (<-chan *FileCoverageWithLineInfo, <-chan error)
- func IsComparable(fullLines, fullHitCounts, partialLines, partialHitCounts []int64) bool
- func MakeCovMap(keys, vals []int64) map[int]int64
- func MinMaxDays(periodType string) (int, int, error)
- func PeriodOps(periodType string) (periodOps, error)
- func ReadLinesHitCount(ctx context.Context, client spannerclient.SpannerClient, ...) ([]int64, []int64, error)
- func SaveMergeResult(ctx context.Context, client spannerclient.SpannerClient, descr *HistoryRecord, ...) (int, error)
- func UniqCoverage(fullCov, partCov map[int]int64) map[int]int64
- type Coverage
- type DayPeriodOps
- type FileCoverageWithDetails
- type FileCoverageWithLineInfo
- type FuncLines
- type FunctionFinder
- type HistoryRecord
- type JSONLWrapper
- type LinesCoverage
- type MergedCoverageRecord
- type MonthPeriodOps
- type QuarterPeriodOps
- type SelectScope
- type TimePeriod
- func AtMostNLatestPeriods(periods []TimePeriod, n int) []TimePeriod
- func GenNPeriodsTill(n int, d civil.Date, periodType string) ([]TimePeriod, error)
- func MakeTimePeriod(targetDate civil.Date, periodType string) (TimePeriod, error)
- func NsDataMerged(ctx context.Context, client spannerclient.SpannerClient, ns string) ([]TimePeriod, []int64, error)
- func PeriodsToMerge(srcDates, mergedPeriods []TimePeriod, srcRows, mergedRows []int64, ...) []TimePeriod
Constants ¶
const ( DayPeriod = "day" MonthPeriod = "month" QuarterPeriod = "quarter" )
Variables ¶
This section is empty.
Functions ¶
func DeleteGarbage ¶
func DeleteGarbage(ctx context.Context, client spannerclient.SpannerClient) (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 FilesCoverageStream ¶
func FilesCoverageStream(ctx context.Context, client spannerclient.SpannerClient, ns string, timePeriod TimePeriod, ) (<-chan *FileCoverageWithLineInfo, <-chan error)
FilesCoverageStream streams information about all the line coverage. It is expensive and better to be used for time insensitive operations.
func IsComparable ¶
func MakeCovMap ¶
func ReadLinesHitCount ¶
func ReadLinesHitCount(ctx context.Context, client spannerclient.SpannerClient, ns, commit, file, manager string, tp TimePeriod, ) ([]int64, []int64, 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 ¶
type DayPeriodOps ¶
type DayPeriodOps struct{}
func (*DayPeriodOps) IsValidPeriod ¶
func (dpo *DayPeriodOps) IsValidPeriod(p TimePeriod) bool
type FileCoverageWithDetails ¶
type FileCoverageWithDetails struct { Subsystem string Filepath string Instrumented int64 Covered int64 TimePeriod TimePeriod `spanner:"-"` Commit string Subsystems []string }
func FilesCoverageWithDetails ¶
func FilesCoverageWithDetails( ctx context.Context, client spannerclient.SpannerClient, scope *SelectScope, onlyUnique bool, ) ([]*FileCoverageWithDetails, error)
FilesCoverageWithDetails fetches the data directly from DB. No caching. Flag onlyUnique is quite expensive.
type FileCoverageWithLineInfo ¶
type FileCoverageWithLineInfo struct { FileCoverageWithDetails LinesInstrumented []int64 HitCounts []int64 }
func (*FileCoverageWithLineInfo) CovMap ¶
func (fc *FileCoverageWithLineInfo) CovMap() map[int]int64
type FuncLines ¶
type FuncLines struct { FilePath string FuncName string Lines []int64 // List of lines we know belong to this function name according to the addr2line output. }
FuncLines represents the 'functions' table records. It could be used to maps 'hitcounts' from 'files' table to the function names.
type FunctionFinder ¶
type FunctionFinder struct {
// contains filtered or unexported fields
}
func MakeFuncFinder ¶
func MakeFuncFinder(ctx context.Context, client spannerclient.SpannerClient, ns string, timePeriod TimePeriod, ) (*FunctionFinder, error)
func (*FunctionFinder) FileLineToFuncName ¶
func (ff *FunctionFinder) FileLineToFuncName(filePath string, line int) (string, error)
type HistoryRecord ¶
type JSONLWrapper ¶
type JSONLWrapper struct { MCR *MergedCoverageRecord FL *FuncLines }
type LinesCoverage ¶
type MergedCoverageRecord ¶
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 SelectScope ¶
type SelectScope struct { Ns string Subsystem string Manager string Periods []TimePeriod }
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 MakeTimePeriod ¶
func MakeTimePeriod(targetDate civil.Date, periodType string) (TimePeriod, error)
func NsDataMerged ¶
func NsDataMerged(ctx context.Context, client spannerclient.SpannerClient, 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].