verifier

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateExecutions

func ValidateExecutions(job model.Job, executions []model.ExecutionState) error

Types

type DecrypterFunction

type DecrypterFunction func(ctx context.Context, data []byte) ([]byte, error)

type Encrypter

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

func NewEncrypter

func NewEncrypter(privateKey crypto.PrivKey) Encrypter

func (Encrypter) Decrypt

func (e Encrypter) Decrypt(ctx context.Context, data []byte) ([]byte, error)

func (Encrypter) Encrypt

func (e Encrypter) Encrypt(ctx context.Context, data, libp2pKeyBytes []byte) ([]byte, error)

type EncrypterFunction

type EncrypterFunction func(ctx context.Context, data []byte, publicKeyBytes []byte) ([]byte, error)

type ErrInsufficientExecutions

type ErrInsufficientExecutions struct {
	JobID          string
	MinCount       int
	SubmittedCount int
}

ErrInsufficientExecutions is returned when the number of executions is less than the minimum required

func NewErrInsufficientExecutions

func NewErrInsufficientExecutions(id string, minCount, submittedCount int) ErrInsufficientExecutions

func (ErrInsufficientExecutions) Error

type ErrInvalidExecutionState

type ErrInvalidExecutionState struct {
	ExecutionID model.ExecutionID
	State       model.ExecutionStateType
}

ErrInvalidExecutionState is returned when the execution state is not valid for verification

func (ErrInvalidExecutionState) Error

func (e ErrInvalidExecutionState) Error() string

type ErrMismatchingExecution

type ErrMismatchingExecution struct {
	JobID       string
	ExecutionID model.ExecutionID
}

ErrMismatchingExecution is returned when the execution does not match the job

func NewErrMismatchingExecution

func NewErrMismatchingExecution(jobID string, executionID model.ExecutionID) ErrMismatchingExecution

func (ErrMismatchingExecution) Error

func (e ErrMismatchingExecution) Error() string

type ErrMissingVerificationProposal

type ErrMissingVerificationProposal struct {
	ExecutionID model.ExecutionID
}

ErrMissingVerificationProposal is returned when the verification proposal is missing

func NewErrMissingVerificationProposal

func NewErrMissingVerificationProposal(id model.ExecutionID) ErrMissingVerificationProposal

func (ErrMissingVerificationProposal) Error

type Verifier

type Verifier interface {
	model.Providable

	// compute node
	//
	// return the local file path where the output of a local execution
	// should live - this is called by the executor to prepare
	// output volumes when running a job and the publisher when uploading
	// the results after verification
	GetResultPath(
		ctx context.Context,
		executionID string,
		job model.Job,
	) (string, error)

	// compute node
	//
	// the executor has completed the job and produced a local folder of results
	// the verifier will now "process" this local folder into the result
	// that will be broadcast back to the network
	// For example - the "resultsHash" verifier will hash the folder
	// and encrypt that hash with the public key of the requester
	GetProposal(
		ctx context.Context,
		job model.Job,
		resultPath string,
	) ([]byte, error)

	// requester node
	//
	// once we've decided that a job is complete - we verify the results reported
	// by the compute nodes - what this actually does is up to the verifier but
	// it's highly likely that a verifier implementation has a controller attached
	// and so can trigger state transitions (such as results accepted / rejected)
	//
	// IsJobComplete must return true otherwise this function will error
	Verify(
		ctx context.Context,
		job model.Job,
		executions []model.ExecutionState,
	) ([]VerifierResult, error)
}

Verifier is an interface representing something that can verify the results of a job.

type VerifierProvider

type VerifierProvider interface {
	model.Provider[model.Verifier, Verifier]
}

Returns a verifier that can be used to verify a job.

type VerifierResult

type VerifierResult struct {
	Execution model.ExecutionState
	Verified  bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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