config

package
v0.0.0-...-5a6e01e Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package config defines base configs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ContextValueConfig        util.ContextKey = "config"
	ContextValueEncoders      util.ContextKey = "encoders"
	ContextValueJSONEncoder   util.ContextKey = "json_encoder"
	ContextValueBSONEncoder   util.ContextKey = "bson_encoder"
	ContextValueLog           util.ContextKey = "log"
	ContextValueNetworkLog    util.ContextKey = "network_log"
	ContextValueDiscoveryURLs util.ContextKey = "discovery-urls"
)
View Source
var (
	DefaultSyncInterval = time.Second * 10
	DefaultTimeServer   = "time.google.com"
)
View Source
var (
	DefaultLocalNetworkURL       = &url.URL{Scheme: "https", Host: "127.0.0.1:54321"}
	DefaultLocalNetworkBind      = &url.URL{Scheme: "https", Host: "0.0.0.0:54321"}
	DefaultLocalNetworkCache     = "gcache:?type=lru&size=100&expire=3s"
	DefaultLocalNetworkSealCache = "gcache:?type=lru&size=10000&expire=3m"
)
View Source
var (
	DefaultBlockdataPath = "./blockdata"
	DefaultDatabaseURI   = "mongodb://127.0.0.1:27017/mitum"
	DefaultDatabaseCache = fmt.Sprintf(
		"gcache:?type=%s&size=%d&expire=%s",
		cache.DefaultGCacheType,
		cache.DefaultGCacheSize,
		cache.DefaultCacheExpire.String(),
	)
	DefaultDatabaseCacheURL *url.URL
)
View Source
var DefaultRateLimitTargetRules []RateLimitTargetRule
View Source
var DefaultSuffrageRateLimit = map[string]limiter.Rate{
	"operations":     {Period: time.Second * 10, Limit: 100},
	"send-seal":      {Period: time.Second * 10, Limit: 1000},
	"blockdata-maps": {Period: time.Second * 10, Limit: 1000},
	"blockdata":      {Period: time.Second * 10, Limit: 1000},
	"node-info":      {Period: time.Second * 10, Limit: 50},
}
View Source
var DefaultWorldRateLimit = map[string]limiter.Rate{
	"operations":     {Period: time.Second * 10, Limit: 30},
	"send-seal":      {Period: time.Second * 10, Limit: 100},
	"blockdata-maps": {Period: time.Minute * 1, Limit: 60 * 9},
	"blockdata":      {Period: time.Minute * 1, Limit: 60 * 9},
	"node-info":      {Period: time.Second * 10, Limit: 10},
}

Functions

func IfNotNil

func IfNotNil(v interface{}, f func() error) error

func LoadBSONEncoderContextValue

func LoadBSONEncoderContextValue(ctx context.Context, l **bsonenc.Encoder) error

func LoadConfigContextValue

func LoadConfigContextValue(ctx context.Context, l *LocalNode) error

func LoadDiscoveryURLsContextValue

func LoadDiscoveryURLsContextValue(ctx context.Context, l *[]*url.URL) error

func LoadEncodersContextValue

func LoadEncodersContextValue(ctx context.Context, l **encoder.Encoders) error

func LoadJSONEncoderContextValue

func LoadJSONEncoderContextValue(ctx context.Context, l **jsonenc.Encoder) error

func LoadLogContextValue

func LoadLogContextValue(ctx context.Context, l **logging.Logging) error

func LoadNetworkLogContextValue

func LoadNetworkLogContextValue(ctx context.Context, l **logging.Logging) error

func NewChecker

func NewChecker(ctx context.Context) (*checker, error)

func NewValidator

func NewValidator(ctx context.Context) (*validator, error)

func ParseMap

func ParseMap(m map[string]interface{}, key string, allowEmpty bool) (map[string]interface{}, error)

func ParseType

func ParseType(m map[string]interface{}, allowEmpty bool) (string, error)

Types

type BaseBlockdata

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

func (BaseBlockdata) Path

func (no BaseBlockdata) Path() string

func (*BaseBlockdata) SetPath

func (no *BaseBlockdata) SetPath(s string) error

type BaseDatabase

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

func (BaseDatabase) Cache

func (no BaseDatabase) Cache() *url.URL

func (*BaseDatabase) SetCache

func (no *BaseDatabase) SetCache(s string) error

func (*BaseDatabase) SetURI

func (no *BaseDatabase) SetURI(s string) error

func (BaseDatabase) URI

func (no BaseDatabase) URI() *url.URL

type BaseLocalConfigJSONPacker

type BaseLocalConfigJSONPacker struct {
	SyncInterval string `json:"sync-interval,omitempty"`
	TimeServer   string `json:"time_server,omitempty"`
}

type BaseLocalConfigYAMLPacker

type BaseLocalConfigYAMLPacker struct {
	SyncInterval time.Duration `yaml:"sync-interval,omitempty"`
	TimeServer   string        `yaml:"time-server,omitempty"`
}

type BaseLocalNetwork

type BaseLocalNetwork struct {
	*BaseNodeNetwork
	// contains filtered or unexported fields
}

func EmptyBaseLocalNetwork

func EmptyBaseLocalNetwork() *BaseLocalNetwork

func (BaseLocalNetwork) Bind

func (no BaseLocalNetwork) Bind() *url.URL

func (BaseLocalNetwork) Cache

func (no BaseLocalNetwork) Cache() *url.URL

func (BaseLocalNetwork) Certs

func (no BaseLocalNetwork) Certs() []tls.Certificate

func (BaseLocalNetwork) MarshalJSON

func (no BaseLocalNetwork) MarshalJSON() ([]byte, error)

func (BaseLocalNetwork) MarshalYAML

func (no BaseLocalNetwork) MarshalYAML() (interface{}, error)

func (BaseLocalNetwork) RateLimit

func (no BaseLocalNetwork) RateLimit() RateLimit

func (BaseLocalNetwork) SealCache

func (no BaseLocalNetwork) SealCache() *url.URL

func (*BaseLocalNetwork) SetBind

func (no *BaseLocalNetwork) SetBind(s string) error

func (*BaseLocalNetwork) SetCache

func (no *BaseLocalNetwork) SetCache(s string) error

func (*BaseLocalNetwork) SetCerts

func (no *BaseLocalNetwork) SetCerts(certs []tls.Certificate) error

func (*BaseLocalNetwork) SetRateLimit

func (no *BaseLocalNetwork) SetRateLimit(s RateLimit) error

func (*BaseLocalNetwork) SetSealCache

func (no *BaseLocalNetwork) SetSealCache(s string) error

type BaseLocalNetworkPackerJSON

type BaseLocalNetworkPackerJSON struct {
	URL       string    `json:"url"`
	Bind      string    `json:"bind"`
	Cache     string    `json:"cache,omitempty"`
	SealCache string    `json:"seal_cache,omitempty"`
	RateLimit RateLimit `json:"rate-limit,omitempty"`
}

type BaseLocalNetworkPackerYAML

type BaseLocalNetworkPackerYAML struct {
	URL       string
	Bind      string
	Cache     string    `yaml:"cache,omitempty"`
	SealCache string    `yaml:"seal-cache,omitempty"`
	RateLimit RateLimit `yaml:"rate-limit,omitempty"`
}

type BaseLocalNode

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

func NewBaseLocalNode

func NewBaseLocalNode(enc encoder.Encoder, source map[string]interface{}) *BaseLocalNode

func (BaseLocalNode) Address

func (no BaseLocalNode) Address() base.Address

func (BaseLocalNode) GenesisOperations

func (no BaseLocalNode) GenesisOperations() []operation.Operation

func (BaseLocalNode) LocalConfig

func (no BaseLocalNode) LocalConfig() LocalConfig

func (BaseLocalNode) MarshalJSON

func (no BaseLocalNode) MarshalJSON() ([]byte, error)

func (BaseLocalNode) Network

func (no BaseLocalNode) Network() LocalNetwork

func (BaseLocalNode) NetworkID

func (no BaseLocalNode) NetworkID() base.NetworkID

func (BaseLocalNode) Nodes

func (no BaseLocalNode) Nodes() []RemoteNode

func (BaseLocalNode) Policy

func (no BaseLocalNode) Policy() Policy

func (BaseLocalNode) Privatekey

func (no BaseLocalNode) Privatekey() key.Privatekey

func (BaseLocalNode) ProposalProcessor

func (no BaseLocalNode) ProposalProcessor() ProposalProcessor

func (*BaseLocalNode) SetAddress

func (no *BaseLocalNode) SetAddress(s string) error

func (*BaseLocalNode) SetGenesisOperations

func (no *BaseLocalNode) SetGenesisOperations(ops []operation.Operation) error

func (*BaseLocalNode) SetLocalConfig

func (no *BaseLocalNode) SetLocalConfig(s LocalConfig) error

func (*BaseLocalNode) SetNetwork

func (no *BaseLocalNode) SetNetwork(n LocalNetwork) error

func (*BaseLocalNode) SetNetworkID

func (no *BaseLocalNode) SetNetworkID(s string) error

func (*BaseLocalNode) SetNodes

func (no *BaseLocalNode) SetNodes(nodes []RemoteNode) error

func (*BaseLocalNode) SetPolicy

func (no *BaseLocalNode) SetPolicy(p Policy) error

func (*BaseLocalNode) SetPrivatekey

func (no *BaseLocalNode) SetPrivatekey(s string) error

func (*BaseLocalNode) SetProposalProcessor

func (no *BaseLocalNode) SetProposalProcessor(pp ProposalProcessor) error

func (*BaseLocalNode) SetStorage

func (no *BaseLocalNode) SetStorage(st Storage) error

func (*BaseLocalNode) SetSuffrage

func (no *BaseLocalNode) SetSuffrage(sf Suffrage) error

func (BaseLocalNode) Source

func (no BaseLocalNode) Source() map[string]interface{}

func (BaseLocalNode) Storage

func (no BaseLocalNode) Storage() Storage

func (BaseLocalNode) Suffrage

func (no BaseLocalNode) Suffrage() Suffrage

type BaseLocalNodePackerJSON

type BaseLocalNodePackerJSON struct {
	Address           base.Address           `json:"address"`
	NetworkID         string                 `json:"network_id"`
	Privatekey        key.Privatekey         `json:"privatekey"`
	Network           LocalNetwork           `json:"network,omitempty"`
	Storage           Storage                `json:"storage"`
	Nodes             []RemoteNode           `json:"nodes,omitempty"`
	Suffrage          map[string]interface{} `json:"suffrage,omitempty"`
	ProposalProcessor map[string]interface{} `json:"proposal_processor,omitempty"`
	Policy            Policy                 `json:"policy,omitempty"`
	GenesisOperations []operation.Operation  `json:"genesis_operations,omitempty"`
}

type BaseLocalNodePackerYAML

type BaseLocalNodePackerYAML struct {
	Address           base.Address
	NetworkID         string `yaml:"network-id"`
	Privatekey        key.Privatekey
	Network           LocalNetwork `yaml:",omitempty"`
	Storage           Storage
	Nodes             []RemoteNode           `yaml:"nodes,omitempty"`
	Suffrage          map[string]interface{} `yaml:",omitempty"`
	ProposalProcessor map[string]interface{} `yaml:",omitempty"`
	Policy            Policy                 `yaml:",omitempty"`
	GenesisOperations []operation.Operation  `yaml:"genesis-operations,omitempty"`
	Extras            map[string]interface{} `yaml:",inline,omitempty"`
}

func NewBaseLocalNodePackerYAMLFromConfig

func NewBaseLocalNodePackerYAMLFromConfig(conf LocalNode) BaseLocalNodePackerYAML

type BaseNodeNetwork

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

func EmptyBaseNodeNetwork

func EmptyBaseNodeNetwork() *BaseNodeNetwork

func (BaseNodeNetwork) ConnInfo

func (no BaseNodeNetwork) ConnInfo() network.ConnInfo

func (*BaseNodeNetwork) SetConnInfo

func (no *BaseNodeNetwork) SetConnInfo(c network.ConnInfo) error

type BasePolicy

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

func (BasePolicy) IntervalBroadcastingACCEPTBallot

func (no BasePolicy) IntervalBroadcastingACCEPTBallot() time.Duration

func (BasePolicy) IntervalBroadcastingINITBallot

func (no BasePolicy) IntervalBroadcastingINITBallot() time.Duration

func (BasePolicy) IntervalBroadcastingProposal

func (no BasePolicy) IntervalBroadcastingProposal() time.Duration

func (BasePolicy) MarshalJSON

func (no BasePolicy) MarshalJSON() ([]byte, error)

func (BasePolicy) MarshalYAML

func (no BasePolicy) MarshalYAML() (interface{}, error)

func (*BasePolicy) MaxOperationsInProposal

func (no *BasePolicy) MaxOperationsInProposal() uint

func (*BasePolicy) MaxOperationsInSeal

func (no *BasePolicy) MaxOperationsInSeal() uint

func (BasePolicy) NetworkConnectionTimeout

func (no BasePolicy) NetworkConnectionTimeout() time.Duration

func (*BasePolicy) SetIntervalBroadcastingACCEPTBallot

func (no *BasePolicy) SetIntervalBroadcastingACCEPTBallot(s string) error

func (*BasePolicy) SetIntervalBroadcastingINITBallot

func (no *BasePolicy) SetIntervalBroadcastingINITBallot(s string) error

func (*BasePolicy) SetIntervalBroadcastingProposal

func (no *BasePolicy) SetIntervalBroadcastingProposal(s string) error

func (*BasePolicy) SetMaxOperationsInProposal

func (no *BasePolicy) SetMaxOperationsInProposal(m uint) error

func (*BasePolicy) SetMaxOperationsInSeal

func (no *BasePolicy) SetMaxOperationsInSeal(m uint) error

func (*BasePolicy) SetNetworkConnectionTimeout

func (no *BasePolicy) SetNetworkConnectionTimeout(s string) error

func (*BasePolicy) SetThresholdRatio

func (no *BasePolicy) SetThresholdRatio(s float64) error

func (*BasePolicy) SetTimeoutWaitingProposal

func (no *BasePolicy) SetTimeoutWaitingProposal(s string) error

func (*BasePolicy) SetTimespanValidBallot

func (no *BasePolicy) SetTimespanValidBallot(s string) error

func (*BasePolicy) SetWaitBroadcastingACCEPTBallot

func (no *BasePolicy) SetWaitBroadcastingACCEPTBallot(s string) error

func (BasePolicy) ThresholdRatio

func (no BasePolicy) ThresholdRatio() base.ThresholdRatio

func (BasePolicy) TimeoutWaitingProposal

func (no BasePolicy) TimeoutWaitingProposal() time.Duration

func (BasePolicy) TimespanValidBallot

func (no BasePolicy) TimespanValidBallot() time.Duration

func (BasePolicy) WaitBroadcastingACCEPTBallot

func (no BasePolicy) WaitBroadcastingACCEPTBallot() time.Duration

type BasePolicyPackerJSON

type BasePolicyPackerJSON struct {
	ThresholdRatio                   base.ThresholdRatio `json:"threshold,omitempty"`
	MaxOperationsInSeal              uint                `json:"max_operations_in_seal"`
	MaxOperationsInProposal          uint                `json:"max_operations_in_proposal"`
	TimeoutWaitingProposal           string              `json:"timeout_waiting_proposal,omitempty"`
	IntervalBroadcastingINITBallot   string              `json:"interval_broadcasting_init_ballot,omitempty"`
	IntervalBroadcastingProposal     string              `json:"interval_broadcasting_proposal,omitempty"`
	WaitBroadcastingACCEPTBallot     string              `json:"wait_broadcasting_accept_ballot,omitempty"`
	IntervalBroadcastingACCEPTBallot string              `json:"interval_broadcasting_accept_ballot,omitempty"`
	TimespanValidBallot              string              `json:"timespan_valid_ballot,omitempty"`
	NetworkConnectionTimeout         string              `json:"network_connection_timeout,omitempty"`
}

type BasePolicyPackerYAML

type BasePolicyPackerYAML struct {
	ThresholdRatio                   base.ThresholdRatio `yaml:"threshold,omitempty"`
	MaxOperationsInSeal              uint                `yaml:"max-operations-in-seal"`
	MaxOperationsInProposal          uint                `yaml:"max-operations-in-proposal"`
	TimeoutWaitingProposal           time.Duration       `yaml:"timeout-waiting-proposal,omitempty"`
	IntervalBroadcastingINITBallot   time.Duration       `yaml:"interval-broadcasting-init-ballot,omitempty"`
	IntervalBroadcastingProposal     time.Duration       `yaml:"interval-broadcasting-proposal,omitempty"`
	WaitBroadcastingACCEPTBallot     time.Duration       `yaml:"wait-broadcasting-accept-ballot,omitempty"`
	IntervalBroadcastingACCEPTBallot time.Duration       `yaml:"interval-broadcasting-accept-ballot,omitempty"`
	TimespanValidBallot              time.Duration       `yaml:"timespan-valid-ballot,omitempty"`
	NetworkConnectionTimeout         time.Duration       `yaml:"network-connection-timeout,omitempty"`
}

type BaseRateLimit

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

func NewBaseRateLimit

func NewBaseRateLimit(rules []RateLimitTargetRule) *BaseRateLimit

func (BaseRateLimit) Cache

func (no BaseRateLimit) Cache() *url.URL

func (BaseRateLimit) MarshalJSON

func (no BaseRateLimit) MarshalJSON() ([]byte, error)

func (BaseRateLimit) MarshalYAML

func (no BaseRateLimit) MarshalYAML() (interface{}, error)

func (*BaseRateLimit) Preset

func (no *BaseRateLimit) Preset() map[string]RateLimitRules

func (*BaseRateLimit) Rules

func (no *BaseRateLimit) Rules() []RateLimitTargetRule

func (*BaseRateLimit) SetCache

func (no *BaseRateLimit) SetCache(s string) error

func (*BaseRateLimit) SetPreset

func (no *BaseRateLimit) SetPreset(preset map[string]RateLimitRules) error

func (*BaseRateLimit) SetRules

func (no *BaseRateLimit) SetRules(rules []RateLimitTargetRule) error

type BaseRateLimitRules

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

func NewBaseRateLimitRules

func NewBaseRateLimitRules(rules map[string]limiter.Rate) *BaseRateLimitRules

func (BaseRateLimitRules) MarshalJSON

func (no BaseRateLimitRules) MarshalJSON() ([]byte, error)

func (BaseRateLimitRules) MarshalYAML

func (no BaseRateLimitRules) MarshalYAML() (interface{}, error)

func (*BaseRateLimitRules) Rules

func (no *BaseRateLimitRules) Rules() map[string]limiter.Rate

func (*BaseRateLimitRules) SetRules

func (no *BaseRateLimitRules) SetRules(rules map[string]limiter.Rate) error

type BaseRateLimitTargetRule

type BaseRateLimitTargetRule struct {
	*BaseRateLimitRules
	// contains filtered or unexported fields
}

func NewBaseRateLimitTargetRule

func NewBaseRateLimitTargetRule(target, preset string) *BaseRateLimitTargetRule

func (*BaseRateLimitTargetRule) IPNet

func (no *BaseRateLimitTargetRule) IPNet() *net.IPNet

func (BaseRateLimitTargetRule) MarshalJSON

func (no BaseRateLimitTargetRule) MarshalJSON() ([]byte, error)

func (BaseRateLimitTargetRule) MarshalYAML

func (no BaseRateLimitTargetRule) MarshalYAML() (interface{}, error)

func (*BaseRateLimitTargetRule) Preset

func (no *BaseRateLimitTargetRule) Preset() string

func (*BaseRateLimitTargetRule) SetIPNet

func (no *BaseRateLimitTargetRule) SetIPNet(s string) error

func (*BaseRateLimitTargetRule) Target

func (no *BaseRateLimitTargetRule) Target() string

type BaseRemoteNode

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

func NewBaseRemoteNode

func NewBaseRemoteNode(enc encoder.Encoder) *BaseRemoteNode

func (BaseRemoteNode) Address

func (no BaseRemoteNode) Address() base.Address

func (BaseRemoteNode) ConnInfo

func (no BaseRemoteNode) ConnInfo() network.ConnInfo

func (BaseRemoteNode) MarshalJSON

func (no BaseRemoteNode) MarshalJSON() ([]byte, error)

func (BaseRemoteNode) Publickey

func (no BaseRemoteNode) Publickey() key.Publickey

func (*BaseRemoteNode) SetAddress

func (no *BaseRemoteNode) SetAddress(s string) error

func (*BaseRemoteNode) SetConnInfo

func (no *BaseRemoteNode) SetConnInfo(s string, insecure bool) error

func (*BaseRemoteNode) SetPublickey

func (no *BaseRemoteNode) SetPublickey(s string) error

type BaseRemoteNodePackerJSON

type BaseRemoteNodePackerJSON struct {
	Address   base.Address  `json:"address"`
	Publickey key.Publickey `json:"publickey"`
}

type BaseStorage

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

func EmptyBaseStorage

func EmptyBaseStorage() *BaseStorage

func (BaseStorage) Blockdata

func (no BaseStorage) Blockdata() Blockdata

func (BaseStorage) Database

func (no BaseStorage) Database() Database

func (BaseStorage) MarshalJSON

func (no BaseStorage) MarshalJSON() ([]byte, error)

func (BaseStorage) MarshalYAML

func (no BaseStorage) MarshalYAML() (interface{}, error)

func (*BaseStorage) SetBlockdata

func (no *BaseStorage) SetBlockdata(bs Blockdata) error

func (*BaseStorage) SetDatabase

func (no *BaseStorage) SetDatabase(database Database) error

type BaseStoragePackerJSON

type BaseStoragePackerJSON struct {
	Database  DatabasePackerJSON  `json:"database"`
	Blockdata BlockdataPackerJSON `json:"blockdata"`
}

type BaseStoragePackerYAML

type BaseStoragePackerYAML struct {
	Database  DatabasePackerYAML  `yaml:"database"`
	Blockdata BlockdataPackerYAML `yaml:"blockdata"`
}

type Blockdata

type Blockdata interface {
	Path() string
	SetPath(string) error
}

type BlockdataPackerJSON

type BlockdataPackerJSON struct {
	Path string `json:"path"`
}

type BlockdataPackerYAML

type BlockdataPackerYAML struct {
	Path string
}

type Database

type Database interface {
	URI() *url.URL
	SetURI(string) error
	Cache() *url.URL
	SetCache(string) error
}

type DatabasePackerJSON

type DatabasePackerJSON struct {
	URI   string
	Cache string
}

type DatabasePackerYAML

type DatabasePackerYAML struct {
	URI   string `yaml:",omitempty"`
	Cache string `yaml:",omitempty"`
}

type DefaultLocalConfig

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

func EmptyDefaultLocalConfig

func EmptyDefaultLocalConfig() *DefaultLocalConfig

func (DefaultLocalConfig) MarshalJSON

func (no DefaultLocalConfig) MarshalJSON() ([]byte, error)

func (DefaultLocalConfig) MarshalYAML

func (no DefaultLocalConfig) MarshalYAML() (interface{}, error)

func (*DefaultLocalConfig) SetSyncInterval

func (no *DefaultLocalConfig) SetSyncInterval(s string) error

func (*DefaultLocalConfig) SetTimeServer

func (no *DefaultLocalConfig) SetTimeServer(s string) error

func (*DefaultLocalConfig) SyncInterval

func (no *DefaultLocalConfig) SyncInterval() time.Duration

func (*DefaultLocalConfig) TimeServer

func (no *DefaultLocalConfig) TimeServer() string

type DefaultProposalProcessor

type DefaultProposalProcessor struct{}

func (DefaultProposalProcessor) ProposalProcessorType

func (DefaultProposalProcessor) ProposalProcessorType() string

type EmptySuffrage

type EmptySuffrage struct{}

func (EmptySuffrage) IsValid

func (EmptySuffrage) IsValid([]byte) error

func (EmptySuffrage) Nodes

func (EmptySuffrage) Nodes() []base.Address

func (EmptySuffrage) NumberOfActing

func (EmptySuffrage) NumberOfActing() uint

func (EmptySuffrage) SuffrageType

func (EmptySuffrage) SuffrageType() string

type ErrorPoint

type ErrorPoint struct {
	Type   ErrorType   `json:"type"`
	Height base.Height `json:"height"`
	Round  base.Round  `json:"round"`
}

func (*ErrorPoint) UnmarshalYAML

func (ep *ErrorPoint) UnmarshalYAML(decode func(v interface{}) error) error

type ErrorPointYAML

type ErrorPointYAML struct {
	Type  string
	Point string
}

type ErrorProposalProcessor

type ErrorProposalProcessor struct {
	WhenPreparePoints []ErrorPoint
	WhenSavePoints    []ErrorPoint
}

func (ErrorProposalProcessor) ProposalProcessorType

func (ErrorProposalProcessor) ProposalProcessorType() string

type ErrorType

type ErrorType string
const (
	ErrorTypeError          ErrorType = "error"
	ErrorTypeWrongBlockHash ErrorType = "wrong-block"
)

func (ErrorType) IsValid

func (et ErrorType) IsValid([]byte) error

type FixedSuffrage

type FixedSuffrage struct {
	Proposer base.Address

	CacheSize int
	// contains filtered or unexported fields
}

func NewFixedSuffrage

func NewFixedSuffrage(proposer base.Address, nodes []base.Address, numberOfActing uint) FixedSuffrage

func (FixedSuffrage) IsValid

func (fd FixedSuffrage) IsValid([]byte) error

func (FixedSuffrage) Nodes

func (fd FixedSuffrage) Nodes() []base.Address

func (FixedSuffrage) NumberOfActing

func (fd FixedSuffrage) NumberOfActing() uint

func (FixedSuffrage) SuffrageType

func (FixedSuffrage) SuffrageType() string

type LocalConfig

type LocalConfig interface {
	SyncInterval() time.Duration
	SetSyncInterval(string) error
	TimeServer() string
	SetTimeServer(string) error
}

type LocalNetwork

type LocalNetwork interface {
	ConnInfo() network.ConnInfo
	SetConnInfo(network.ConnInfo) error
	Bind() *url.URL
	SetBind(string) error
	Certs() []tls.Certificate
	SetCerts([]tls.Certificate) error
	Cache() *url.URL
	SetCache(string) error
	SealCache() *url.URL
	SetSealCache(string) error
	RateLimit() RateLimit
	SetRateLimit(RateLimit) error
}

type LocalNode

type LocalNode interface {
	Source() map[string]interface{}
	Node
	NetworkID() base.NetworkID
	SetNetworkID(string) error
	Privatekey() key.Privatekey
	SetPrivatekey(string) error
	Network() LocalNetwork
	SetNetwork(LocalNetwork) error
	Storage() Storage
	SetStorage(Storage) error
	Nodes() []RemoteNode
	SetNodes([]RemoteNode) error
	Suffrage() Suffrage
	SetSuffrage(Suffrage) error
	ProposalProcessor() ProposalProcessor
	SetProposalProcessor(ProposalProcessor) error
	Policy() Policy
	SetPolicy(Policy) error
	GenesisOperations() []operation.Operation
	SetGenesisOperations([]operation.Operation) error
	LocalConfig() LocalConfig
	SetLocalConfig(LocalConfig) error
}

type Node

type Node interface {
	Address() base.Address
	SetAddress(string) error
}

type Policy

type Policy interface {
	ThresholdRatio() base.ThresholdRatio
	SetThresholdRatio(float64) error
	MaxOperationsInSeal() uint
	SetMaxOperationsInSeal(uint) error
	MaxOperationsInProposal() uint
	SetMaxOperationsInProposal(uint) error
	TimeoutWaitingProposal() time.Duration
	SetTimeoutWaitingProposal(string) error
	IntervalBroadcastingINITBallot() time.Duration
	SetIntervalBroadcastingINITBallot(string) error
	IntervalBroadcastingProposal() time.Duration
	SetIntervalBroadcastingProposal(string) error
	WaitBroadcastingACCEPTBallot() time.Duration
	SetWaitBroadcastingACCEPTBallot(string) error
	IntervalBroadcastingACCEPTBallot() time.Duration
	SetIntervalBroadcastingACCEPTBallot(string) error
	TimespanValidBallot() time.Duration
	SetTimespanValidBallot(string) error
	NetworkConnectionTimeout() time.Duration
	SetNetworkConnectionTimeout(string) error
}

type ProposalProcessor

type ProposalProcessor interface {
	ProposalProcessorType() string
}

type RateLimit

type RateLimit interface {
	Preset() map[string]RateLimitRules
	SetPreset(map[string]RateLimitRules) error
	Rules() []RateLimitTargetRule
	SetRules([]RateLimitTargetRule) error
	Cache() *url.URL
	SetCache(string) error
}

type RateLimitChecker

type RateLimitChecker struct {
	*logging.Logging
	// contains filtered or unexported fields
}

func NewRateLimitChecker

func NewRateLimitChecker(
	ctx context.Context,
	conf RateLimit,
	basePreset map[string]RateLimitRules,
) *RateLimitChecker

func (*RateLimitChecker) Check

func (cc *RateLimitChecker) Check() (bool, error)

func (*RateLimitChecker) Config

func (cc *RateLimitChecker) Config() RateLimit

func (*RateLimitChecker) Context

func (cc *RateLimitChecker) Context() context.Context

func (*RateLimitChecker) Initialize

func (cc *RateLimitChecker) Initialize() (bool, error)

type RateLimitRules

type RateLimitRules interface {
	Rules() map[string]limiter.Rate
	SetRules(map[string]limiter.Rate) error
}

type RateLimitTargetRule

type RateLimitTargetRule interface {
	RateLimitRules
	Target() string
	Preset() string
	IPNet() *net.IPNet
	SetIPNet(string) error
}

type RemoteNode

type RemoteNode interface {
	Node
	Publickey() key.Publickey
	SetPublickey(string) error
	ConnInfo() network.ConnInfo
	SetConnInfo(string, bool) error
}

type RoundrobinSuffrage

type RoundrobinSuffrage struct {
	CacheSize int
	// contains filtered or unexported fields
}

func NewRoundrobinSuffrage

func NewRoundrobinSuffrage(nodes []base.Address, numberOfActing uint) RoundrobinSuffrage

func (RoundrobinSuffrage) IsValid

func (fd RoundrobinSuffrage) IsValid([]byte) error

func (RoundrobinSuffrage) Nodes

func (fd RoundrobinSuffrage) Nodes() []base.Address

func (RoundrobinSuffrage) NumberOfActing

func (fd RoundrobinSuffrage) NumberOfActing() uint

func (RoundrobinSuffrage) SuffrageType

func (RoundrobinSuffrage) SuffrageType() string

type Storage

type Storage interface {
	Database() Database
	SetDatabase(Database) error
	Blockdata() Blockdata
	SetBlockdata(Blockdata) error
}

type Suffrage

type Suffrage interface {
	isvalid.IsValider
	SuffrageType() string
	Nodes() []base.Address
	NumberOfActing() uint
}

Directories

Path Synopsis
Package yamlconfig defines yaml configs.
Package yamlconfig defines yaml configs.

Jump to

Keyboard shortcuts

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