Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultWorkerNum() int
- func PostCard(id string, challange string, difficulty string) error
- func TriggerNewPowRound(ctx context.Context, web3SDK *web3.Web3SDK) (common.Hash, error)
- type CpuWorker
- type MinerController
- type ResourceProvider
- type ResourceProviderController
- type ResourceProviderOfferOptions
- type ResourceProviderOptions
- type ResourceProviderPowOptions
- type SubmitWork
- type Task
- type TaskResult
- type Worker
- type WorkerConfig
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 RESOURCE_OFFER_INTERVAL = 10 * time.Minute
the interval at which we check and post resource offers
Variables ¶
View Source
var MaybeCudaOrCpu = NewCpuWorker
Functions ¶
func DefaultWorkerNum ¶
func DefaultWorkerNum() int
Types ¶
type MinerController ¶
type MinerController struct {
// contains filtered or unexported fields
}
func NewMinerController ¶
func NewMinerController(nodeId string, powCfg ResourceProviderPowOptions, task chan Task, submit SubmitWork) *MinerController
func (*MinerController) Start ¶
func (m *MinerController) Start(ctx context.Context)
type ResourceProvider ¶
type ResourceProvider struct {
// contains filtered or unexported fields
}
func NewResourceProvider ¶
func NewResourceProvider( options ResourceProviderOptions, web3SDK *web3.Web3SDK, executor executor.Executor, tracer trace.Tracer, ) (*ResourceProvider, error)
func (*ResourceProvider) Start ¶
func (resourceProvider *ResourceProvider) Start(ctx context.Context, cm *system.CleanupManager) chan error
func (*ResourceProvider) StartMineLoop ¶
func (resourceProvider *ResourceProvider) StartMineLoop(ctx context.Context) chan error
type ResourceProviderController ¶
type ResourceProviderController struct {
// contains filtered or unexported fields
}
func NewResourceProviderController ¶
func NewResourceProviderController( options ResourceProviderOptions, web3SDK *web3.Web3SDK, executor executor.Executor, tracer trace.Tracer, ) (*ResourceProviderController, error)
func (*ResourceProviderController) Start ¶
func (controller *ResourceProviderController) Start(ctx context.Context, cm *system.CleanupManager) chan error
type ResourceProviderOfferOptions ¶
type ResourceProviderOfferOptions struct {
// if we are configuring a single machine then
// these values are populated by the flags
OfferSpec data.MachineSpec
// we can dupliate the single spec to create a list of specs
OfferCount int
// this represents how many machines we will keep
// offering to the network
// we can configure this with a config file
// to start with we will just add --cpu --gpu and --ram flags
// to the resource provider CLI which constrains them to a single machine
Specs []data.MachineSpec
// the list of modules we are willing to run
// an empty list means anything
Modules []string
// this will normally be FixedPrice for RP's
Mode data.PricingMode
// the default pricing for this resource provider
// for all modules that don't have a specific price
DefaultPricing data.DealPricing
// allow different pricing for different modules
ModulePricing map[string]data.DealPricing
// which mediators and directories this RP will trust
Services data.ServiceConfig
}
this configures the resource offers we will keep track of
type ResourceProviderOptions ¶
type ResourceProviderOptions struct {
Bacalhau bacalhau.BacalhauExecutorOptions
Offers ResourceProviderOfferOptions
Web3 web3.Web3Options
Pow ResourceProviderPowOptions
IPFS ipfs.IPFSOptions
Telemetry system.TelemetryOptions
}
type ResourceProviderPowOptions ¶
type ResourceProviderPowOptions struct {
DisablePow bool
NumWorkers int
CudaGridSize int
CudaBlockSize int
CudaHashsPerThread int
}
this configures the pow we will keep track of
type SubmitWork ¶
type Worker ¶
func NewCpuWorker ¶
func NewCpuWorker(cfg *WorkerConfig) (Worker, error)
type WorkerConfig ¶
type WorkerConfig struct {
// contains filtered or unexported fields
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.