config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONFIG_DIR_NAME         = ".ttchain-compute-provider"
	CONFIG_DEFAULT_FILENAME = "config"
	SWARM_KEY               = "/key/swarm/psk/1.0.0/\n/base16/\n55158d9b6b7e5a8e41aa8b34dd057ff1880e38348613d27ae194ad7c5b9670d7"
)

Variables

This section is empty.

Functions

func DefaultConfigDir

func DefaultConfigDir() string

func DefaultConfigPath

func DefaultConfigPath() string

Types

type ChainRegInfo

type ChainRegInfo struct {
	ResourceIndex   uint64
	OrderIndex      uint64
	AgreementIndex  uint64
	RenewOrderIndex uint64
}

type Config

type Config struct {
	ApiPort      int          // API port number
	Identity     Identity     // p2p id
	Keys         []PublicKey  // public key list
	Bootstraps   []string     // local nodes's bootstrap peer addresses
	LinkApi      string       // centralized reporting address
	ChainApi     string       // blockchain address
	SeedOrPhrase string       // blockchain account seed or mnemonic
	Vm           VmOption     // theoretical environment config
	ChainRegInfo ChainRegInfo // chain registration information
}

Config config参数

type ConfigManager

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

func NewConfigManager

func NewConfigManager() *ConfigManager

func NewConfigManagerWithPath

func NewConfigManagerWithPath(path string) *ConfigManager

func (*ConfigManager) AddBootstrap

func (cm *ConfigManager) AddBootstrap(bootstrap string) error

func (*ConfigManager) ConfigVM

func (cm *ConfigManager) ConfigVM(vmOption VmOption) error

ConfigVM config

func (*ConfigManager) GetConfig

func (cm *ConfigManager) GetConfig() (*Config, error)

func (*ConfigManager) RemoveBootstrap

func (cm *ConfigManager) RemoveBootstrap(bootstrap string) error

func (*ConfigManager) Save

func (cm *ConfigManager) Save(config *Config) error

type Identity

type Identity struct {
	PeerID   string
	PrivKey  string `json:",omitempty"`
	SwarmKey string `json:"swarm_key"`
}

Identity p2p identity token structure

func CreateIdentity

func CreateIdentity() (Identity, error)

type PublicKey

type PublicKey struct {
	Key string
}

PublicKey public key information

type VmOption

type VmOption struct {
	Cpu        uint64
	Mem        uint64
	Disk       uint64
	System     string
	Image      string
	AccessPort int
	// virtualization type,docker/kvm
	Type string
}

VmOption vm configin formation

Jump to

Keyboard shortcuts

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