Documentation
¶
Overview ¶
Package configuration holds configuration for all components in Insolar host binary It allows also helps to manage config resources using Holder
Usage:
package main
import (
"github.com/insolar/insolar/configuration"
"fmt"
)
func main() {
holder := configuration.NewHolder()
fmt.Printf("Default configuration:\n %+v\n", holder.Configuration)
holder.SaveAs("insolar.yml")
}
Index ¶
- func ToString(in interface{}) string
- type APIRunner
- type Backup
- type BuiltIn
- type Bus
- type Configuration
- type ConnectionType
- type Exporter
- type GoPlugin
- type Holder
- type HostNetwork
- type Introspection
- type JaegerConfig
- type JetSplit
- type Ledger
- type Log
- type LogicRunner
- type Metrics
- type Pulsar
- type PulsarNodeAddress
- type PulseDistributor
- type ServiceNetwork
- type Storage
- type Tracer
- type Transport
- type VersionManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIRunner ¶ added in v0.2.0
APIRunner holds configuration for api
func NewAPIRunner ¶ added in v0.2.0
NewAPIRunner creates new api config
type Backup ¶ added in v0.9.0
type Backup struct {
// Enabled switches on backuping
Enabled bool
// TmpDirectory is directory for tmp storage of backup data. Must be created
TmpDirectory string
// TargetDirectory is directory where backups will be moved to
TargetDirectory string
// MetaInfoFile contains meta info about backup. It will be in json format
MetaInfoFile string
// ConfirmFile: we wait this file being created when backup was saved on remote host
ConfirmFile string
// BackupFile is file with incremental backup data
BackupFile string
// DirNameTemplate is template for saving current incremental backup. Should be like "pulse-%d"
DirNameTemplate string
// BackupWaitPeriod - how much time we will wait for appearing of file ConfirmFile
BackupWaitPeriod uint
// PostProcessBackupCmd - command which will be invoked after creating backup. It might be used to
// send backup to remote node and do some external checks. If everything is ok, this command must create ConfirmFile
// It will be invoked with environment variable 'INSOLAR_CURRENT_BACKUP_DIR'
// PostProcessBackupCmd[0] is interpreted as command, and PostProcessBackupCmd[1:] as arguments
PostProcessBackupCmd []string
}
Backup holds configuration for backuping.
type Configuration ¶
type Configuration struct {
Host HostNetwork
Service ServiceNetwork
Ledger Ledger
Log Log
Metrics Metrics
LogicRunner LogicRunner
APIRunner APIRunner
AdminAPIRunner APIRunner
Pulsar Pulsar
VersionManager VersionManager
KeysPath string
CertificatePath string
Tracer Tracer
Introspection Introspection
Exporter Exporter
Bus Bus
}
Configuration contains configuration params for all Insolar components
func NewConfiguration ¶
func NewConfiguration() Configuration
NewConfiguration creates new default configuration
type ConnectionType ¶ added in v0.3.0
type ConnectionType string
const (
TCP ConnectionType = "tcp"
)
func (ConnectionType) String ¶ added in v0.3.0
func (ct ConnectionType) String() string
type Exporter ¶ added in v0.7.5
type Exporter struct {
// Addr specifies address where exporter server starts
Addr string
}
Exporter holds exporter configuration.
func NewExporter ¶ added in v0.9.0
func NewExporter() Exporter
NewExporter creates new default configuration for export.
type GoPlugin ¶ added in v0.0.6
type GoPlugin struct {
// RunnerListen - address Go plugins executor listens to
RunnerListen string
// RunnerProtocol - protocol (network) of above address,
// e.g. "tcp", "unix"... see `net.Dial`
RunnerProtocol string
}
GoPlugin configuration
type Holder ¶
type Holder struct {
Configuration Configuration
// contains filtered or unexported fields
}
Holder provides methods to manage configuration
func NewHolderWithFilePaths ¶ added in v0.9.0
NewHolderWithFilePaths creates new holder with possible configuration files paths.
func (*Holder) Init ¶ added in v0.3.0
Init init all configuration data from config file and environment.
Does not fail on not found config file if the 'required' flag set to false.
func (*Holder) LoadFromFile ¶
LoadFromFile method reads configuration from particular file path
func (*Holder) MustInit ¶ added in v0.3.0
MustInit wrapper around Init function which panics on error.
type HostNetwork ¶
type HostNetwork struct {
Transport Transport
MinTimeout int // bootstrap timeout min
MaxTimeout int // bootstrap timeout max
TimeoutMult int // bootstrap timout multiplier
SignMessages bool // signing a messages if true
HandshakeSessionTTL int32 // ms
}
HostNetwork holds configuration for HostNetwork
func NewHostNetwork ¶
func NewHostNetwork() HostNetwork
NewHostNetwork creates new default HostNetwork configuration
type Introspection ¶ added in v0.9.0
type Introspection struct {
// Addr specifies address where introspection server starts
Addr string
}
Introspection holds introspection configuration.
func NewIntrospection ¶ added in v0.9.0
func NewIntrospection() Introspection
NewIntrospection creates new default configuration for introspection.
type JaegerConfig ¶ added in v0.6.2
JaegerConfig holds Jaeger settings.
type JetSplit ¶ added in v0.9.0
type JetSplit struct {
// RecordsCountThreshold is a drop threshold in records to perform split for jet.
ThresholdRecordsCount int
// ThresholdOverflowCount is a how many times in row ThresholdRecordsCount should be surpassed.
ThresholdOverflowCount int
// DepthLimit limits jet tree depth (maximum possible jets = 2^DepthLimit)
DepthLimit uint8
}
JetSplit holds configuration for jet split.
type Ledger ¶
type Ledger struct {
// Storage defines storage configuration.
Storage Storage
// JetSplit holds jet split configuration.
JetSplit JetSplit
// LightChainLimit is maximum pulse difference (NOT number of pulses)
// between current and the latest replicated on heavy.
//
// IMPORTANT: It should be the same on ALL nodes.
LightChainLimit int
// Backup holds configuration of BackupMaker
Backup Backup
// CleanerDelay holds value of pulses, that should happen before end of LightChainLimit and start
// of LME's data cleaning
CleanerDelay int
}
Ledger holds configuration for ledger.
type LogicRunner ¶
type LogicRunner struct {
// RPCListen - address logic runner binds RPC API to
RPCListen string
// RPCProtoco - protocol (network) of above address,
// e.g. "tcp", "unix"... see `net.Dial`
RPCProtocol string
// BuiltIn - configuration of builtin executor
BuiltIn *BuiltIn
// GoPlugin - configuration of executor based on Go plugins
GoPlugin *GoPlugin
}
LogicRunner configuration
func NewLogicRunner ¶
func NewLogicRunner() LogicRunner
NewLogicRunner - returns default config of the logic runner
type Metrics ¶ added in v0.2.0
type Metrics struct {
ListenAddress string
Namespace string
ZpagesEnabled bool
// ReportingPeriod defines exporter reporting period
// if zero, exporter uses default value (1s)
ReportingPeriod time.Duration
}
Metrics holds configuration for metrics publishing.
func NewMetrics ¶ added in v0.2.0
func NewMetrics() Metrics
NewMetrics creates new default configuration for metrics publishing.
type Pulsar ¶ added in v0.0.6
type Pulsar struct {
ConnectionType ConnectionType
MainListenerAddress string
Storage Storage
PulseTime int32 // ms
ReceivingSignTimeout int32 // ms
ReceivingNumberTimeout int32 // ms
ReceivingVectorTimeout int32 // ms
ReceivingSignsForChosenTimeout int32 // ms
Neighbours []PulsarNodeAddress
NumberDelta uint32
DistributionTransport Transport
PulseDistributor PulseDistributor
}
Pulsar holds configuration for pulsar node.
type PulsarNodeAddress ¶ added in v0.3.0
type PulsarNodeAddress struct {
Address string
ConnectionType ConnectionType
PublicKey string
}
type PulseDistributor ¶ added in v0.7.5
type ServiceNetwork ¶
type ServiceNetwork struct {
CacheDirectory string
}
ServiceNetwork is configuration for ServiceNetwork.
func NewServiceNetwork ¶
func NewServiceNetwork() ServiceNetwork
NewServiceNetwork creates a new ServiceNetwork configuration.
type Storage ¶ added in v0.2.0
type Storage struct {
// DataDirectory is a directory where database's files live.
DataDirectory string
// TxRetriesOnConflict defines how many retries on transaction conflicts
// storage update methods should do.
TxRetriesOnConflict int
}
Storage configures Ledger's storage.
type Tracer ¶ added in v0.6.2
type Tracer struct {
Jaeger JaegerConfig
// TODO: add SamplingRules configuration
SamplingRules struct{}
}
Tracer configures tracer.
type Transport ¶
type Transport struct {
// protocol type
Protocol string
// Address to listen
Address string
// if not empty - this should be public address of instance (to connect from the "other" side to)
FixedPublicAddress string
}
Transport holds transport protocol configuration for HostNetwork
type VersionManager ¶ added in v0.6.3
type VersionManager struct {
MinAlowedVersion string
}
VersionManager holds configuration for VersionManager publishing.
func NewVersionManager ¶ added in v0.6.3
func NewVersionManager() VersionManager
NewVersionManager creates new default configuration for VersionManager publishing.