publicapi

package
v0.3.24-build-testing-01 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const APIPrefix = "requester/"
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 ContainsClientID added in v0.3.24

type ContainsClientID interface {
	GetClientID() string
}

type JobApprovePayload added in v0.3.24

type JobApprovePayload struct {
	requester.ApproveJobRequest
}

func (JobApprovePayload) GetClientID added in v0.3.24

func (j JobApprovePayload) GetClientID() string

type ListRequest

type ListRequest = listRequest

type ListResponse

type ListResponse = listResponse

type RequesterAPIClient

type RequesterAPIClient struct {
	publicapi.APIClient
}

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

func NewRequesterAPIClient

func NewRequesterAPIClient(baseURI 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) 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) (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) 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
}

type SignedRequest added in v0.3.24

type SignedRequest[PayloadType ContainsClientID] struct {
	// The data needed to cancel a running job on the network
	Payload PayloadType `json:"payload" validate:"required"`

	// A base64-encoded signature of the data, signed by the client:
	ClientSignature string `json:"signature" validate:"required"`

	// The base64-encoded public key of the client:
	ClientPublicKey string `json:"client_public_key" validate:"required"`
}

A strongly-typed signed request. We use this type only in our documentation to allow clients to understand the correct type of the payload.

Jump to

Keyboard shortcuts

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