Documentation
¶
Index ¶
- type Cache
- type DiskStore
- func (d *DiskStore) LoadAllBuilds() ([]jenkins.UserBuild, error)
- func (d *DiskStore) LoadJobs(folderPath string) ([]jenkins.Job, error)
- func (d *DiskStore) LoadStages(key string) ([]jenkins.Stage, error)
- func (d *DiskStore) LoadTestReport(key string) (*jenkins.TestReport, error)
- func (d *DiskStore) SaveAllBuilds(builds []jenkins.UserBuild) error
- func (d *DiskStore) SaveJobs(folderPath string, jobs []jenkins.Job) error
- func (d *DiskStore) SaveStages(key string, stages []jenkins.Stage) error
- func (d *DiskStore) SaveTestReport(key string, report *jenkins.TestReport) error
- type Entry
- type NodeLogSnapshot
- type StageLogKey
- type Store
- func (s *Store) ClearDirtyBuilds(jobPath string)
- func (s *Store) ClearDirtyJobs(folderPath string)
- func (s *Store) IsDirtyBuilds(jobPath string) bool
- func (s *Store) IsDirtyJobs(folderPath string) bool
- func (s *Store) MarkBuildsDirty(jobPath string)
- func (s *Store) MarkJobsDirty(folderPath string)
- func (s *Store) TotalEntries() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable, V any] struct { // contains filtered or unexported fields }
Cache is a generic, mutex-protected, LRU-evicting cache.
func New ¶
func New[K comparable, V any](maxItems int) *Cache[K, V]
New creates a Cache with the given maximum capacity. Pass 0 for unlimited entries (no eviction).
type DiskStore ¶
type DiskStore struct {
// contains filtered or unexported fields
}
DiskStore persists immutable build data to disk using gob encoding. Data is stored under dir, one file per domain.
Concurrency: a mutex guards all read-modify-write operations so multiple goroutines (completion cascade cmds) can call Save* concurrently.
func NewDiskStore ¶
NewDiskStore creates a DiskStore rooted at dir, creating the directory if needed.
func (*DiskStore) LoadAllBuilds ¶
LoadAllBuilds reads all completed builds from disk.
func (*DiskStore) LoadStages ¶
LoadStages returns the cached stages for the given key ("jobPath:buildNum").
func (*DiskStore) LoadTestReport ¶
func (d *DiskStore) LoadTestReport(key string) (*jenkins.TestReport, error)
LoadTestReport returns the cached test report for the given key ("jobPath:buildNum").
func (*DiskStore) SaveAllBuilds ¶
SaveAllBuilds atomically writes the full build list to disk.
func (*DiskStore) SaveJobs ¶
SaveJobs persists the job listing for a single folder (read-modify-write).
func (*DiskStore) SaveStages ¶
SaveStages persists stages for a single build (read-modify-write on the shared map file).
func (*DiskStore) SaveTestReport ¶
func (d *DiskStore) SaveTestReport(key string, report *jenkins.TestReport) error
SaveTestReport persists a test report for a single build (read-modify-write).
type NodeLogSnapshot ¶
NodeLogSnapshot holds the progressive log state for a single flow node.
type StageLogKey ¶
StageLogKey uniquely identifies a node log within a build.
type Store ¶
type Store struct {
Jobs *Cache[string, []jenkins.Job] // key: folderPath
Builds *Cache[string, []jenkins.Build] // key: jobPath
ProjectBuilds *Cache[string, []jenkins.ProjectBuild] // key: projectPath
Stages *Cache[string, []jenkins.Stage] // key: "jobPath:buildNum"
NodeLogs *Cache[StageLogKey, NodeLogSnapshot] // LRU(200)
RunningBuilds *Cache[string, []jenkins.UserBuild] // singleton key ""
AllBuilds *Cache[string, []jenkins.UserBuild] // singleton key ""; from ScanAllBuilds
WhenSkipped *Cache[string, map[string][]bool] // key: "jobPath:buildNum"
TestReports *Cache[string, *jenkins.TestReport] // key: "jobPath:buildNum"
BuildDetail *Cache[string, jenkins.Build] // key: "jobPath:buildNum"
Disk *DiskStore // nil when disk persistence is disabled
// contains filtered or unexported fields
}
Store is the app-wide cache container shared by all views.
func NewStore ¶
NewStore creates a Store with sensible defaults. disk may be nil to disable persistence.
func (*Store) ClearDirtyBuilds ¶
ClearDirtyBuilds clears the dirty flag for jobPath.
func (*Store) ClearDirtyJobs ¶
ClearDirtyJobs clears the dirty flag for folderPath.
func (*Store) IsDirtyBuilds ¶
IsDirtyBuilds reports whether the Builds cache for jobPath is stale.
func (*Store) IsDirtyJobs ¶
IsDirtyJobs reports whether the Jobs cache for folderPath is stale.
func (*Store) MarkBuildsDirty ¶
MarkBuildsDirty marks the Builds cache for jobPath as stale.
func (*Store) MarkJobsDirty ¶
MarkJobsDirty marks the Jobs cache for folderPath as stale.
func (*Store) TotalEntries ¶
TotalEntries returns the sum of all cache sizes across the store.