jobcreator

package
v0.1.18-init-pr-60 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const CONTROL_LOOP_INTERVAL = 10 * time.Second

the background "even if we have not heard of an event" loop i.e. things will not wait 10 seconds - the control loop reacts to events in the system - this 10 second background loop is just for in case we miss any events

View Source
const JOB_PRICE = 2

Variables

This section is empty.

Functions

This section is empty.

Types

type JobCreator

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

func NewJobCreator

func NewJobCreator(
	options JobCreatorOptions,
	web3SDK *web3.Web3SDK,
) (*JobCreator, error)

func (*JobCreator) AddJobOffer

func (jobCreator *JobCreator) AddJobOffer(offer data.JobOffer) (data.JobOfferContainer, error)

adds the job offer to the solver

func (*JobCreator) GetJobOfferFromOptions

func (jobCreator *JobCreator) GetJobOfferFromOptions(options JobCreatorOfferOptions) (data.JobOffer, error)

func (*JobCreator) GetResult

func (jobCreator *JobCreator) GetResult(dealId string) (data.Result, error)

func (*JobCreator) Start

func (jobCreator *JobCreator) Start(ctx context.Context, cm *system.CleanupManager) chan error

func (*JobCreator) SubscribeToJobOfferUpdates

func (jobCreator *JobCreator) SubscribeToJobOfferUpdates(sub JobOfferSubscriber)

type JobCreatorController

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

func NewJobCreatorController

func NewJobCreatorController(
	options JobCreatorOptions,
	web3SDK *web3.Web3SDK,
) (*JobCreatorController, error)

func (*JobCreatorController) AddJobOffer

func (controller *JobCreatorController) AddJobOffer(offer data.JobOffer) (data.JobOfferContainer, error)

func (*JobCreatorController) Start

func (controller *JobCreatorController) Start(ctx context.Context, cm *system.CleanupManager) chan error

func (*JobCreatorController) SubscribeToJobOfferUpdates

func (controller *JobCreatorController) SubscribeToJobOfferUpdates(sub JobOfferSubscriber)

type JobCreatorMediationOptions

type JobCreatorMediationOptions struct {
	// out of 100 chance we will check results
	CheckResultsPercentage int
}

type JobCreatorOfferOptions

type JobCreatorOfferOptions struct {
	// the module that is wanting to be run
	// this contains the spec that is required to run the module
	Module data.ModuleConfig
	// the required spec hoisted from the module
	Spec data.MachineSpec
	// this will normally be MarketPrice for JC's
	Mode data.PricingMode
	// this is so clients can put limit orders for jobs
	// and the solver will match as soon as a resource offer
	// is added that matches the bid
	Pricing data.DealPricing
	// the timeouts we are offering with the deal
	Timeouts data.DealTimeouts
	// the inputs to the module
	Inputs map[string]string
	// which mediators and directories this RP will trust
	Services data.ServiceConfig
}

type JobCreatorOptions

type JobCreatorOptions struct {
	Mediation JobCreatorMediationOptions
	Offer     JobCreatorOfferOptions
	Web3      web3.Web3Options
}

type JobOfferSubscriber

type JobOfferSubscriber func(offer data.JobOfferContainer)

type OnChainJobCreator

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

func NewOnChainJobCreator

func NewOnChainJobCreator(
	options JobCreatorOptions,
	web3SDK *web3.Web3SDK,
) (*OnChainJobCreator, error)

func (*OnChainJobCreator) AddJobOffer

func (jobCreator *OnChainJobCreator) AddJobOffer(offer data.JobOffer) (data.JobOfferContainer, error)

adds the job offer to the solver

func (*OnChainJobCreator) GetJobOfferFromOptions

func (jobCreator *OnChainJobCreator) GetJobOfferFromOptions(options JobCreatorOfferOptions) (data.JobOffer, error)

func (*OnChainJobCreator) GetResult

func (jobCreator *OnChainJobCreator) GetResult(dealId string) (data.Result, error)

func (*OnChainJobCreator) Start

func (jobCreator *OnChainJobCreator) Start(ctx context.Context, cm *system.CleanupManager) chan error

func (*OnChainJobCreator) SubscribeToJobOfferUpdates

func (jobCreator *OnChainJobCreator) SubscribeToJobOfferUpdates(sub JobOfferSubscriber)

type RunJobResults

type RunJobResults struct {
	JobOffer data.JobOfferContainer
	Result   data.Result
}

func RunJob

func RunJob(
	ctx *system.CommandContext,
	options JobCreatorOptions,
	eventSub JobOfferSubscriber,
) (*RunJobResults, error)

Jump to

Keyboard shortcuts

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