githubobserver

package
v0.78.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(ctx context.Context, dir string, args ...string) ([]byte, error)

Types

type CommandResponse

type CommandResponse struct {
	Stdout   []byte
	Stderr   []byte
	ExitCode int
	Err      error
}

func Execute

func Execute(ctx context.Context, dir string, args ...string) CommandResponse

type GetRequest

type GetRequest struct {
	Dir         string
	Repository  string
	Target      string
	Head        string
	Endpoint    string
	Query       map[string]string
	Accept      string
	FreshWindow time.Duration
}

type Observer

type Observer struct {
	StateDir    string
	Now         func() time.Time
	Sleep       func(context.Context, time.Duration) error
	RandomIntn  func(int64) int64
	Run         func(context.Context, string, ...string) commandResult
	MaxAttempts int
	BaseBackoff time.Duration
	MaxBackoff  time.Duration
}

func Default

func Default() *Observer

func (*Observer) Execute

func (o *Observer) Execute(ctx context.Context, dir string, args ...string) CommandResponse

func (*Observer) Get

func (o *Observer) Get(ctx context.Context, request GetRequest) (response Response, err error)

func (*Observer) Read

func (o *Observer) Read(ctx context.Context, dir string, args ...string) ([]byte, error)

type Response

type Response struct {
	Body        []byte
	StatusCode  int
	Headers     map[string]string
	Cached      bool
	ObservedAt  time.Time
	CacheKey    string
	RequestHash string
}

func Get

func Get(ctx context.Context, request GetRequest) (Response, error)

Jump to

Keyboard shortcuts

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