config

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: BSD-3-Clause Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Checks = map[string]CheckType{
	"act": {
		NewAction: act.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (any, error) {
			checkOpts := new(struct {
				FileName     *string        `yaml:"file-name"`
				FileSize     *int64         `yaml:"file-size"`
				PostageTTL   *time.Duration `yaml:"postage-ttl"`
				PostageDepth *int64         `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 := act.NewOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}
			return opts, nil
		},
	},
	"autotls": {
		NewAction: autotls.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (any, error) {
			checkOpts := new(struct {
				AutoTLSGroups       *[]string `yaml:"autotls-groups"`
				UltraLightGroup     *string   `yaml:"ultra-light-group"`
				ForgeDNSAddress     *string   `yaml:"forge-dns-address"`
				ForgeTLSHostAddress *string   `yaml:"forge-tls-host-address"`
				PebbleMgmtURL       *string   `yaml:"pebble-mgmt-url"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := autotls.NewDefaultOptions()

			if err := applyCheckConfig(checkGlobalConfig, checkOpts, &opts); err != nil {
				return nil, fmt.Errorf("applying options: %w", err)
			}
			return opts, nil
		},
	},
	"balances": {
		NewAction: balances.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (any, error) {
			checkOpts := new(struct {
				DryRun             *bool          `yaml:"dry-run"`
				FileName           *string        `yaml:"file-name"`
				FileSize           *int64         `yaml:"file-size"`
				GasPrice           *string        `yaml:"gas-price"`
				PostageTTL         *time.Duration `yaml:"postage-ttl"`
				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) (any, 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) (any, 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"`
				PostageTTL      *time.Duration `yaml:"postage-ttl"`
				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) (any, 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) (any, 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) (any, 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) (any, error) {
			checkOpts := new(struct {
				FilesInCollection *int           `yaml:"files-in-collection"`
				GasPrice          *string        `yaml:"gas-price"`
				MaxPathnameLength *int32         `yaml:"max-pathname-length"`
				PostageTTL        *time.Duration `yaml:"postage-ttl"`
				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
		},
	},
	"manifest-v1": {
		NewAction: manifest.NewCheckV1,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (any, error) {
			checkOpts := new(struct {
				FilesInCollection *int           `yaml:"files-in-collection"`
				GasPrice          *string        `yaml:"gas-price"`
				MaxPathnameLength *int32         `yaml:"max-pathname-length"`
				PostageTTL        *time.Duration `yaml:"postage-ttl"`
				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) (any, error) {
			return nil, nil
		},
	},
	"pingpong": {
		NewAction: pingpong.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (any, error) {
			checkOpts := new(struct {
				PingAllPeers *bool `yaml:"ping-all-peers"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := pingpong.NewDefaultOptions()

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

			return opts, nil
		},
	},
	"pss": {
		NewAction: pss.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (any, error) {
			checkOpts := new(struct {
				Count          *int64         `yaml:"count"`
				AddressPrefix  *int           `yaml:"address-prefix"`
				GasPrice       *string        `yaml:"gas-price"`
				PostageTTL     *time.Duration `yaml:"postage-ttl"`
				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) (any, error) {
			checkOpts := new(struct {
				ChunksPerNode              *int           `yaml:"chunks-per-node"`
				GasPrice                   *string        `yaml:"gas-price"`
				PostageTTL                 *time.Duration `yaml:"postage-ttl"`
				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) (any, error) {
			checkOpts := new(struct {
				ChunksPerNode     *int           `yaml:"chunks-per-node"`
				GasPrice          *string        `yaml:"gas-price"`
				Mode              *string        `yaml:"mode"`
				PostageTTL        *time.Duration `yaml:"postage-ttl"`
				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) (any, error) {
			checkOpts := new(struct {
				ChunksPerNode   *int           `yaml:"chunks-per-node"`
				PostageTTL      *time.Duration `yaml:"postage-ttl"`
				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) (any, 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"`
				PostageTTL         *time.Duration `yaml:"postage-ttl"`
				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) (any, error) {
			checkOpts := new(struct {
				ContentSize   *int64         `yaml:"content-size"`
				FileSizes     *[]int64       `yaml:"file-sizes"`
				RndSeed       *int64         `yaml:"rnd-seed"`
				PostageTTL    *time.Duration `yaml:"postage-ttl"`
				PostageDepth  *uint64        `yaml:"postage-depth"`
				PostageLabel  *string        `yaml:"postage-label"`
				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"`
				RLevels       *[]uint8       `yaml:"r-levels"`
			})

			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}

			if checkOpts.FileSizes == nil && checkOpts.ContentSize != nil {
				checkOpts.FileSizes = &[]int64{*checkOpts.ContentSize}
			}

			opts := smoke.NewDefaultOptions()

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

			return opts, nil
		},
	},
	"load": {
		NewAction: load.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (any, error) {
			checkOpts := new(struct {
				ContentSize             *int64         `yaml:"content-size"`
				RndSeed                 *int64         `yaml:"rnd-seed"`
				PostageTTL              *time.Duration `yaml:"postage-ttl"`
				PostageDepth            *uint64        `yaml:"postage-depth"`
				PostageLabel            *string        `yaml:"postage-label"`
				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"`
				MaxCommittedDepth       *uint8         `yaml:"max-committed-depth"`
				CommittedDepthCheckWait *time.Duration `yaml:"committed-depth-check-wait"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}

			opts := load.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) (any, error) {
			checkOpts := new(struct {
				GasPrice       *string        `yaml:"gas-price"`
				PostageTTL     *time.Duration `yaml:"postage-ttl"`
				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) (any, 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) (any, 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"`
			})
			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
		},
	},
	"longavailability": {
		NewAction: longavailability.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (any, 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) (any, error) {
			checkOpts := new(struct {
				RndSeed       *int64         `yaml:"rnd-seed"`
				PostageTTL    *time.Duration `yaml:"postage-ttl"`
				PostageDepth  *uint64        `yaml:"postage-depth"`
				PostageLabel  *string        `yaml:"postage-label"`
				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) (any, 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) (any, error) {
			checkOpts := new(struct {
				DataSize     *int           `yaml:"data-size"`
				PostageDepth *int           `yaml:"postage-depth"`
				PostageLabel *string        `yaml:"postage-label"`
				PostageTTL   *time.Duration `yaml:"postage-ttl"`
				Seed         *int           `yaml:"seed"`
			})
			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) (any, 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
		},
	},
	"gsoc": {
		NewAction: gsoc.NewCheck,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (any, error) {
			checkOpts := new(struct {
				PostageTTL   *time.Duration `yaml:"postage-ttl"`
				PostageDepth *uint64        `yaml:"postage-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 := gsoc.NewDefaultOptions()

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

			return opts, nil
		},
	},
	"feed-v1": {
		NewAction: feed.NewCheckV1,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (any, error) {
			checkOpts := new(struct {
				PostageTTL   *time.Duration `yaml:"postage-ttl"`
				PostageDepth *uint64        `yaml:"postage-depth"`
				PostageLabel *string        `yaml:"postage-label"`
				NUpdates     *int           `yaml:"n-updates"`
				RootRef      *string        `yaml:"root-ref"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := feed.NewDefaultOptions()

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

			return opts, nil
		},
	},
	"feed": {
		NewAction: feed.NewCheckV2,
		NewOptions: func(checkGlobalConfig CheckGlobalConfig, check Check) (any, error) {
			checkOpts := new(struct {
				PostageTTL   *time.Duration `yaml:"postage-ttl"`
				PostageDepth *uint64        `yaml:"postage-depth"`
				PostageLabel *string        `yaml:"postage-label"`
				NUpdates     *int           `yaml:"n-updates"`
				RootRef      *string        `yaml:"root-ref"`
			})
			if err := check.Options.Decode(checkOpts); err != nil {
				return nil, fmt.Errorf("decoding check %s options: %w", check.Type, err)
			}
			opts := feed.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) (any, 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) (any, 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) (any, 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 {
	*Inherit             `yaml:",inline"`
	orchestration.Config `yaml:",inline"`
}

BeeConfig represents Bee configuration as read from Beekeeper's YAML config.

It embeds orchestration.Config (the Bee flag set), so the flag fields are defined in exactly one place and the same yaml tags — the Bee flag names — are used both for reading the config here and for rendering the node's .bee.yaml. The only thing BeeConfig adds is the config-file-only concern of inheritance (_inherit). Export returns just the embedded Config, so neither _inherit nor any other config-loading detail can leak into the rendered file.

func (*BeeConfig) Export

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

Export returns the Bee flag configuration to be rendered into the node's .bee.yaml. Inheritance has already been resolved during config loading and is not part of the embedded Config.

func (BeeConfig) GetParentName added in v0.17.8

func (b BeeConfig) GetParentName() string

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
	GethURL string
}

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) (any, error) // check options
}

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

type Cluster

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

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) GetParentName added in v0.17.8

func (b Cluster) GetParentName() string

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"`
	LibP2PKey string                      `yaml:"libp2p-key"`
	SwarmKey  *orchestration.EncryptedKey `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 Inheritable added in v0.17.8

type Inheritable interface {
	GetParentName() string
}

type NodeEndpoint added in v0.15.9

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

type NodeGroup

type NodeGroup struct {
	// parent to inherit settings from
	*Inherit `yaml:",inline"`
	// node group configuration
	Annotations               *map[string]string `yaml:"annotations"`
	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"`
	Labels                    *map[string]string `yaml:"labels"`
	NodeSelector              *map[string]string `yaml:"node-selector"`
	P2PWSSNodePort            *int32             `yaml:"p2p-wss-node-port"`
	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

func (NodeGroup) GetParentName added in v0.17.8

func (b NodeGroup) GetParentName() string

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) (any, 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