jobCreatorService

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 20 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

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,
	dealmakerService *dealmaker.Service,
) (*JobCreator, error)

func (*JobCreator) AddJobOffer

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

adds the job offer to the solver

func (*JobCreator) GetJobOfferFromOptions

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

func (*JobCreator) GetResult

func (jobCreator *JobCreator) GetResult(dealId string) (dto.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,
	dealmakerService *dealmaker.Service,
) (*JobCreatorController, error)

func (*JobCreatorController) AddJobOffer

func (controller *JobCreatorController) AddJobOffer(offer dto.JobOffer) (dto.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 dto.ModuleConfig
	// the required spec hoisted from the module
	Spec dto.MachineSpec
	// this will normally be MarketPrice for JC's
	Mode dto.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 dto.DealPricing
	// the timeouts we are offering with the deal
	Timeouts dto.DealTimeouts
	// the inputs to the module
	Inputs map[string]string
	// which mediators and directories this RP will trust
	Services dto.ServiceConfig
}

type JobCreatorOptions

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

type JobOfferSubscriber

type JobOfferSubscriber func(offer dto.JobOfferContainer)

type OnChainJobCreator

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

func NewOnChainJobCreator

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

func (*OnChainJobCreator) AddJobOffer

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

adds the job offer to the solver

func (*OnChainJobCreator) GetJobOfferFromOptions

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

func (*OnChainJobCreator) GetResult

func (jobCreator *OnChainJobCreator) GetResult(dealId string) (dto.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 dto.JobOfferContainer
	Result   dto.Result
}

func RunJob

func RunJob(
	ctx *system.CommandContext,
	options JobCreatorOptions,
	dealmakerService *dealmaker.Service,
	eventSub JobOfferSubscriber,

) (*RunJobResults, error)

Jump to

Keyboard shortcuts

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