client

package
v0.0.0-...-746469e Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: Apache-2.0 Imports: 16 Imported by: 4 modules, 18 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

View Source
const (
	UpgradesEndpoint    = "/upgrades"
	StateReportEndpoint = "/report"
)

Variables

View Source
var ErrMaxRedirect = errors.New("Exceeded max redirects")

Functions

This section is empty.

Types

type ApiClient

type ApiClient struct {
	http.Client
	// contains filtered or unexported fields
}

func NewApiClient

func NewApiClient(server string) *ApiClient

func (*ApiClient) Request

func (client *ApiClient) Request() *ApiRequest

type ApiRequest

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

func (*ApiRequest) Client

func (r *ApiRequest) Client() *ApiClient

func (*ApiRequest) Do

func (r *ApiRequest) Do(req *http.Request) (*http.Response, error)

type ApiRequester

type ApiRequester interface {
	Client() *ApiClient
	Do(req *http.Request) (*http.Response, error)
}

type ReportClient

type ReportClient struct {
}

func NewReportClient

func NewReportClient() *ReportClient

func (*ReportClient) ReportState

func (u *ReportClient) ReportState(api ApiRequester, packageUID string, previousState string, state string, errorMessage string, fm metadata.FirmwareMetadata) error

type Reporter

type Reporter interface {
	ReportState(api ApiRequester, packageUID string, previousState string, state string, errorMessage string, fm metadata.FirmwareMetadata) error
}

type UpdateClient

type UpdateClient struct {
}

func NewUpdateClient

func NewUpdateClient() *UpdateClient

func (*UpdateClient) DownloadUpdate

func (u *UpdateClient) DownloadUpdate(api ApiRequester, uri string, cr *httptoo.BytesContentRange) (io.ReadCloser, int64, error)

func (*UpdateClient) GetUpdateContentRange

func (u *UpdateClient) GetUpdateContentRange(api ApiRequester, uri string, start int64) (*httptoo.BytesContentRange, error)

func (*UpdateClient) ProbeUpdate

func (u *UpdateClient) ProbeUpdate(api ApiRequester, uri string, data interface{}) (interface{}, []byte, time.Duration, error)

type Updater

type Updater interface {
	ProbeUpdate(api ApiRequester, uri string, data interface{}) (interface{}, []byte, time.Duration, error)
	DownloadUpdate(api ApiRequester, uri string, cr *httptoo.BytesContentRange) (io.ReadCloser, int64, error)
	GetUpdateContentRange(api ApiRequester, uri string, start int64) (*httptoo.BytesContentRange, error)
}

Jump to

Keyboard shortcuts

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