Documentation ¶
Index ¶
- Constants
- Variables
- func GetDefaultCloseLimit() int
- func GetDefaultDumpPort() int
- func GetDefaultNumLStateClosers() int
- type AccountConfig
- type AuthConfig
- type BaseConfig
- type BlockchainConfig
- type Config
- type ConsensusConfig
- type HardforkConfig
- func (c *HardforkConfig) CheckCompatibility(dbCfg HardforkDbConfig, h types.BlockNo) error
- func (c *HardforkConfig) Height(verStr string) types.BlockNo
- func (c *HardforkConfig) IsV2Fork(h types.BlockNo) bool
- func (c *HardforkConfig) IsV3Fork(h types.BlockNo) bool
- func (c *HardforkConfig) Version(h types.BlockNo) int32
- type HardforkDbConfig
- type MempoolConfig
- type MonitorConfig
- type P2PConfig
- type PolarisConfig
- type RPCConfig
- type RaftBPConfig
- type RaftConfig
- type SQLConfig
- type ServerContext
- func (ctx *ServerContext) GetConfigFileName() string
- func (ctx *ServerContext) GetDefaultAccountConfig() *AccountConfig
- func (ctx *ServerContext) GetDefaultAuthConfig() *AuthConfig
- func (ctx *ServerContext) GetDefaultBaseConfig() BaseConfig
- func (ctx *ServerContext) GetDefaultBlockchainConfig() *BlockchainConfig
- func (ctx *ServerContext) GetDefaultConfig() interface{}
- func (ctx *ServerContext) GetDefaultConsensusConfig() *ConsensusConfig
- func (ctx *ServerContext) GetDefaultHardforkConfig() *HardforkConfig
- func (ctx *ServerContext) GetDefaultMempoolConfig() *MempoolConfig
- func (ctx *ServerContext) GetDefaultMonitorConfig() *MonitorConfig
- func (ctx *ServerContext) GetDefaultP2PConfig() *P2PConfig
- func (ctx *ServerContext) GetDefaultPolarisConfig() *PolarisConfig
- func (ctx *ServerContext) GetDefaultRPCConfig() *RPCConfig
- func (ctx *ServerContext) GetDefaultSQLConfig() *SQLConfig
- func (ctx *ServerContext) GetHomePath() string
- func (ctx *ServerContext) GetTemplate() string
Constants ¶
const (
EnvironmentPrefix = "AG"
)
Config should be read-only in outer world, but golang doesn't have any simple solution for that. A Developer MUST NOT modify config value in caller code.
Variables ¶
var ( MainNetHardforkConfig = &HardforkConfig{ V2: types.BlockNo(19611555), V3: types.BlockNo(111499715), } TestNetHardforkConfig = &HardforkConfig{ V2: types.BlockNo(18714241), V3: types.BlockNo(100360545), } AllEnabledHardforkConfig = &HardforkConfig{ V2: types.BlockNo(0), V3: types.BlockNo(0), } )
Functions ¶
func GetDefaultCloseLimit ¶
func GetDefaultCloseLimit() int
func GetDefaultDumpPort ¶
func GetDefaultDumpPort() int
GetDefaultDumpPort return the default port of the dumper.
func GetDefaultNumLStateClosers ¶
func GetDefaultNumLStateClosers() int
Types ¶
type AccountConfig ¶
type AccountConfig struct {
UnlockTimeout uint `mapstructure:"unlocktimeout" description:"lock automatically after timeout (sec)"`
}
Account defines configurations for account service
type AuthConfig ¶
type AuthConfig struct {
EnableLocalConf bool `mapstructure:"enablelocalconf" description:"apply local white/blacklist file or not"`
}
AuthConfig defines configuration for auditing
type BaseConfig ¶
type BaseConfig struct { DataDir string `mapstructure:"datadir" description:"Directory to store datafiles"` DbType string `mapstructure:"dbtype" description:"db implementation to store data"` EnableProfile bool `mapstructure:"enableprofile" description:"enable profiling"` ProfilePort int `mapstructure:"profileport" description:"profile port (default:6060)"` EnableDump bool `mapstructure:"enabledump" description:"enable dump feature for debugging"` DumpPort int `mapstructure:"dumpport" description:"dump port (default:7070)"` EnableTestmode bool `mapstructure:"enabletestmode" description:"enable unsafe test mode"` UseTestnet bool `mapstructure:"usetestnet" description:"need description"` Personal bool `mapstructure:"personal" description:"enable personal account service"` AuthDir string `mapstructure:"authdir" description:"Directory to store files for auth"` }
BaseConfig defines base configurations for aergo server
type BlockchainConfig ¶
type BlockchainConfig struct { MaxBlockSize uint32 `mapstructure:"maxblocksize" description:"maximum block size in bytes"` CoinbaseAccount string `mapstructure:"coinbaseaccount" description:"wallet address for coinbase"` MaxAnchorCount int `mapstructure:"maxanchorcount" description:"maximum anchor count for sync"` VerifierCount int `mapstructure:"verifiercount" description:"maximum transaction verifier count"` ForceResetHeight uint64 `mapstructure:"forceresetheight" description:"best height to reset chain manually"` ZeroFee bool `mapstructure:"zerofee" description:"enable zero-fee mode(deprecated)"` VerifyOnly bool `` /* 132-byte string literal not displayed */ StateTrace uint64 `mapstructure:"statetrace" description:"dump trace of setting state"` VerifyBlock uint64 `` /* 133-byte string literal not displayed */ NumWorkers int `mapstructure:"numworkers" description:"maximum worker count for chainservice"` NumLStateClosers int `mapstructure:"numclosers" description:"maximum LuaVM state closer count for chainservice"` CloseLimit int `mapstructure:"closelimit" description:"number of LuaVM states which a LuaVM state closer closes at one time"` }
BlockchainConfig defines configurations for blockchain service
type Config ¶
type Config struct { BaseConfig `mapstructure:",squash"` RPC *RPCConfig `mapstructure:"rpc"` P2P *P2PConfig `mapstructure:"p2p"` Polaris *PolarisConfig `mapstructure:"polaris"` Blockchain *BlockchainConfig `mapstructure:"blockchain"` Mempool *MempoolConfig `mapstructure:"mempool"` Consensus *ConsensusConfig `mapstructure:"consensus"` Monitor *MonitorConfig `mapstructure:"monitor"` Account *AccountConfig `mapstructure:"account"` Auth *AuthConfig `mapstructure:"auth"` Hardfork *HardforkConfig `mapstructure:"hardfork"` SQL *SQLConfig `mapstructure:"sql"` }
Config defines configurations of each services
type ConsensusConfig ¶
type ConsensusConfig struct { EnableBp bool `mapstructure:"enablebp" description:"enable block production"` BlockInterval int64 `mapstructure:"blockinterval" description:"block production interval (sec)"` Raft *RaftConfig `mapstructure:"raft"` NoTimeoutTxEviction bool `mapstructure:"notte" description:"disable timeout tx eviction"` }
ConsensusConfig defines configurations for consensus service
type HardforkConfig ¶
type HardforkConfig struct { V2 types.BlockNo `mapstructure:"v2" description:"a block number of the hardfork version 2"` V3 types.BlockNo `mapstructure:"v3" description:"a block number of the hardfork version 3"` }
func (*HardforkConfig) CheckCompatibility ¶
func (c *HardforkConfig) CheckCompatibility(dbCfg HardforkDbConfig, h types.BlockNo) error
type HardforkDbConfig ¶
func (HardforkDbConfig) FixDbConfig ¶
func (dc HardforkDbConfig) FixDbConfig(hConfig HardforkConfig) HardforkDbConfig
type MempoolConfig ¶
type MempoolConfig struct { ShowMetrics bool `mapstructure:"showmetrics" description:"show mempool metric periodically"` EnableFadeout bool `mapstructure:"enablefadeout" description:"Enable transaction fadeout over timeout period"` FadeoutPeriod int `mapstructure:"fadeoutperiod" description:"time period for evict transactions(in hour)"` VerifierNumber int `mapstructure:"verifiers" description:"number of concurrent verifier"` DumpFilePath string `mapstructure:"dumpfilepath" description:"file path for recording mempool at process termintation"` }
MempoolConfig defines configurations for mempool service
type MonitorConfig ¶
type P2PConfig ¶
type P2PConfig struct { // N2N (peer-to-peer) network NetProtocolAddr string `` /* 139-byte string literal not displayed */ NetProtocolPort int `` /* 133-byte string literal not displayed */ NPBindAddr string `mapstructure:"npbindaddr" description:"N2N bind address. If it was set, it only accept connection to this addresse only"` NPBindPort int `` /* 161-byte string literal not displayed */ NPEnableTLS bool `mapstructure:"nptls" description:"Enable TLS on N2N network"` NPCert string `mapstructure:"npcert" description:"Certificate file for N2N network"` NPKey string `mapstructure:"npkey" description:"Private Key file for N2N network"` NPAddPeers []string `mapstructure:"npaddpeers" description'':"Add peers to connect to at startup"` NPHiddenPeers []string `mapstructure:"nphiddenpeers" description:"List of peerids which will not show to other peers"` NPDiscoverPeers bool `mapstructure:"npdiscoverpeers" description:"Whether to discover from polaris or other nodes and connects"` NPMaxPeers int `mapstructure:"npmaxpeers" description:"Maximum number of remote peers to keep"` NPPeerPool int `mapstructure:"nppeerpool" description:"Max peer pool size"` NPExposeSelf bool `mapstructure:"npexposeself" description:"Whether to request expose self to polaris and other connected node"` NPUsePolaris bool `mapstructure:"npusepolaris" description:"Whether to connect and get node list from polaris"` NPAddPolarises []string `mapstructure:"npaddpolarises" description:"Add addresses of polarises if default polaris is not sufficient"` LogFullPeerID bool `mapstructure:"logfullpeerid" description:"Whether to use full legnth peerID or short form"` PeerRole string `mapstructure:"peerrole" description:"Role of peer. It must be sync with enablebp field in consensus config "` Producers []string `mapstructure:"producers" description:"List of peer ids of block producers, only meaningful when peer is agent"` InternalZones []string `` /* 135-byte string literal not displayed */ Agent string `mapstructure:"agent" description:"Peer id of agent that delegates this producer, only available when local peer is producer"` }
P2PConfig defines configurations for p2p service
type PolarisConfig ¶
type PolarisConfig struct { AllowPrivate bool `mapstructure:"allowprivate" description:"allow peer to have private address. for private network and test"` GenesisFile string `mapstructure:"genesisfile" description:"json file containing informations of genesisblock to which polaris refer "` EnableBlacklist bool `mapstructure:"enableblacklist" description:"allow peer to have private address. for private network and test"` }
PolarisConfig defines configuration for polaris server and client (i.e. polarisConnect)
type RPCConfig ¶
type RPCConfig struct { // RPC and REST NetServiceAddr string `mapstructure:"netserviceaddr" description:"RPC service address"` NetServicePort int `mapstructure:"netserviceport" description:"RPC service port"` NetServicePath string `mapstructure:"netservicepath" description:"UNIX domain socket path (only for admin commands)"` NetServiceTrace bool `mapstructure:"netservicetrace" description:"Trace RPC service"` // RPC API with TLS NSEnableTLS bool `mapstructure:"nstls" description:"Enable TLS on RPC or REST API"` NSCert string `mapstructure:"nscert" description:"Server Certificate file for RPC or REST API"` NSKey string `mapstructure:"nskey" description:"Private Key file for RPC or REST API"` NSCACert string `mapstructure:"nscacert" description:"CA Certificate file for RPC or REST API"` NSAllowCORS bool `mapstructure:"nsallowcors" description:"Allow CORS to RPC or REST API"` }
RPCConfig defines configurations for rpc service
type RaftBPConfig ¶
type RaftConfig ¶
type RaftConfig struct { Name string `mapstructure:"name" description:"raft node name. this value must be unique in cluster"` SkipEmpty bool `mapstructure:"skipempty" description:"skip producing block if there is no tx in block"` HeartbeatTick uint `mapstructure:"heartbeattick" description:"heartbeat tick of raft server (millisec)"` ElectionTickCount int `` /* 132-byte string literal not displayed */ BlockFactoryTickMs int64 `mapstructure:"blockfactorytickms" description:"interval to check if block factory should run new task(millisec)"` BlockIntervalMs int64 `mapstructure:"blockintervalms" description:"block interval for raft (millisec). It overrides BlockInterval of consensus"` NewCluster bool `mapstructure:"newcluster" description:"create a new raft cluster if it doesn't already exist"` UseBackup bool `mapstructure:"usebackup" description:"use backup datafiles when creating a new cluster or joining to a existing cluster"` SnapFrequency uint64 `mapstructure:"snapfrequency" description:"frequency which raft make snapshot with log"` SlowNodeGap uint `mapstructure:"slownodegap" description:"frequency which raft make snapshot with log"` RecoverBP *RaftBPConfig `mapstructure:"recoverbp" description:"bp info for creating a new cluster from backup"` StopDupCommit bool `` /* 129-byte string literal not displayed */ }
type SQLConfig ¶
type SQLConfig struct {
MaxDbSize uint64 `mapstructure:"maxdbsize" description:"maximum database size of a contract (MB)"`
}
type ServerContext ¶
type ServerContext struct {
config.BaseContext
}
func NewServerContext ¶
func NewServerContext(homePath string, configFilePath string) *ServerContext
func (*ServerContext) GetConfigFileName ¶
func (ctx *ServerContext) GetConfigFileName() string
func (*ServerContext) GetDefaultAccountConfig ¶
func (ctx *ServerContext) GetDefaultAccountConfig() *AccountConfig
func (*ServerContext) GetDefaultAuthConfig ¶
func (ctx *ServerContext) GetDefaultAuthConfig() *AuthConfig
func (*ServerContext) GetDefaultBaseConfig ¶
func (ctx *ServerContext) GetDefaultBaseConfig() BaseConfig
func (*ServerContext) GetDefaultBlockchainConfig ¶
func (ctx *ServerContext) GetDefaultBlockchainConfig() *BlockchainConfig
func (*ServerContext) GetDefaultConfig ¶
func (ctx *ServerContext) GetDefaultConfig() interface{}
func (*ServerContext) GetDefaultConsensusConfig ¶
func (ctx *ServerContext) GetDefaultConsensusConfig() *ConsensusConfig
func (*ServerContext) GetDefaultHardforkConfig ¶
func (ctx *ServerContext) GetDefaultHardforkConfig() *HardforkConfig
func (*ServerContext) GetDefaultMempoolConfig ¶
func (ctx *ServerContext) GetDefaultMempoolConfig() *MempoolConfig
func (*ServerContext) GetDefaultMonitorConfig ¶
func (ctx *ServerContext) GetDefaultMonitorConfig() *MonitorConfig
func (*ServerContext) GetDefaultP2PConfig ¶
func (ctx *ServerContext) GetDefaultP2PConfig() *P2PConfig
func (*ServerContext) GetDefaultPolarisConfig ¶
func (ctx *ServerContext) GetDefaultPolarisConfig() *PolarisConfig
func (*ServerContext) GetDefaultRPCConfig ¶
func (ctx *ServerContext) GetDefaultRPCConfig() *RPCConfig
func (*ServerContext) GetDefaultSQLConfig ¶
func (ctx *ServerContext) GetDefaultSQLConfig() *SQLConfig
func (*ServerContext) GetHomePath ¶
func (ctx *ServerContext) GetHomePath() string
func (*ServerContext) GetTemplate ¶
func (ctx *ServerContext) GetTemplate() string