config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDisputeThreshold = 0.01

threshold, a percentage of the expected value

View Source
const DefaultMaxCheckTimeDelta = 5 * time.Minute
View Source
const PrivateKeyEnvName = "ETH_PRIVATE_KEY"

Variables

This section is empty.

Functions

func ParseConfig

func ParseConfig(path string) error

ParseConfig and set a shared config entry

func ParseConfigBytes

func ParseConfigBytes(data []byte) error

Types

type Config

type Config struct {
	ContractAddress              string                `json:"contractAddress"`
	NodeURL                      string                `json:"nodeURL"`
	DatabaseURL                  string                `json:"databaseURL"`
	PublicAddress                string                `json:"publicAddress"`
	EthClientTimeout             uint                  `json:"ethClientTimeout"`
	TrackerSleepCycle            Duration              `json:"trackerCycle"`
	Trackers                     []string              `json:"trackers"`
	DBFile                       string                `json:"dbFile"`
	ServerHost                   string                `json:"serverHost"`
	ServerPort                   uint                  `json:"serverPort"`
	FetchTimeout                 Duration              `json:"fetchTimeout"`
	RequestData                  uint                  `json:"requestData"`
	MinConfidence                float64               `json:"minConfidence"`
	RequestDataInterval          Duration              `json:"requestDataInterval"`
	RequestTips                  int64                 `json:"requestTips"`
	MiningInterruptCheckInterval Duration              `json:"miningInterruptCheckInterval"`
	GasMultiplier                float32               `json:"gasMultiplier"`
	GasMax                       uint                  `json:"gasMax"`
	NumProcessors                int                   `json:"numProcessors"`
	Heartbeat                    Duration              `json:"heartbeat"`
	ServerWhitelist              []string              `json:"serverWhitelist"`
	GPUConfig                    map[string]*GPUConfig `json:"gpuConfig"`
	EnablePoolWorker             bool                  `json:"enablePoolWorker"`
	Worker                       string                `json:"worker"`
	Password                     string                `json:"password"`
	PoolURL                      string                `json:"poolURL"`
	IndexFolder                  string                `json:"indexFolder"`
	DisputeTimeDelta             Duration              `json:"disputeTimeDelta"` //ignore data further than this away from the value we are checking
	DisputeThreshold             float64               `json:"disputeThreshold"` //maximum allowed relative difference between observed and submitted value

	//config parameters excluded from the json config file
	PrivateKey string `json:"privateKey"`
}

Config holds global config info derived from config.json

func GetConfig

func GetConfig() *Config

GetConfig returns a shared instance of config

type Duration

type Duration struct {
	time.Duration
}

unfortunate hack to enable json parsing of human readable time strings see https://github.com/golang/go/issues/10275 code from https://stackoverflow.com/questions/48050945/how-to-unmarshal-json-into-durations

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type GPUConfig

type GPUConfig struct {
	//number of threads in a workgroup
	GroupSize int `json:"groupSize"`
	//total number of threads
	Groups int `json:"groups"`
	//number of iterations within a thread
	Count uint32 `json:"count"`

	Disabled bool `json:"disabled"`
}

Jump to

Keyboard shortcuts

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