Documentation
¶
Overview ¶
Package budget builds the REST budget view: how much of GitHub's REST quota is left, until when, and who spent it. agentscope reads and never spends: the only things read are the call ledger (a local file, ghbudget.ReadLedger) and, at most once per MinInterval per token and only when the ledger holds no fresher reading, GET /rate_limit, which GitHub does not count against the limit. No other endpoint is ever requested.
A token is read only to be sent in the Authorization header and fingerprinted; it is never kept, logged, or put in the view.
Index ¶
Constants ¶
const APIBase = "https://api.github.com"
APIBase is GitHub's REST root.
const MaxLedger = 1 << 20
MaxLedger bounds what is read of the ledger.
const MinInterval = 60 * time.Second
MinInterval is the least time between two GET /rate_limit of one token.
const RefreshEvery = 10 * time.Second
RefreshEvery is how often Run rebuilds the view. Reading the ledger is a local file read; the /rate_limit call it may trigger is bounded by MinInterval.
const Window = time.Hour
Window is how far back the ledger is attributed.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
LedgerPath string // default ghbudget.DefaultLedgerPath()
TokenFile string // default ghauth.DefaultPath()
Base string // default APIBase
Client *http.Client
Now func() time.Time
}
Config is where the engine reads. Zero values take the defaults.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine builds the view.