chain

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDBDir       = "db"
	DefaultWALDir      = "wal"
	DefaultContractDir = "contract"
	DefaultCacheDir    = "cache"
	DefaultTmpDBDir    = "tmp"
)
View Source
const (
	ConfigDefaultNormalTxPoolSize = 5000
	ConfigDefaultPatchTxPoolSize  = 1000
	ConfigDefaultMaxBlockTxBytes  = 1024 * 1024
	ConfigDefaultTxTimeout        = 5000 * time.Millisecond
	ConfigDefaultChildrenLimit    = 10
	ConfigDefaultNephewLimit      = 10
)
View Source
const (
	NodeCacheNone    = "none"
	NodeCacheSmall   = "small"
	NodeCacheLarge   = "large"
	NodeCacheDefault = NodeCacheNone
)
View Source
const (
	ConfigDefaultTransactions     = 1000
	ConfigDefaultCommitTimeout    = time.Second
	ConfigDefaultBlockInterval    = time.Second
	ConfigDefaultMinCommitTimeout = 200 * time.Millisecond
)
View Source
const (
	ImportICONTask = "import_icon"
	ImportICONName = "ImportICON"
)
View Source
const TemporalBackupFile = ".backup"

Variables

This section is empty.

Functions

func GetChannel

func GetChannel(channel string, nid int) string

func IsNodeCacheOption

func IsNodeCacheOption(s string) bool

func NewChain

func NewChain(
	wallet module.Wallet,
	transport module.NetworkTransport,
	srv *server.Manager,
	pm eeproxy.Manager,
	logger log.Logger,
	cfg *Config,
) *singleChain

func NewPlatform added in v0.9.1

func NewPlatform(name string, base string, cid int) (base.Platform, error)

func NewRegulator

func NewRegulator(logger log.Logger) *regulator

func ParseNodeCacheOption added in v0.9.10

func ParseNodeCacheOption(s string) (int, int, int, error)

func RegisterPlatform added in v0.9.1

func RegisterPlatform(name string, factory PlatformFactory)

Types

type BackupInfo

type BackupInfo struct {
	NID     common.HexInt32 `json:"nid"`
	CID     common.HexInt32 `json:"cid"`
	Channel string          `json:"channel"`
	Height  int64           `json:"height"`
	Codec   string          `json:"codec"`
}

func GetBackupInfoOf

func GetBackupInfoOf(f string) (*BackupInfo, error)

func ReadBackupInfo

func ReadBackupInfo(zr *zip.Reader) (*BackupInfo, error)

type Config

type Config struct {
	// fixed
	NID    int    `json:"nid"`
	DBType string `json:"db_type"`

	Platform string `json:"platform,omitempty"`

	// static
	SeedAddr         string `json:"seed_addr"`
	Role             uint   `json:"role"`
	ConcurrencyLevel int    `json:"concurrency_level,omitempty"`
	NormalTxPoolSize int    `json:"normal_tx_pool,omitempty"`
	PatchTxPoolSize  int    `json:"patch_tx_pool,omitempty"`
	MaxBlockTxBytes  int    `json:"max_block_tx_bytes,omitempty"`
	NodeCache        string `json:"node_cache,omitempty"`
	AutoStart        bool   `json:"auto_start,omitempty"`
	ChildrenLimit    *int   `json:"children_limit,omitempty"`
	NephewsLimit     *int   `json:"nephews_limit,omitempty"`

	// runtime
	Channel        string `json:"channel"`
	SecureSuites   string `json:"secureSuites"`
	SecureAeads    string `json:"secureAeads"`
	DefWaitTimeout int64  `json:"waitTimeout"`
	MaxWaitTimeout int64  `json:"maxTimeout"`
	TxTimeout      int64  `json:"txTimeout"`

	GenesisStorage module.GenesisStorage `json:"-"`
	Genesis        json.RawMessage       `json:"genesis"`

	BaseDir  string `json:"chain_dir"`
	FilePath string `json:"-"` // absolute path

	NIDForP2P bool `json:"-"`
}

func (*Config) AbsBaseDir

func (c *Config) AbsBaseDir() string

func (*Config) CID

func (c *Config) CID() int

func (*Config) GetChannel

func (c *Config) GetChannel() string

func (*Config) NetID

func (c *Config) NetID() int

func (*Config) ResolveAbsolute

func (c *Config) ResolveAbsolute(targetPath string) string

func (*Config) ResolveRelative

func (c *Config) ResolveRelative(targetPath string) string

type PlatformFactory added in v0.9.1

type PlatformFactory func(base string, cid int) (base.Platform, error)

type State

type State int
const (
	Created State = iota
	Initializing
	InitializeFailed
	Starting
	Started
	Stopping
	Failed
	Finished
	Stopped
	Terminating
	Terminated
)

func (State) String

func (s State) String() string

type TaskFactory added in v0.9.6

type TaskFactory func(c *singleChain, params json.RawMessage) (chainTask, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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