chain

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: Apache-2.0 Imports: 32 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
)
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 TemporalBackupFile = ".backup"

Variables

View Source
var NodeCacheOptions = [...]string{
	NodeCacheNone, NodeCacheSmall, NodeCacheLarge,
}

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) (service.Platform, error)

func NewRegulator

func NewRegulator(logger log.Logger) *regulator

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"`

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

	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) (service.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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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