Documentation
¶
Overview ¶
Package feed is the desktop's GitHub fetch layer: the wire Item type and a cached, coalesced LiveProvider the pipeline producer uses to turn a source into event_log rows. The old profiles/feeds config machinery folded into the flow graph (internal/desktop/pipeline/flow); what remains here is the GitHub fetch core.
Index ¶
Constants ¶
const ( // DefaultPollInterval is how often the pipeline producer ticks; matches // the settings design's default ("Every 60s"). DefaultPollInterval = time.Minute )
Variables ¶
var ErrNotAuthenticated = errors.New("feed: not authenticated")
ErrNotAuthenticated is returned when no GitHub token is available.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct {
ID string `json:"id"`
Kind string `json:"kind"` // "PR" | "Issue"
Repo string `json:"repo"`
Num int `json:"num"`
Title string `json:"title"`
Author string `json:"author"`
Age string `json:"age"`
Unread bool `json:"unread"`
// Reason is the GitHub notification reason (e.g. "review_requested"),
// empty for items known only from search.
Reason string `json:"reason,omitempty"`
Labels []string `json:"labels"`
Branch string `json:"branch"`
Body string `json:"body"`
Prompt string `json:"prompt"`
URL string `json:"url"`
}
Item is a normalized GitHub item (PR or issue) produced by a source fetch. It is JSON-encoded as a source node's event_log payload and re-surfaced as a feed_item, so the frontend and the persisted feed both read this shape.
type LiveProvider ¶
type LiveProvider struct {
// contains filtered or unexported fields
}
LiveProvider fetches source items from the GitHub API with per-source caching and singleflight coalescing. It is the seam the desktop pipeline producer uses to turn a github-source node into event_log rows — the only GitHub-fetch implementation in the desktop.
func NewLiveProvider ¶
func NewLiveProvider(client *github.Client, tokens github.TokenStore, logger zerolog.Logger) *LiveProvider
func (*LiveProvider) Invalidate ¶
func (p *LiveProvider) Invalidate()
Invalidate drops the fetch cache so the next call refetches. Auth changes call it: a different account must never be served the previous token's data.
func (*LiveProvider) SourceItems ¶
SourceItems returns one source's current items — served from cache within the fetch TTL, otherwise fetched via the conditional, singleflight-coalesced path (see sourceItems/fetchSource).
type SourceDef ¶
type SourceDef struct {
ID string `json:"id"`
Kind string `json:"kind"` // "search" | "notifications"
Query string `json:"query,omitempty"`
// Limit bounds items per fetch. 0 uses defaultSourceLimit.
Limit int `json:"limit,omitempty"`
}
SourceDef is one GitHub fetch request. It is no longer a config entry — the github-source flow node embeds these fields — but it survives as the value type LiveProvider.SourceItems takes and caches on (keyed by kind+query+limit via sourceKey), so any number of source nodes requesting the same data share one API request.