Documentation
¶
Overview ¶
Package store opens metrics.sqlite, applies the DDL, and exposes prepared inserts for the canonical tables.
Index ¶
- type BuildJobsBatch
- type BuildsBatch
- type CommitCoauthorsBatch
- type CommitFilesBatch
- type CommitsBatch
- type FileComplexityHistoryBatch
- type FileMetricsBatch
- type PRCommentsBatch
- type PRCommitsBatch
- type PRLabelsBatch
- type PRsBatch
- type RepoFilesBatch
- type ReviewsBatch
- type Store
- func (s *Store) BeginBuildJobsBatch() (*BuildJobsBatch, error)
- func (s *Store) BeginBuildsBatch() (*BuildsBatch, error)
- func (s *Store) BeginCommitCoauthorsBatch() (*CommitCoauthorsBatch, error)
- func (s *Store) BeginCommitFilesBatch() (*CommitFilesBatch, error)
- func (s *Store) BeginCommitsBatch() (*CommitsBatch, error)
- func (s *Store) BeginFileComplexityHistoryBatch() (*FileComplexityHistoryBatch, error)
- func (s *Store) BeginFileMetricsBatch() (*FileMetricsBatch, error)
- func (s *Store) BeginPRCommentsBatch() (*PRCommentsBatch, error)
- func (s *Store) BeginPRCommitsBatch() (*PRCommitsBatch, error)
- func (s *Store) BeginPRLabelsBatch() (*PRLabelsBatch, error)
- func (s *Store) BeginPRsBatch() (*PRsBatch, error)
- func (s *Store) BeginRepoFilesBatch() (*RepoFilesBatch, error)
- func (s *Store) BeginReviewsBatch() (*ReviewsBatch, error)
- func (s *Store) Close() error
- func (s *Store) DB() *sql.DB
- func (s *Store) InsertBranch(b model.Branch) error
- func (s *Store) InsertBranchProtection(b model.BranchProtection) error
- func (s *Store) InsertBuild(b model.Build) error
- func (s *Store) InsertBuildJob(j model.BuildJob) error
- func (s *Store) InsertCodeowner(c model.Codeowner) error
- func (s *Store) InsertCommit(c model.Commit) error
- func (s *Store) InsertCommitCoauthor(c model.CommitCoauthor) error
- func (s *Store) InsertCommitFile(c model.CommitFile) error
- func (s *Store) InsertDefect(d model.Defect) error
- func (s *Store) InsertDeploy(d model.Deploy) error
- func (s *Store) InsertFileComplexityHistory(f model.FileComplexityHistory) error
- func (s *Store) InsertFileMetric(f model.FileMetric) error
- func (s *Store) InsertHarnessArtifact(h model.HarnessArtifact) error
- func (s *Store) InsertIncident(i model.Incident) error
- func (s *Store) InsertPR(p model.PR) error
- func (s *Store) InsertPRComment(c model.PRComment) error
- func (s *Store) InsertPRCommit(p model.PRCommit) error
- func (s *Store) InsertPRLabel(l model.PRLabel) error
- func (s *Store) InsertPRReviewRequest(r model.PRReviewRequest) error
- func (s *Store) InsertRelease(r model.Release) error
- func (s *Store) InsertRepo(r model.Repo) error
- func (s *Store) InsertRepoFile(f model.RepoFile) error
- func (s *Store) InsertRepoLanguage(r model.RepoLanguage) error
- func (s *Store) InsertReview(r model.Review) error
- func (s *Store) InsertTeamRepo(team, repo string) error
- func (s *Store) SquashStats() (nSquash, nMerged int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildJobsBatch ¶ added in v0.4.9
type BuildJobsBatch struct {
// contains filtered or unexported fields
}
BuildJobsBatch buffers model.BuildJob rows.
func (*BuildJobsBatch) Commit ¶ added in v0.4.9
func (b *BuildJobsBatch) Commit() (int, error)
type BuildsBatch ¶ added in v0.4.9
type BuildsBatch struct {
// contains filtered or unexported fields
}
BuildsBatch buffers model.Build rows.
func (*BuildsBatch) Commit ¶ added in v0.4.9
func (b *BuildsBatch) Commit() (int, error)
type CommitCoauthorsBatch ¶ added in v0.4.9
type CommitCoauthorsBatch struct {
// contains filtered or unexported fields
}
CommitCoauthorsBatch buffers model.CommitCoauthor rows.
func (*CommitCoauthorsBatch) Add ¶ added in v0.4.9
func (b *CommitCoauthorsBatch) Add(c model.CommitCoauthor) error
func (*CommitCoauthorsBatch) Commit ¶ added in v0.4.9
func (b *CommitCoauthorsBatch) Commit() (int, error)
type CommitFilesBatch ¶ added in v0.4.9
type CommitFilesBatch struct {
// contains filtered or unexported fields
}
CommitFilesBatch buffers model.CommitFile rows for the commit_files table.
func (*CommitFilesBatch) Add ¶ added in v0.4.9
func (b *CommitFilesBatch) Add(c model.CommitFile) error
func (*CommitFilesBatch) Commit ¶ added in v0.4.9
func (b *CommitFilesBatch) Commit() (int, error)
type CommitsBatch ¶ added in v0.4.9
type CommitsBatch struct {
// contains filtered or unexported fields
}
CommitsBatch buffers model.Commit rows for the commits table.
func (*CommitsBatch) Commit ¶ added in v0.4.9
func (b *CommitsBatch) Commit() (int, error)
type FileComplexityHistoryBatch ¶ added in v0.4.9
type FileComplexityHistoryBatch struct {
// contains filtered or unexported fields
}
FileComplexityHistoryBatch buffers model.FileComplexityHistory rows for the largest hot table.
func (*FileComplexityHistoryBatch) Add ¶ added in v0.4.9
func (b *FileComplexityHistoryBatch) Add(f model.FileComplexityHistory) error
func (*FileComplexityHistoryBatch) Commit ¶ added in v0.4.9
func (b *FileComplexityHistoryBatch) Commit() (int, error)
type FileMetricsBatch ¶ added in v0.4.9
type FileMetricsBatch struct {
// contains filtered or unexported fields
}
FileMetricsBatch buffers model.FileMetric rows.
func (*FileMetricsBatch) Add ¶ added in v0.4.9
func (b *FileMetricsBatch) Add(f model.FileMetric) error
func (*FileMetricsBatch) Commit ¶ added in v0.4.9
func (b *FileMetricsBatch) Commit() (int, error)
type PRCommentsBatch ¶ added in v0.4.9
type PRCommentsBatch struct {
// contains filtered or unexported fields
}
PRCommentsBatch buffers model.PRComment rows.
func (*PRCommentsBatch) Add ¶ added in v0.4.9
func (b *PRCommentsBatch) Add(c model.PRComment) error
func (*PRCommentsBatch) Commit ¶ added in v0.4.9
func (b *PRCommentsBatch) Commit() (int, error)
type PRCommitsBatch ¶ added in v0.4.9
type PRCommitsBatch struct {
// contains filtered or unexported fields
}
PRCommitsBatch buffers model.PRCommit rows.
func (*PRCommitsBatch) Commit ¶ added in v0.4.9
func (b *PRCommitsBatch) Commit() (int, error)
type PRLabelsBatch ¶ added in v0.4.9
type PRLabelsBatch struct {
// contains filtered or unexported fields
}
PRLabelsBatch buffers model.PRLabel rows.
func (*PRLabelsBatch) Commit ¶ added in v0.4.9
func (b *PRLabelsBatch) Commit() (int, error)
type PRsBatch ¶ added in v0.4.9
type PRsBatch struct {
// contains filtered or unexported fields
}
PRsBatch buffers model.PR rows for the prs table.
type RepoFilesBatch ¶ added in v0.4.9
type RepoFilesBatch struct {
// contains filtered or unexported fields
}
RepoFilesBatch buffers model.RepoFile rows.
func (*RepoFilesBatch) Commit ¶ added in v0.4.9
func (b *RepoFilesBatch) Commit() (int, error)
type ReviewsBatch ¶ added in v0.4.9
type ReviewsBatch struct {
// contains filtered or unexported fields
}
ReviewsBatch buffers model.Review rows.
func (*ReviewsBatch) Commit ¶ added in v0.4.9
func (b *ReviewsBatch) Commit() (int, error)
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps a SQLite database and implements connector.Sink with prepared insert statements. Concurrent connector workers share one Store; per-call inserts are serialised behind a mutex so the single connection writer is safe.
func Open ¶
Open opens (or creates) a SQLite database at path, applies the canonical DDL, records a _schema row capturing the schema and tool versions, and prepares one insert statement per Sink method.
func (*Store) BeginBuildJobsBatch ¶ added in v0.4.9
func (s *Store) BeginBuildJobsBatch() (*BuildJobsBatch, error)
func (*Store) BeginBuildsBatch ¶ added in v0.4.9
func (s *Store) BeginBuildsBatch() (*BuildsBatch, error)
func (*Store) BeginCommitCoauthorsBatch ¶ added in v0.4.9
func (s *Store) BeginCommitCoauthorsBatch() (*CommitCoauthorsBatch, error)
func (*Store) BeginCommitFilesBatch ¶ added in v0.4.9
func (s *Store) BeginCommitFilesBatch() (*CommitFilesBatch, error)
func (*Store) BeginCommitsBatch ¶ added in v0.4.9
func (s *Store) BeginCommitsBatch() (*CommitsBatch, error)
BeginCommitsBatch opens a new buffered batch for the commits table. The returned handle must have Commit() (or Rollback()) called by the caller; defer Rollback() is safe and idempotent.
func (*Store) BeginFileComplexityHistoryBatch ¶ added in v0.4.9
func (s *Store) BeginFileComplexityHistoryBatch() (*FileComplexityHistoryBatch, error)
func (*Store) BeginFileMetricsBatch ¶ added in v0.4.9
func (s *Store) BeginFileMetricsBatch() (*FileMetricsBatch, error)
func (*Store) BeginPRCommentsBatch ¶ added in v0.4.9
func (s *Store) BeginPRCommentsBatch() (*PRCommentsBatch, error)
func (*Store) BeginPRCommitsBatch ¶ added in v0.4.9
func (s *Store) BeginPRCommitsBatch() (*PRCommitsBatch, error)
func (*Store) BeginPRLabelsBatch ¶ added in v0.4.9
func (s *Store) BeginPRLabelsBatch() (*PRLabelsBatch, error)
func (*Store) BeginPRsBatch ¶ added in v0.4.9
func (*Store) BeginRepoFilesBatch ¶ added in v0.4.9
func (s *Store) BeginRepoFilesBatch() (*RepoFilesBatch, error)
func (*Store) BeginReviewsBatch ¶ added in v0.4.9
func (s *Store) BeginReviewsBatch() (*ReviewsBatch, error)
func (*Store) Close ¶
Close releases prepared statements and the underlying database handle. Closing the last connection in WAL mode checkpoints the WAL into the main database file, so metrics.sqlite holds every committed row by the time the archiver reads it (relied on by both the happy path and the partial-finalize path in internal/run, issue #183).
func (*Store) DB ¶
DB exposes the underlying *sql.DB for cross-cutting passes (postprocess linkage) that need to issue UPDATEs against multiple tables. The store's mutex does not guard direct DB access; callers must coordinate with other writers, which in practice means using DB only after all connector extraction has finished.
func (*Store) InsertBranchProtection ¶
func (s *Store) InsertBranchProtection(b model.BranchProtection) error
func (*Store) InsertCommitCoauthor ¶
func (s *Store) InsertCommitCoauthor(c model.CommitCoauthor) error
func (*Store) InsertCommitFile ¶
func (s *Store) InsertCommitFile(c model.CommitFile) error
func (*Store) InsertFileComplexityHistory ¶
func (s *Store) InsertFileComplexityHistory(f model.FileComplexityHistory) error
func (*Store) InsertFileMetric ¶
func (s *Store) InsertFileMetric(f model.FileMetric) error
func (*Store) InsertHarnessArtifact ¶
func (s *Store) InsertHarnessArtifact(h model.HarnessArtifact) error
func (*Store) InsertPRReviewRequest ¶
func (s *Store) InsertPRReviewRequest(r model.PRReviewRequest) error
func (*Store) InsertRepoLanguage ¶
func (s *Store) InsertRepoLanguage(r model.RepoLanguage) error
func (*Store) InsertTeamRepo ¶
func (*Store) SquashStats ¶
SquashStats returns counts of merged PRs and squash-merged PRs across the entire artifact. Used by run.go after extraction to populate the manifest's `n_total_merged_prs` / `n_squash_merged_prs` / `squash_rate` fields; assay treats squash_rate > 0.5 as the Tornhill Ch 9 caveat threshold for coupling-derived metrics.
merge_method classification is per ADR 021 (parent count + PR-head reachability), already computed at extract time and stored in the prs.merge_method column — no re-derivation here.