Documentation
¶
Overview ¶
Package podopts is a configuration system to fit with the all-in-one philosophy guiding the design of the parallelcoin pod.
The configuration is stored by each component of the connected applications, so all data is stored in concurrent-safe atomics, and there is a facility to invoke a function in response to a new value written into a field by other threads.
There is a custom JSON marshal/unmarshal for each field type and for the whole configuration that only saves values that differ from the defaults, similar to 'omitempty' in struct tags but where 'empty' is the default value instead of the default zero created by Go's memory allocator. This enables easy compositing of multiple sources.
Index ¶
- Variables
- type Config
- func (c *Config) ForEach(fn func(ifc opt.Option) bool) bool
- func (c *Config) GetHelp(hf func(ifc interface{}) error)
- func (c *Config) GetOption(input string) (op opt.Option, value string, e error)
- func (c *Config) Initialize(hf func(ifc interface{}) error) (e error)
- func (c *Config) MarshalJSON() (b []byte, e error)
- func (c *Config) ReadCAFile() []byte
- func (c *Config) UnmarshalJSON(data []byte) (e error)
- func (c *Config) WriteToFile(filename string) (e error)
- type ConfigSlice
- type ConfigSliceElement
- type Configs
Constants ¶
This section is empty.
Variables ¶
var F, E, W, I, D, T log.LevelPrinter = log.GetLogPrinterSet(subsystem)
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// ShowAll is a flag to make the json encoder explicitly define all fields and not just the ones different to the
// defaults
ShowAll bool
// Map is the same data but addressible using its name as found inside the various configuration types, the key is
// converted to lower case for CLI args
Map map[string]opt.Option
Commands cmds.Commands
RunningCommand cmds.Command
ExtraArgs []string
FoundArgs []string
AddCheckpoints *list.Opt
AddPeers *list.Opt
AddrIndex *binary.Opt
AutoListen *binary.Opt
AutoPorts *binary.Opt
BanDuration *duration.Opt
BanThreshold *integer.Opt
BlockMaxSize *integer.Opt
BlockMaxWeight *integer.Opt
BlockMinSize *integer.Opt
BlockMinWeight *integer.Opt
BlockPrioritySize *integer.Opt
BlocksOnly *binary.Opt
CAFile *text.Opt
CPUProfile *text.Opt
ClientTLS *binary.Opt
ConfigFile *text.Opt
ConnectPeers *list.Opt
Controller *binary.Opt
DarkTheme *binary.Opt
DataDir *text.Opt
DbType *text.Opt
DisableBanning *binary.Opt
DisableCheckpoints *binary.Opt
DisableDNSSeed *binary.Opt
DisableListen *binary.Opt
DisableRPC *binary.Opt
Discovery *binary.Opt
ExternalIPs *list.Opt
FreeTxRelayLimit *float.Opt
GenThreads *integer.Opt
Generate *binary.Opt
Hilite *list.Opt
LAN *binary.Opt
LimitPass *text.Opt
LimitUser *text.Opt
Locale *text.Opt
LogDir *text.Opt
LogFilter *list.Opt
LogLevel *text.Opt
MaxOrphanTxs *integer.Opt
MaxPeers *integer.Opt
MinRelayTxFee *float.Opt
MulticastPass *text.Opt
Network *text.Opt
NoCFilters *binary.Opt
NoInitialLoad *binary.Opt
NoPeerBloomFilters *binary.Opt
NoRelayPriority *binary.Opt
NodeOff *binary.Opt
OneTimeTLSKey *binary.Opt
OnionEnabled *binary.Opt
OnionProxyAddress *text.Opt
OnionProxyPass *text.Opt
OnionProxyUser *text.Opt
P2PConnect *list.Opt
P2PListeners *list.Opt
Password *text.Opt
PipeLog *binary.Opt
Profile *text.Opt
ProxyAddress *text.Opt
ProxyPass *text.Opt
ProxyUser *text.Opt
RPCCert *text.Opt
RPCConnect *text.Opt
RPCKey *text.Opt
RPCListeners *list.Opt
RPCMaxClients *integer.Opt
RPCMaxConcurrentReqs *integer.Opt
RPCMaxWebsockets *integer.Opt
RPCQuirks *binary.Opt
RejectNonStd *binary.Opt
RelayNonStd *binary.Opt
RunAsService *binary.Opt
Save *binary.Opt
ServerTLS *binary.Opt
SigCacheMaxSize *integer.Opt
Solo *binary.Opt
TLSSkipVerify *binary.Opt
TorIsolation *binary.Opt
TrickleInterval *duration.Opt
TxIndex *binary.Opt
UPNP *binary.Opt
UUID *integer.Opt
UseWallet *binary.Opt
UserAgentComments *list.Opt
Username *text.Opt
WalletFile *text.Opt
WalletOff *binary.Opt
WalletPass *text.Opt
WalletRPCListeners *list.Opt
WalletRPCMaxClients *integer.Opt
WalletRPCMaxWebsockets *integer.Opt
WalletServer *text.Opt
Whitelists *list.Opt
}
Config defines the configuration items used by pod along with the various components included in the suite
func (*Config) ForEach ¶
ForEach iterates the options in defined order with a closure that takes an opt.Option
func (*Config) GetHelp ¶
GetHelp walks the command tree and gathers the options and creates a set of help functions for all commands and options in the set
func (*Config) Initialize ¶
Initialize loads in configuration from disk and from environment on top of the default base
func (*Config) MarshalJSON ¶
MarshalJSON implements the json marshaller for the config. It only stores non-default values so can be composited.
func (*Config) ReadCAFile ¶
ReadCAFile reads in the configured Certificate Authority for TLS connections
func (*Config) UnmarshalJSON ¶
UnmarshalJSON implements the Unmarshaller interface so it only writes to fields with those non-default values set.
func (*Config) WriteToFile ¶
WriteToFile writes the current config to a file as json
type ConfigSlice ¶
type ConfigSlice []ConfigSliceElement
func (ConfigSlice) Len ¶
func (c ConfigSlice) Len() int
func (ConfigSlice) Less ¶
func (c ConfigSlice) Less(i, j int) bool
func (ConfigSlice) Swap ¶
func (c ConfigSlice) Swap(i, j int)