publicapi

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIPrefix     = "requester/"
	ApprovalRoute = "approve"
	VerifyRoute   = "verify"
)
View Source
const APIRetryCount = 5

APIRetryCount - for some queries (like read events and read state) we want to fail early (10 seconds should be ample time) but retry a number of times - this is to avoid network flakes failing the canary

View Source
const APIShortTimeoutSeconds = 10

Variables

This section is empty.

Functions

This section is empty.

Types

type EventFilterOptions added in v0.3.26

type EventFilterOptions = jobstore.JobHistoryFilterOptions

type ListRequest

type ListRequest = listRequest

type ListResponse

type ListResponse = listResponse

type Msg added in v0.3.26

type Msg struct {
	Tag  uint8
	Data string
}

type RequesterAPIClient

type RequesterAPIClient struct {
	publicapi.APIClient
}

RequesterAPIClient is a utility for interacting with a node's API server.

func NewRequesterAPIClient

func NewRequesterAPIClient(host string, port uint16, path ...string) *RequesterAPIClient

NewRequesterAPIClient returns a new client for a node's API server.

func NewRequesterAPIClientFromClient

func NewRequesterAPIClientFromClient(baseClient *publicapi.APIClient) *RequesterAPIClient

NewRequesterAPIClientFromClient returns a new client for a node's API server.

func (*RequesterAPIClient) Approve added in v0.3.26

func (apiClient *RequesterAPIClient) Approve(
	ctx context.Context,
	jobID string,
	response bidstrategy.BidStrategyResponse,
) error

func (*RequesterAPIClient) Cancel

func (apiClient *RequesterAPIClient) Cancel(ctx context.Context, jobID string, reason string) (*model.JobState, error)

Cancel will request that the job with the specified ID is stopped. The JobInfo will be returned if the cancel was submitted. If no match is found, Cancel returns false with a nil error.

func (*RequesterAPIClient) Debug

func (apiClient *RequesterAPIClient) Debug(ctx context.Context) (map[string]model.DebugInfo, error)

func (*RequesterAPIClient) Get

func (apiClient *RequesterAPIClient) Get(ctx context.Context, jobID string) (*model.JobWithInfo, bool, error)

Get returns job data for a particular job ID. If no match is found, Get returns false with a nil error.

func (*RequesterAPIClient) GetEvents

func (apiClient *RequesterAPIClient) GetEvents(
	ctx context.Context,
	jobID string,
	options EventFilterOptions) (events []model.JobHistory, err error)

func (*RequesterAPIClient) GetJobState

func (apiClient *RequesterAPIClient) GetJobState(ctx context.Context, jobID string) (model.JobState, error)

func (*RequesterAPIClient) GetJobStateResolver

func (apiClient *RequesterAPIClient) GetJobStateResolver() *job.StateResolver

func (*RequesterAPIClient) GetResults

func (apiClient *RequesterAPIClient) GetResults(ctx context.Context, jobID string) (results []model.PublishedResult, err error)

func (*RequesterAPIClient) List

func (apiClient *RequesterAPIClient) List(
	ctx context.Context,
	idFilter string,
	includeTags []model.IncludedTag,
	excludeTags []model.ExcludedTag,
	maxJobs int,
	returnAll bool,
	sortBy string,
	sortReverse bool,
) (
	[]*model.JobWithInfo, error)

List returns the list of jobs in the node's transport.

func (*RequesterAPIClient) Logs added in v0.3.26

func (apiClient *RequesterAPIClient) Logs(
	ctx context.Context,
	jobID string,
	executionID string,
	withHistory bool,
	follow bool) (*websocket.Conn, error)

Logs will retrieve the address of an endpoint where a client connection can be made to stream the results of an execution back to a TTY

func (*RequesterAPIClient) Submit

func (apiClient *RequesterAPIClient) Submit(
	ctx context.Context,
	j *model.Job,
) (*model.Job, error)

Submit submits a new job to the node's transport.

type RequesterAPIServer

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

func NewRequesterAPIServer

func NewRequesterAPIServer(params RequesterAPIServerParams) *RequesterAPIServer

func (*RequesterAPIServer) HandleJobEvent

func (s *RequesterAPIServer) HandleJobEvent(ctx context.Context, event model.JobEvent) (err error)

func (*RequesterAPIServer) RegisterAllHandlers

func (s *RequesterAPIServer) RegisterAllHandlers() error

type RequesterAPIServerParams

type RequesterAPIServerParams struct {
	APIServer          *publicapi.APIServer
	Requester          requester.Endpoint
	DebugInfoProviders []model.DebugInfoProvider
	JobStore           jobstore.Store
	StorageProviders   storage.StorageProvider
}

Jump to

Keyboard shortcuts

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