Documentation
¶
Index ¶
- type Cache
- type CacheEntry
- type JSONCache
- func (c *JSONCache) Close() error
- func (c *JSONCache) GetCODEOWNERS(ctx context.Context, owner, repo string) ([]byte, error)
- func (c *JSONCache) GetPRFiles(ctx context.Context, owner, repo string, prNumber int) ([]*github.CommitFile, error)
- func (c *JSONCache) GetPRs(ctx context.Context, owner, repo string, since, until time.Time) ([]*github.PullRequest, error)
- func (c *JSONCache) GetRepos(ctx context.Context, org string) ([]*github.Repository, error)
- func (c *JSONCache) Invalidate(ctx context.Context) error
- func (c *JSONCache) InvalidateRepo(ctx context.Context, owner, repo string) error
- func (c *JSONCache) SetCODEOWNERS(ctx context.Context, owner, repo string, content []byte) error
- func (c *JSONCache) SetPRFiles(ctx context.Context, owner, repo string, prNumber int, ...) error
- func (c *JSONCache) SetPRs(ctx context.Context, owner, repo string, prs []*github.PullRequest) error
- func (c *JSONCache) SetRepos(ctx context.Context, org string, repos []*github.Repository) error
- type SQLiteCache
- func (c *SQLiteCache) Close() error
- func (c *SQLiteCache) GetCODEOWNERS(ctx context.Context, owner, repo string) ([]byte, error)
- func (c *SQLiteCache) GetPRFiles(ctx context.Context, owner, repo string, prNumber int) ([]*github.CommitFile, error)
- func (c *SQLiteCache) GetPRs(ctx context.Context, owner, repo string, since, until time.Time) ([]*github.PullRequest, error)
- func (c *SQLiteCache) GetRepos(ctx context.Context, org string) ([]*github.Repository, error)
- func (c *SQLiteCache) Invalidate(ctx context.Context) error
- func (c *SQLiteCache) InvalidateRepo(ctx context.Context, owner, repo string) error
- func (c *SQLiteCache) SetCODEOWNERS(ctx context.Context, owner, repo string, content []byte) error
- func (c *SQLiteCache) SetPRFiles(ctx context.Context, owner, repo string, prNumber int, ...) error
- func (c *SQLiteCache) SetPRs(ctx context.Context, owner, repo string, prs []*github.PullRequest) error
- func (c *SQLiteCache) SetRepos(ctx context.Context, org string, repos []*github.Repository) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// GetRepos retrieves cached repositories
GetRepos(ctx context.Context, org string) ([]*github.Repository, error)
// SetRepos caches repositories
SetRepos(ctx context.Context, org string, repos []*github.Repository) error
// GetCODEOWNERS retrieves cached CODEOWNERS file
GetCODEOWNERS(ctx context.Context, owner, repo string) ([]byte, error)
// SetCODEOWNERS caches CODEOWNERS file
SetCODEOWNERS(ctx context.Context, owner, repo string, content []byte) error
// GetPRs retrieves cached PRs for a repository, filtered by time window
GetPRs(ctx context.Context, owner, repo string, since, until time.Time) ([]*github.PullRequest, error)
// SetPRs caches PRs for a repository (stores individual PRs by ID)
SetPRs(ctx context.Context, owner, repo string, prs []*github.PullRequest) error
// GetPRFiles retrieves cached PR files
GetPRFiles(ctx context.Context, owner, repo string, prNumber int) ([]*github.CommitFile, error)
// SetPRFiles caches PR files
SetPRFiles(ctx context.Context, owner, repo string, prNumber int, files []*github.CommitFile) error
// Invalidate invalidates all cache entries
Invalidate(ctx context.Context) error
// InvalidateRepo invalidates cache for a specific repository
InvalidateRepo(ctx context.Context, owner, repo string) error
// Close closes the cache
Close() error
}
Cache interface for different cache backends
type CacheEntry ¶
type CacheEntry struct {
Data interface{} `json:"data"`
Timestamp time.Time `json:"timestamp"`
TTL time.Duration
}
CacheEntry represents a cached entry with metadata
type JSONCache ¶
type JSONCache struct {
// contains filtered or unexported fields
}
JSONCache implements cache using JSON files
func NewJSONCache ¶
func NewJSONCache(baseDir string, ttl time.Duration, ignoreTTL bool, logger *zap.Logger) (*JSONCache, error)
NewJSONCache creates a new JSON file cache
func (*JSONCache) GetCODEOWNERS ¶
GetCODEOWNERS retrieves cached CODEOWNERS file
func (*JSONCache) GetPRFiles ¶
func (c *JSONCache) GetPRFiles(ctx context.Context, owner, repo string, prNumber int) ([]*github.CommitFile, error)
GetPRFiles retrieves cached PR files
func (*JSONCache) GetPRs ¶
func (c *JSONCache) GetPRs(ctx context.Context, owner, repo string, since, until time.Time) ([]*github.PullRequest, error)
GetPRs retrieves cached PRs for a repository, filtered by time window
func (*JSONCache) Invalidate ¶
Invalidate invalidates all cache entries
func (*JSONCache) InvalidateRepo ¶
InvalidateRepo invalidates cache for a specific repository
func (*JSONCache) SetCODEOWNERS ¶
SetCODEOWNERS caches CODEOWNERS file
func (*JSONCache) SetPRFiles ¶
func (c *JSONCache) SetPRFiles(ctx context.Context, owner, repo string, prNumber int, files []*github.CommitFile) error
SetPRFiles caches PR files
type SQLiteCache ¶
type SQLiteCache struct {
// contains filtered or unexported fields
}
SQLiteCache implements cache using SQLite
func NewSQLiteCache ¶
func NewSQLiteCache(dbPath string, ttl time.Duration, ignoreTTL bool, logger *zap.Logger) (*SQLiteCache, error)
NewSQLiteCache creates a new SQLite cache
func (*SQLiteCache) GetCODEOWNERS ¶
GetCODEOWNERS retrieves cached CODEOWNERS file
func (*SQLiteCache) GetPRFiles ¶
func (c *SQLiteCache) GetPRFiles(ctx context.Context, owner, repo string, prNumber int) ([]*github.CommitFile, error)
GetPRFiles retrieves cached PR files
func (*SQLiteCache) GetPRs ¶
func (c *SQLiteCache) GetPRs(ctx context.Context, owner, repo string, since, until time.Time) ([]*github.PullRequest, error)
GetPRs retrieves cached PRs for a repository, filtered by time window
func (*SQLiteCache) GetRepos ¶
func (c *SQLiteCache) GetRepos(ctx context.Context, org string) ([]*github.Repository, error)
GetRepos retrieves cached repositories
func (*SQLiteCache) Invalidate ¶
func (c *SQLiteCache) Invalidate(ctx context.Context) error
Invalidate invalidates all cache entries
func (*SQLiteCache) InvalidateRepo ¶
func (c *SQLiteCache) InvalidateRepo(ctx context.Context, owner, repo string) error
InvalidateRepo invalidates cache for a specific repository
func (*SQLiteCache) SetCODEOWNERS ¶
SetCODEOWNERS caches CODEOWNERS file
func (*SQLiteCache) SetPRFiles ¶
func (c *SQLiteCache) SetPRFiles(ctx context.Context, owner, repo string, prNumber int, files []*github.CommitFile) error
SetPRFiles caches PR files
func (*SQLiteCache) SetPRs ¶
func (c *SQLiteCache) SetPRs(ctx context.Context, owner, repo string, prs []*github.PullRequest) error
SetPRs caches PRs for a repository (stores individual PRs by ID)
func (*SQLiteCache) SetRepos ¶
func (c *SQLiteCache) SetRepos(ctx context.Context, org string, repos []*github.Repository) error
SetRepos caches repositories