config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const DefaultCaskNum = 8
View Source
const DefaultConfigJson = "config.json"
View Source
const DefaultConfigPath = ".dscluster"
View Source
const DefaultMutcaskPath = "mutcask"

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(path string) (fx.Option, error)

Types

type Addresses

type Addresses struct {
	Swarm []string `json:"swarm"`
}

type Config

type Config struct {
	Identity       Identity    `json:"identity"`
	Addresses      Addresses   `json:"addresses"`
	ConfPath       string      `json:"conf_path"`
	Nodes          []Node      `json:"nodes"`
	DisableDelete  bool        `json:"disable_delete"`
	ReadOnlyClient bool        `json:"read_only_client"`
	BootstrapNode  bool        `json:"bootstrap_node"`
	IdentityList   []Identity  `json:"identity_list"`
	Mutcask        MutcaskConf `json:"mutcask"`
}

func GenClientConf

func GenClientConf() (*Config, error)

GenClientConf Generate config json for cluster client node

  • key pair
  • libp2p listen address

func GenClusterConf

func GenClusterConf(num int) (*Config, error)

GenClusterConf Generate config json files for server nodes in cluster num - how many servers in the cluster

func ReadConfig

func ReadConfig(path string) (*Config, error)

type Identity

type Identity struct {
	PeerID string `json:"peer_id"`
	SK     []byte `json:"sk"`
}

type MutcaskConf added in v0.0.8

type MutcaskConf struct {
	Path            string `json:"path"`
	CaskNum         uint32 `json:"cask_num"`
	HintBootReadNum int    `json:"hint_boot_read_num"`
	Migrate         bool   `json:"migrate"`
}

type Node

type Node struct {
	shard.Node
	Swarm []string `json:"swarm"`
}

Jump to

Keyboard shortcuts

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