config

package
v0.15.9 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Checks = map[string]CheckType{
	"balances": {
		NewAction: balances.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				DryRun             *bool          `yaml:"dry-run"`
				FileName           *string        `yaml:"file-name"`
				FileSize           *int64         `yaml:"file-size"`
				GasPrice           *string        `yaml:"gas-price"`
				PostageAmount      *int64         `yaml:"postage-amount"`
				PostageDepth       *uint64        `yaml:"postage-depth"`
				PostageLabel       *string        `yaml:"postage-label"`
				Seed               *int64         `yaml:"seed"`
				UploadNodeCount    *int           `yaml:"upload-node-count"`
				WaitBeforeDownload *time.Duration `yaml:"wait-before-download"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := balances.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"cashout": {
		NewAction: cashout.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				NodeGroup *string `yaml:"node-group"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := cashout.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"file-retrieval": {
		NewAction: fileretrieval.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				FileName        *string `yaml:"file-name"`
				FileSize        *int64  `yaml:"file-size"`
				FilesPerNode    *int    `yaml:"files-per-node"`
				Full            *bool   `yaml:"full"`
				GasPrice        *string `yaml:"gas-price"`
				PostageAmount   *int64  `yaml:"postage-amount"`
				PostageLabel    *string `yaml:"postage-label"`
				Seed            *int64  `yaml:"seed"`
				UploadNodeCount *int    `yaml:"upload-node-count"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := fileretrieval.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"full-connectivity": {
		NewAction: fullconnectivity.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				LightNodeNames *[]string `yaml:"group-1"`
				FullNodeNames  *[]string `yaml:"group-2"`
				BootNodeNames  *[]string `yaml:"boot-nodes"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := fullconnectivity.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"gc": {
		NewAction: gc.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				CacheSize    *int    `yaml:"cache-size"`
				GasPrice     *string `yaml:"gas-price"`
				PostageLabel *string `yaml:"postage-label"`
				ReserveSize  *int    `yaml:"reserve-size"`
				Seed         *int64  `yaml:"seed"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := gc.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"kademlia": {
		NewAction: kademlia.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				Dynamic *bool `yaml:"dynamic"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := kademlia.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"manifest": {
		NewAction: manifest.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				FilesInCollection *int    `yaml:"files-in-collection"`
				GasPrice          *string `yaml:"gas-price"`
				MaxPathnameLength *int32  `yaml:"max-pathname-length"`
				PostageAmount     *int64  `yaml:"postage-amount"`
				PostageDepth      *uint64 `yaml:"postage-depth"`
				PostageLabel      *string `yaml:"postage-label"`
				Seed              *int64  `yaml:"seed"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := manifest.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"peer-count": {
		NewAction: peercount.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			return nil, nil
		},
	},
	"pingpong": {
		NewAction: pingpong.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			opts := pingpong.NewDefaultOptions()
			return opts, nil
		},
	},
	"pss": {
		NewAction: pss.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				Count          *int64         `yaml:"count"`
				AddressPrefix  *int           `yaml:"address-prefix"`
				GasPrice       *string        `yaml:"gas-price"`
				PostageAmount  *int64         `yaml:"postage-amount"`
				PostageDepth   *uint64        `yaml:"postage-depth"`
				PostageLabel   *string        `yaml:"postage-label"`
				RequestTimeout *time.Duration `yaml:"request-timeout"`
				Seed           *int64         `yaml:"seed"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := pss.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"pullsync": {
		NewAction: pullsync.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				ChunksPerNode              *int    `yaml:"chunks-per-node"`
				GasPrice                   *string `yaml:"gas-price"`
				PostageAmount              *int64  `yaml:"postage-amount"`
				PostageLabel               *string `yaml:"postage-label"`
				ReplicationFactorThreshold *int    `yaml:"replication-factor-threshold"`
				Seed                       *int64  `yaml:"seed"`
				UploadNodeCount            *int    `yaml:"upload-node-count"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := pullsync.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"pushsync": {
		NewAction: pushsync.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				ChunksPerNode     *int           `yaml:"chunks-per-node"`
				GasPrice          *string        `yaml:"gas-price"`
				Mode              *string        `yaml:"mode"`
				PostageAmount     *int64         `yaml:"postage-amount"`
				PostageDepth      *uint64        `yaml:"postage-depth"`
				PostageLabel      *string        `yaml:"postage-label"`
				Retries           *int           `yaml:"retries"`
				RetryDelay        *time.Duration `yaml:"retry-delay"`
				Seed              *int64         `yaml:"seed"`
				UploadNodeCount   *int           `yaml:"upload-node-count"`
				ExcludeNodeGroups *[]string      `yaml:"exclude-node-group"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := pushsync.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"retrieval": {
		NewAction: retrieval.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				ChunksPerNode   *int    `yaml:"chunks-per-node"`
				GasPrice        *string `yaml:"gas-price"`
				PostageAmount   *int64  `yaml:"postage-amount"`
				PostageDepth    *uint64 `yaml:"postage-depth"`
				PostageLabel    *string `yaml:"postage-label"`
				Seed            *int64  `yaml:"seed"`
				UploadNodeCount *int    `yaml:"upload-node-count"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := retrieval.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"settlements": {
		NewAction: settlements.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				DryRun             *bool          `yaml:"dry-run"`
				ExpectSettlements  *bool          `yaml:"expect-settlements"`
				FileName           *string        `yaml:"file-name"`
				FileSize           *int64         `yaml:"file-size"`
				GasPrice           *string        `yaml:"gas-price"`
				PostageAmount      *int64         `yaml:"postage-amount"`
				PostageDepth       *uint64        `yaml:"postage-depth"`
				PostageLabel       *string        `yaml:"postage-label"`
				Seed               *int64         `yaml:"seed"`
				Threshold          *int64         `yaml:"threshold"`
				UploadNodeCount    *int           `yaml:"upload-node-count"`
				WaitBeforeDownload *time.Duration `yaml:"wait-before-download"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := settlements.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"smoke": {
		NewAction: smoke.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				ContentSize   *int64         `yaml:"content-size"`
				RndSeed       *int64         `yaml:"rnd-seed"`
				PostageAmount *int64         `yaml:"postage-amount"`
				PostageDepth  *uint64        `yaml:"postage-depth"`
				TxOnErrWait   *time.Duration `yaml:"tx-on-err-wait"`
				RxOnErrWait   *time.Duration `yaml:"rx-on-err-wait"`
				NodesSyncWait *time.Duration `yaml:"nodes-sync-wait"`
				Duration      *time.Duration `yaml:"duration"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := smoke.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"load": {
		NewAction: smoke.NewLoadCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				ContentSize     *int64         `yaml:"content-size"`
				RndSeed         *int64         `yaml:"rnd-seed"`
				PostageAmount   *int64         `yaml:"postage-amount"`
				PostageDepth    *uint64        `yaml:"postage-depth"`
				GasPrice        *string        `yaml:"gas-price"`
				TxOnErrWait     *time.Duration `yaml:"tx-on-err-wait"`
				RxOnErrWait     *time.Duration `yaml:"rx-on-err-wait"`
				NodesSyncWait   *time.Duration `yaml:"nodes-sync-wait"`
				Duration        *time.Duration `yaml:"duration"`
				UploaderCount   *int           `yaml:"uploader-count"`
				UploadGroups    *[]string      `yaml:"upload-groups"`
				DownloaderCount *int           `yaml:"downloader-count"`
				DownloadGroups  *[]string      `yaml:"download-groups"`
				MaxUseBatch     *time.Duration `yaml:"max-use-batch"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := smoke.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"soc": {
		NewAction: soc.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				GasPrice       *string        `yaml:"gas-price"`
				PostageAmount  *int64         `yaml:"postage-amount"`
				PostageDepth   *uint64        `yaml:"postage-depth"`
				PostageLabel   *string        `yaml:"postage-label"`
				RequestTimeout *time.Duration `yaml:"request-timeout"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := soc.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"postage": {
		NewAction: postage.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				GasPrice           *string `yaml:"gas-price"`
				PostageAmount      *int64  `yaml:"postage-amount"`
				PostageTopupAmount *int64  `yaml:"postage-topup-amount"`
				PostageDepth       *uint64 `yaml:"postage-depth"`
				PostageNewDepth    *uint64 `yaml:"postage-new-depth"`
				PostageLabel       *string `yaml:"postage-label"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := postage.NewDefaultOptions()
			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}
			return opts, nil
		},
	},
	"stake": {
		NewAction: stake.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				Amount             *big.Int `yaml:"amount"`
				InsufficientAmount *big.Int `yaml:"insufficient-amount"`
				ContractAddr       *string  `yaml:"contract-addr"`
				CallerPrivateKey   *string  `yaml:"private-key"`
				GethURL            *string  `yaml:"geth-url"`
				GethChainID        *big.Int `yaml:"geth-chain-id"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := stake.NewDefaultOptions()
			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}
			return opts, nil
		},
	},
	"authenticate": {
		NewAction: authenticated.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				DryRun              *bool   `yaml:"dry-run"`
				Role                *string `yaml:"role"`
				AdminPassword       *string `yaml:"admin-password"`
				RestrictedGroupName *string `yaml:"restricted-group-name"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := authenticated.NewDefaultOptions()
			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}
			return opts, nil
		},
	},
	"longavailability": {
		NewAction: longavailability.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				RndSeed      *int64         `yaml:"rnd-seed"`
				RetryCount   *int64         `yaml:"retry-count"`
				RetryWait    *time.Duration `yaml:"retry-wait"`
				Refs         *[]string      `yaml:"refs"`
				NextIterWait *time.Duration `yaml:"next-iter-wait"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := longavailability.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"networkavailability": {
		NewAction: networkavailability.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				RndSeed       *int64         `yaml:"rnd-seed"`
				PostageAmount *int64         `yaml:"postage-amount"`
				PostageDepth  *uint64        `yaml:"postage-depth"`
				SleepDuration *time.Duration `yaml:"sleep-duration"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := networkavailability.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"datadurability": {
		NewAction: datadurability.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				Ref         *string `yaml:"ref"`
				Concurrency *int    `yaml:"concurrency"`
				MaxAttempts *int    `yaml:"max-attempts"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := datadurability.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"redundancy": {
		NewAction: redundancy.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				PostageAmount *int `yaml:"postage-amount"`
				PostageDepth  *int `yaml:"postage-depth"`
				Seed          *int `yaml:"seed"`
				DataSize      *int `yaml:"data-size"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := redundancy.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"withdraw": {
		NewAction: withdraw.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (interface{}, error) {
			checkOpts := new(struct {
				TargetAddr *string `yaml:"target-address"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := withdraw.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
}

Checks represents all available check types

View Source
var Simulations = map[string]SimulationType{
	"upload": {
		NewAction: upload.NewSimulation,
		NewOptions: func(simulationGlobalConfig SimulationGlobalConfig, simulation Simulation) (interface{}, error) {
			simulationOpts := new(struct {
				FileCount            *int64         `yaml:"file-count"`
				GasPrice             *string        `yaml:"gas-price"`
				MaxFileSize          *int64         `yaml:"max-file-size"`
				MinFileSize          *int64         `yaml:"min-file-size"`
				PostageAmount        *int64         `yaml:"postage-amount"`
				PostageDepth         *uint64        `yaml:"postage-depth"`
				PostageLabel         *string        `yaml:"postage-label"`
				Retries              *int           `yaml:"retries"`
				RetryDelay           *time.Duration `yaml:"retry-delay"`
				Seed                 *int64         `yaml:"seed"`
				Timeout              *time.Duration `yaml:"timeout"`
				UploadNodeName       *string        `yaml:"upload-node-name"`
				UploadNodePercentage *int           `yaml:"upload-node-percentage"`
				SyncUpload           *bool          `yaml:"sync-upload"`
			})
			if err := simulation.Options.Decode(simulationOpts); err != nil {
				return nil, fmt.Errorf("decoding simulation %s options: %w", simulation.Type, err)
			}
			opts := upload.NewDefaultOptions()

			if err := applySimulationConfig(simulationGlobalConfig, simulationOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"retrieval": {
		NewAction: retrieval.NewSimulation,
		NewOptions: func(simulationGlobalConfig SimulationGlobalConfig, simulation Simulation) (interface{}, error) {
			simulationOpts := new(struct {
				ChunksPerNode   *int           `yaml:"chunks-per-node"`
				GasPrice        *string        `yaml:"gas-price"`
				PostageAmount   *int64         `yaml:"postage-amount"`
				PostageDepth    *uint64        `yaml:"postage-depth"`
				PostageLabel    *string        `yaml:"postage-label"`
				Seed            *int64         `yaml:"seed"`
				UploadNodeCount *int           `yaml:"upload-node-count"`
				UploadDelay     *time.Duration `yaml:"upload-delay"`
			})
			if err := simulation.Options.Decode(simulationOpts); err != nil {
				return nil, fmt.Errorf("decoding simulation %s options: %w", simulation.Type, err)
			}
			opts := retrieval.NewDefaultOptions()

			if err := applySimulationConfig(simulationGlobalConfig, simulationOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
	"pushsync": {
		NewAction: pushsync.NewSimulation,
		NewOptions: func(simulationGlobalConfig SimulationGlobalConfig, simulation Simulation) (interface{}, error) {
			simulationOpts := new(struct {
				GasPrice         *string  `yaml:"gas-price"`
				PostageAmount    *int64   `yaml:"postage-amount"`
				PostageDepth     *uint64  `yaml:"postage-depth"`
				Seed             *int64   `yaml:"seed"`
				ProxyApiEndpoint *string  `yaml:"proxy-api-endpoint"`
				ChunkCount       *int64   `yaml:"chunk-count"`
				StartPercentage  *float64 `yaml:"start-percentage"`
				EndPercentage    *float64 `yaml:"end-percentage"`
				StepPercentage   *float64 `yaml:"step-percentage"`
			})
			if err := simulation.Options.Decode(simulationOpts); err != nil {
				return nil, fmt.Errorf("decoding simulation %s options: %w", simulation.Type, err)
			}
			opts := pushsync.NewDefaultOptions()

			if err := applySimulationConfig(simulationGlobalConfig, simulationOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}

			return opts, nil
		},
	},
}

Checks represents all available simulation types

Functions

This section is empty.

Types

type BeeConfig

type BeeConfig struct {
	// parent to inherit settings from
	*Inherit `yaml:",inline"`
	// Bee configuration
	AllowPrivateCIDRs         *bool          `yaml:"allow-private-cidrs"`
	APIAddr                   *string        `yaml:"api-addr"`
	BlockTime                 *uint64        `yaml:"block-time"`
	Bootnodes                 *string        `yaml:"bootnodes"`
	BootnodeMode              *bool          `yaml:"bootnode-mode"`
	CacheCapacity             *uint64        `yaml:"cache-capacity"`
	ClefSignerEnable          *bool          `yaml:"clef-signer-enable"`
	ClefSignerEndpoint        *string        `yaml:"clef-signer-endpoint"`
	CORSAllowedOrigins        *string        `yaml:"cors-allowed-origins"`
	DataDir                   *string        `yaml:"data-dir"`
	DbOpenFilesLimit          *int           `yaml:"db-open-files-limit"`
	DbBlockCacheCapacity      *int           `yaml:"db-block-cache-capacity"`
	DbWriteBufferSize         *int           `yaml:"db-write-buffer-size"`
	DbDisableSeeksCompaction  *bool          `yaml:"db-disable-seeks-compaction"`
	DebugAPIAddr              *string        `yaml:"debug-api-addr"`
	DebugAPIEnable            *bool          `yaml:"debug-api-enable"`
	FullNode                  *bool          `yaml:"full-node"`
	NATAddr                   *string        `yaml:"nat-addr"`
	Mainnet                   *bool          `yaml:"mainnet"`
	NetworkID                 *uint64        `yaml:"network-id"`
	P2PAddr                   *string        `yaml:"p2p-addr"`
	P2PWSEnable               *bool          `yaml:"pwp-ws-enable"`
	Password                  *string        `yaml:"password"`
	PaymentEarly              *uint64        `yaml:"payment-early-percent"`
	PaymentThreshold          *uint64        `yaml:"payment-threshold"`
	PaymentTolerance          *uint64        `yaml:"payment-tolerance-percent"`
	PostageStampAddress       *string        `yaml:"postage-stamp-address"`
	PostageContractStartBlock *uint64        `yaml:"postage-stamp-start-block"`
	PriceOracleAddress        *string        `yaml:"price-oracle-address"`
	RedistributionAddress     *string        `yaml:"redistribution-address"`
	StakingAddress            *string        `yaml:"staking-address"`
	StorageIncentivesEnable   *string        `yaml:"storage-incentives-enable"`
	ResolverOptions           *string        `yaml:"resolver-options"`
	Restricted                *bool          `yaml:"restricted"`
	TokenEncryptionKey        *string        `yaml:"token-encryption-key"`
	AdminPassword             *string        `yaml:"admin-password"`
	ChequebookEnable          *bool          `yaml:"chequebook-enable"`
	SwapEnable                *bool          `yaml:"swap-enable"`
	SwapEndpoint              *string        `yaml:"swap-endpoint"`
	SwapDeploymentGasPrice    *string        `yaml:"swap-deployment-gas-price"`
	SwapFactoryAddress        *string        `yaml:"swap-factory-address"`
	SwapInitialDeposit        *uint64        `yaml:"swap-initial-deposit"`
	TracingEnabled            *bool          `yaml:"tracing-enabled"`
	TracingEndpoint           *string        `yaml:"tracing-endpoint"`
	TracingServiceName        *string        `yaml:"tracing-service-name"`
	Verbosity                 *uint64        `yaml:"verbosity"`
	WelcomeMessage            *string        `yaml:"welcome-message"`
	WarmupTime                *time.Duration `yaml:"warmup-time"`
	WithdrawAddress           *string        `yaml:"withdrawal-addresses-whitelist"`
}

BeeConfig represents Bee configuration

func (*BeeConfig) Export

func (b *BeeConfig) Export() (o orchestration.Config)

Export exports BeeConfig to orchestration.Config

type Check

type Check struct {
	Options yaml.Node      `yaml:"options"`
	Timeout *time.Duration `yaml:"timeout"`
	Type    string         `yaml:"type"`
}

Check represents check configuration

type CheckGlobalConfig

type CheckGlobalConfig struct {
	Seed int64
}

CheckGlobalConfig represents global configs for all checks

type CheckType

type CheckType struct {
	NewAction  func(logging.Logger) beekeeper.Action               // links check with beekeeper action
	NewOptions func(CheckGlobalConfig, Check) (interface{}, error) // check options
}

CheckType is used for linking beekeeper actions with check and it's proper options

type Clef

type Clef struct {
	Key      string `yaml:"key"`
	Password string `yaml:"password"`
}

type Cluster

type Cluster struct {
	// parent to inherit settings from
	*Inherit `yaml:",inline"`
	// Cluster configuration
	Name                *string                      `yaml:"name"`
	Namespace           *string                      `yaml:"namespace"`
	DisableNamespace    *bool                        `yaml:"disable-namespace"`
	UseStaticEndpoints  *bool                        `yaml:"use-static-endpoints"`
	APIDomain           *string                      `yaml:"api-domain"`
	APIInsecureTLS      *bool                        `yaml:"api-insecure-tls"`
	APIScheme           *string                      `yaml:"api-scheme"`
	DebugAPIDomain      *string                      `yaml:"debug-api-domain"`
	DebugAPIInsecureTLS *bool                        `yaml:"debug-api-insecure-tls"`
	DebugAPIScheme      *string                      `yaml:"debug-api-scheme"`
	Funding             *Funding                     `yaml:"funding"`
	NodeGroups          *map[string]ClusterNodeGroup `yaml:"node-groups"`
	AdminPassword       *string                      `yaml:"admin-password"`
}

Cluster represents cluster configuration

func (*Cluster) Export

func (c *Cluster) Export() (o orchestration.ClusterOptions)

Export exports Cluster to orchestration.ClusterOptions, skipping all other extra fields

func (*Cluster) GetName

func (c *Cluster) GetName() string

GetName returns cluster name

func (*Cluster) GetNamespace

func (c *Cluster) GetNamespace() string

GetNamespace returns cluster namespace

func (*Cluster) GetNodeGroups

func (c *Cluster) GetNodeGroups() map[string]ClusterNodeGroup

GetNodeGroups returns cluster node groups

func (*Cluster) IsUsingStaticEndpoints added in v0.15.9

func (c *Cluster) IsUsingStaticEndpoints() bool

IsUsingStaticEndpoints

type ClusterNode

type ClusterNode struct {
	Name      string `yaml:"name"`
	Bootnodes string `yaml:"bootnodes"`
	Clef      Clef   `yaml:"clef"`
	LibP2PKey string `yaml:"libp2p-key"`
	SwarmKey  string `yaml:"swarm-key"`
}

ClusterNode represents node in the cluster

type ClusterNodeGroup

type ClusterNodeGroup struct {
	Mode          string         `yaml:"mode"`
	BeeConfig     string         `yaml:"bee-config"`
	Config        string         `yaml:"config"`
	Count         int            `yaml:"count"`
	Nodes         []ClusterNode  `yaml:"nodes"`
	NodeEndpoints []NodeEndpoint `yaml:"endpoints"`
	// contains filtered or unexported fields
}

ClusterNodeGroup represents node group in the cluster

func (*ClusterNodeGroup) GetEndpoints added in v0.15.9

func (ng *ClusterNodeGroup) GetEndpoints() map[string]NodeEndpoint

type Config

type Config struct {
	Clusters    map[string]Cluster    `yaml:"clusters"`
	NodeGroups  map[string]NodeGroup  `yaml:"node-groups"`
	BeeConfigs  map[string]BeeConfig  `yaml:"bee-configs"`
	Checks      map[string]Check      `yaml:"checks"`
	Simulations map[string]Simulation `yaml:"simulations"`
}

Config represents Beekeeper's configuration read from files

func Read added in v0.9.0

func Read(log logging.Logger, yamlFiles []YamlFile) (*Config, error)

Read reads given YAML files and unmarshals them into Config

func (*Config) PrintYaml added in v0.11.16

func (c *Config) PrintYaml(w io.Writer) (err error)

type Funding added in v0.8.3

type Funding struct {
	Bzz  *float64 `yaml:"bzz"`
	Eth  *float64 `yaml:"eth"`
	GBzz *float64 `yaml:"gbzz"`
}

Funding represents funding deposits for every node in the cluster

func (*Funding) Export added in v0.8.3

func (f *Funding) Export() (o orchestration.FundingOptions)

Export exports Funding to orchestration.FundingOptions

type Inherit

type Inherit struct {
	ParentName string `yaml:"_inherit"`
}

Inherit is struct used for implementing inheritance in Config objects

type MinAmounts added in v0.12.3

type MinAmounts struct {
	NativeCoin float64 // on mainnet this is xDAI
	SwarmToken float64 // on mainnet this is xBZZ
}

type NodeEndpoint added in v0.15.9

type NodeEndpoint struct {
	Name        string `yaml:"name"`
	APIURL      string `yaml:"api-url"`
	DebugAPIURL string `yaml:"debug-api-url"`
}

type NodeFunder added in v0.12.3

type NodeFunder struct {
	Namespace         string
	Addresses         []string
	ChainNodeEndpoint string
	WalletKey         string // Hex encoded key
	MinAmounts        MinAmounts
}

type NodeGroup

type NodeGroup struct {
	// parent to inherit settings from
	*Inherit `yaml:",inline"`
	// node group configuration
	Annotations               *map[string]string `yaml:"annotations"`
	ClefImage                 *string            `yaml:"clef-image"`
	ClefImagePullPolicy       *string            `yaml:"clef-image-pull-policy"`
	Image                     *string            `yaml:"image"`
	ImagePullPolicy           *string            `yaml:"image-pull-policy"`
	ImagePullSecrets          *[]string          `yaml:"image-pull-secrets"`
	IngressAnnotations        *map[string]string `yaml:"ingress-annotations"`
	IngressClass              *string            `yaml:"ingress-class"`
	IngressDebugAnnotations   *map[string]string `yaml:"ingress-debug-annotations"`
	IngressDebugClass         *string            `yaml:"ingress-debug-class"`
	Labels                    *map[string]string `yaml:"labels"`
	NodeSelector              *map[string]string `yaml:"node-selector"`
	PersistenceEnabled        *bool              `yaml:"persistence-enabled"`
	PersistenceStorageClass   *string            `yaml:"persistence-storage-class"`
	PersistenceStorageRequest *string            `yaml:"persistence-storage-request"`
	PodManagementPolicy       *string            `yaml:"pod-management-policy"`
	ResourcesLimitCPU         *string            `yaml:"resources-limit-cpu"`
	ResourcesLimitMemory      *string            `yaml:"resources-limit-memory"`
	ResourcesRequestCPU       *string            `yaml:"resources-request-cpu"`
	ResourcesRequestMemory    *string            `yaml:"resources-request-memory"`
	RestartPolicy             *string            `yaml:"restart-policy"`
	UpdateStrategy            *string            `yaml:"update-strategy"`
}

NodeGroup represents node group configuration

func (*NodeGroup) Export

func (n *NodeGroup) Export() (o orchestration.NodeGroupOptions)

Export exports NodeGroup to orchestration.NodeGroupOptions

type Simulation

type Simulation struct {
	Options yaml.Node      `yaml:"options"`
	Timeout *time.Duration `yaml:"timeout"`
	Type    string         `yaml:"type"`
}

Simulation represents simulation configuration

type SimulationGlobalConfig

type SimulationGlobalConfig struct {
	Seed int64
}

SimulationGlobalConfig represents global configs for all simulations

type SimulationType

type SimulationType struct {
	NewAction  func(logging.Logger) beekeeper.Action
	NewOptions func(SimulationGlobalConfig, Simulation) (interface{}, error)
}

SimulationType is used for linking beekeeper actions with simulation and it's proper options

type YamlFile added in v0.11.16

type YamlFile struct {
	Name    string
	Content []byte
}

Jump to

Keyboard shortcuts

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