github

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RetryAfter added in v1.1.0

func RetryAfter(err error) (time.Time, bool)

RetryAfter reports when a request refused for rate limiting may be repeated. A caller on a timer needs this to stop asking: retrying a spent budget on the usual interval is what turns one exhausted window into several.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client reads immutable repository snapshots through GitHub's Git data API.

func New

func New(token string) *Client

func (*Client) Materialize

func (c *Client) Materialize(ctx context.Context, repository serving.Repository, baseCommit string, record store.Annotation) (serving.Materialization, error)

func (*Client) Snapshot

func (c *Client) Snapshot(ctx context.Context, repository serving.Repository) (*application.RepositorySnapshot, error)

type RateLimit added in v1.1.0

type RateLimit struct {
	Limit     int
	Remaining int
	Used      int
	Resource  string

	// Reset is when the primary budget refills.
	Reset time.Time

	// RetryAfter is what a secondary limit asks for instead. GitHub sends it
	// on abuse detection, where Reset is absent and the only honest answer to
	// "when may I retry" is the number of seconds it just gave us.
	RetryAfter time.Duration
}

RateLimit is what GitHub said about the budget a response spent from. Every response carries it, including the successful ones, so a caller can see a limit approaching instead of only discovering it at zero.

func (RateLimit) Exhausted added in v1.1.0

func (r RateLimit) Exhausted() bool

Exhausted reports whether the budget is spent. A secondary limit reports no remaining count at all, so Retry-After alone is enough to mean "stop".

func (RateLimit) RecoversAt added in v1.1.0

func (r RateLimit) RecoversAt(now time.Time) time.Time

RecoversAt is the earliest a caller should try again. It never returns a time in the past for an exhausted budget, because a caller that treats "already reset" as "go ahead" is the caller that spends the next window in one burst.

func (RateLimit) String added in v1.1.0

func (r RateLimit) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL