Documentation ¶
Index ¶
- Constants
- type AGConfig
- type ArchSynonyms
- type Collaborators
- type Config
- type FSSConfig
- type HTTPClientFactory
- type HorizonConfig
- func (c *HorizonConfig) FSSIsUnixProtocol() bool
- func (c *HorizonConfig) GetAgbotAgreementBatchSize() uint64
- func (c *HorizonConfig) GetAgbotCSSCert() string
- func (c *HorizonConfig) GetAgbotCSSURL() string
- func (c *HorizonConfig) GetCSSSSLCert() string
- func (c *HorizonConfig) GetCSSURL() string
- func (c *HorizonConfig) GetESSPollingRate() uint16
- func (c *HorizonConfig) GetESSSSLCertKeyPath() string
- func (c *HorizonConfig) GetESSSSLClientCertPath() string
- func (c *HorizonConfig) GetFileSyncServiceAPIListen() string
- func (c *HorizonConfig) GetFileSyncServiceAPIPort() uint16
- func (c *HorizonConfig) GetFileSyncServiceAPIUnixDomainSocketPath() string
- func (c *HorizonConfig) GetFileSyncServiceAuthPath() string
- func (c *HorizonConfig) GetFileSyncServiceProtocol() string
- func (c *HorizonConfig) GetFileSyncServiceStoragePath() string
- func (c *HorizonConfig) GetPartitionStale() uint64
- func (c *HorizonConfig) IsBoltDBConfigured() bool
- func (c *HorizonConfig) IsPostgresqlConfigured() bool
- func (c *HorizonConfig) String() string
- func (c *HorizonConfig) UserPublicKeyPath() string
- type KeyFileNamesFetcher
- type PostgresqlConfig
Constants ¶
const AgbotAgreementBatchSize_DEFAULT = 200
The default agreement batch size
const AgbotMessageKeyCheck_DEFAULT = 60
The Default interval at which the agbot verifies that its message key is present in the exchange.
const ENVVAR_PREFIX = "HZN_"
ENVVAR_PREFIX is used when Anax sets envvars in orchestrated containers
const ExchangeMessageNoDynamicPollEnvvarName = "HZN_NO_DYNAMIC_POLL"
const ExchangeMessagePollIncrement_DEFAULT = 10
The Default message poll increment size.
const ExchangeMessagePollInterval_DEFAULT = 10
The Default starting exchange message polling interval.
const ExchangeMessagePollMaxInterval_DEFAULT = 60
The Default message poll interval maximum.
const ExchangeURLEnvvarName = "HZN_EXCHANGE_URL"
const FileSyncServiceCSSURLEnvvarName = "HZN_FSS_CSSURL"
const HTTPIdleConnectionTimeoutS = 120
HTTPIdleConnectionTimeoutS see https://golang.org/pkg/net/http/
const HTTPRequestTimeoutOverride = "HZN_HTTP_TIMEOUT"
HTTPRequestTimeoutOverride environment variable
const HTTPRequestTimeoutS = 30
HTTPRequestTimeoutS see https://golang.org/pkg/net/http/
const HZN_FSS_API_LISTEN_DEFAULT = "localhost"
The default listen address for the FSS over https
const HZN_FSS_API_LISTEN_PORT_DEFAULT = 8443
const HZN_FSS_AUTH_FILE = "auth.json"
The name of the authentication file that a service can use to authenticate to the FSS (ESS) API.
const HZN_FSS_AUTH_MOUNT = "/" + HZN_FSS_AUTH_PATH
The name of the file mount that a service uses to find its FSS credential file.
const HZN_FSS_AUTH_PATH = "ess-auth"
The relative path of authentication credentials used by services to access the sync service. This path should be combined with the HZN_VAR_BASE_DEFAULT.
const HZN_FSS_CERT_FILE = "cert.pem"
The name of the SSL certificate file that a service can use to make an SSL connection to the FSS (ESS) API.
const HZN_FSS_CERT_KEY_FILE = "key.pem"
The name of the SSL certificate key file that the ESS uses to establish an SSL listener.
const HZN_FSS_CERT_MOUNT = "/" + HZN_FSS_CERT_PATH
The name of the file mount that a service uses to find its FSS SSl client certificate.
const HZN_FSS_CERT_PATH = "ess-cert"
The relative path of SSL client certificate used by services to access the sync service.
const HZN_FSS_DOMAIN_SOCKET = "essapi.sock"
const HZN_FSS_DOMAIN_SOCKET_PATH = "/var/run/horizon"
The path to the agent's unix domain socket for the file sync service
const HZN_FSS_POLLING_RATE = 60
The number of seconds between polls to the CSS for updates.
const HZN_FSS_STORAGE_PATH = "ess-store"
The default relative path of files downloaded by the sync service. This path should be combined with the HZN_VAR_BASE_DEFAULT.
const HZN_VAR_BASE_DEFAULT = "/var/horizon"
const MICROSERVICE_EXEC_TIMEOUT = 180
container start execution timeout for a microservice upgrade
const MaxHTTPIdleConnections = 20
MaxHTTPIdleConnections see https://golang.org/pkg/net/http/
const USERKEYDIR = "/userkeys"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AGConfig ¶
type AGConfig struct { TxLostDelayTolerationSeconds int AgreementWorkers int DBPath string Postgresql PostgresqlConfig // The Postgresql config if it is being used PartitionStale uint64 // Number of seconds to wait before declaring a partition to be stale (i.e. the previous owner has unexpectedly terminated). ProtocolTimeoutS uint64 // Number of seconds to wait before declaring proposal response is lost AgreementTimeoutS uint64 // Number of seconds to wait before declaring agreement not finalized in blockchain NoDataIntervalS uint64 // default should be 15 mins == 15*60 == 900. Ignored if the policy has data verification disabled. ActiveAgreementsURL string // This field is used when policy files indicate they want data verification but they dont specify a URL ActiveAgreementsUser string // This is the userid the agbot uses to authenticate to the data verifivcation API ActiveAgreementsPW string // This is the password for the ActiveAgreementsUser PolicyPath string // The directory where policy files are kept, default /etc/provider-tremor/policy/ NewContractIntervalS uint64 // default should be 1 ProcessGovernanceIntervalS uint64 // How long the gov sleeps before general gov checks (new payloads, interval payments, etc). IgnoreContractWithAttribs string // A comma seperated list of contract attributes. If set, the contracts that contain one or more of the attributes will be ignored. The default is "ethereum_account". ExchangeURL string // The URL of the Horizon exchange. If not configured, the exchange will not be used. ExchangeHeartbeat int // Seconds between heartbeats to the exchange ExchangeVersionCheckIntervalM int64 // Exchange version check interval in minutes. The default is 5. 0 means no periodic checking. ExchangeId string // The id of the agbot, not the userid of the exchange user. Must be org qualified. ExchangeToken string // The agbot's authentication token DVPrefix string // When looking for agreement ids in the data verification API response, look for agreement ids with this prefix. ActiveDeviceTimeoutS int // The amount of time a device can go without heartbeating and still be considered active for the purposes of search ExchangeMessageTTL int // The number of seconds the exchange will keep this message before automatically deleting it MessageKeyPath string // The path to the location of messaging keys MessageKeyCheck int // The interval (in seconds) indicating how often the agbot checks its own object in the exchange to ensure that the message key is still available. DefaultWorkloadPW string // The default workload password if none is specified in the policy file APIListen string // Host and port for the API to listen on PurgeArchivedAgreementHours int // Number of hours to leave an archived agreement in the database before automatically deleting it CheckUpdatedPolicyS int // The number of seconds to wait between checks for an updated policy file. Zero means auto checking is turned off. CSSURL string // The URL used to access the CSS. CSSSSLCert string // The path to the client side SSL certificate for the CSS. MMSGarbageCollectionInterval int64 // The amount of time to wait between MMS object cache garbage collection scans. AgreementBatchSize uint64 // The number of nodes that the agbot will process in a batch. }
This is the configuration options for Agreement bot flavor of Anax
type ArchSynonyms ¶
type ArchSynonyms map[string]string // the key is the arch string and the value is GOARCH representation of the arch which we call canonical arch.
func NewArchSynonyms ¶
func NewArchSynonyms() ArchSynonyms
func (ArchSynonyms) GetCanonicalArch ¶
func (c ArchSynonyms) GetCanonicalArch(arch string) string
return the arch GOARCH representaion of the given arch. It returns an empty string if the given arch is not defined in the ArchSynonyms attribute of the configuration file.
type Collaborators ¶
type Collaborators struct { HTTPClientFactory *HTTPClientFactory KeyFileNamesFetcher *KeyFileNamesFetcher }
func NewCollaborators ¶
func NewCollaborators(hConfig HorizonConfig) (*Collaborators, error)
func (*Collaborators) String ¶
func (c *Collaborators) String() string
type Config ¶
type Config struct { ServiceStorage string // The base storage directory where the service can write or get the data. APIListen string DBPath string DockerEndpoint string DockerCredFilePath string DefaultCPUSet string DefaultServiceRegistrationRAM int64 StaticWebContent string PublicKeyPath string TrustSystemCACerts bool // If equal to true, the HTTP client factory will set up clients that trust CA certs provided by a Linux distribution (see https://golang.org/pkg/crypto/x509/#SystemCertPool and https://golang.org/src/crypto/x509/root_linux.go) CACertsPath string // Path to a file containing PEM-encoded x509 certs HTTP clients in Anax will trust (additive to the configuration option "TrustSystemCACerts") ExchangeURL string DefaultHTTPClientTimeoutS uint PolicyPath string ExchangeHeartbeat int // Seconds between heartbeats ExchangeVersionCheckIntervalM int64 // Exchange version check interval in minutes. The default is 720. AgreementTimeoutS uint64 // Number of seconds to wait before declaring agreement not finalized in blockchain DVPrefix string // When passing agreement ids into a workload container, add this prefix to the agreement id RegistrationDelayS uint64 // The number of seconds to wait after blockchain init before registering with the exchange. This is for testing initialization ONLY. ExchangeMessageTTL int // The number of seconds the exchange will keep this message before automatically deleting it ExchangeMessageDynamicPoll bool // Will the runtime dynamically increase the message poll interval? Default is true. Set to false to turn off dynamic message poll interval adjustments. ExchangeMessagePollInterval int // The number of seconds the node will wait between polls to the exchange. This is the starting value, but at runtime this interval will increase if there is no message activity to reduce load on the exchange. If ExchangeMessageDynamicPoll is false, then the value of this field will never be changed by the runtime. ExchangeMessagePollMaxInterval int // As the runtime increases the ExchangeMessagePollInterval, this value is the maximum that value can attain. ExchangeMessagePollIncrement int // The number of seconds to increment the ExchangeMessagePollInterval when its time to increase the poll interval. UserPublicKeyPath string // The location to store user keys uploaded through the REST API ReportDeviceStatus bool // whether to report the device status to the exchange or not. TrustCertUpdatesFromOrg bool // whether to trust the certs provided by the organization on the exchange or not. TrustDockerAuthFromOrg bool // whether to turst the docker auths provided by the organization on the exchange or not. ServiceUpgradeCheckIntervalS int64 // service upgrade check interval in seconds. The default is 300 seconds. MultipleAnaxInstances bool // multiple anax instances running on the same machine DefaultServiceRetryCount int // the default service retry count if retries are not specified by the policy file. The default value is 2. DefaultServiceRetryDuration uint64 // the default retry duration in seconds. The next retry cycle occurs after the duration. The default value is 600 ServiceConfigStateCheckIntervalS int // the service configuration state check interval. The default is 30 seconds. DefaultNodePolicyFile string // the default node policy file name. NodePolicyCheckIntervalS int // the node policy check interval. The default is 15 seconds. NodeUserInputCheckIntervalS int // the node user input check interval. The default is 15 seconds. FileSyncService FSSConfig // The config for the embedded ESS sync service. SurfaceErrorTimeoutS int //How long surfaced errors will remain active after they're created. Default is no timeout SurfaceErrorCheckIntervalS int //How often the node will check for errors that are no longer active and update the exchange. Default is 15 seconds SurfaceErrorAgreementPersistentS int //How long an agreement needs to persist before it is considered persistent and the related errors are dismisse. Default is 90 seconds // these Ids could be provided in config or discovered after startup by the system BlockchainAccountId string BlockchainDirectoryAddress string }
This is the configuration options for Edge component flavor of Anax
type FSSConfig ¶
type FSSConfig struct { APIListen string // The address on which the ESS will listen. The default is in the code below. For a unix domain socket path, it must be the full path name including the file name. APIPort uint16 // The port on which the ESS will listen. For a unix domain socket, this will always be "0". APIProtocol string // Can be 'unix' or 'https'. Default is unix. The value of this field determines the Listen and Port values. PersistencePath string // The absolute location in the host filesystem where anax stores files retrieved by the file sync service. AuthenticationPath string // The absolute location in the host filesystem where anax stores authentication credentials for services so that the service can authenticate to the FSS (ESS) API. CSSURL string // The URL used to access the CSS. CSSSSLCert string // The path to the client side SSL certificate for the CSS. PollingRate uint16 // The number of seconds between polls to the CSS for notification updates. }
Configuration for the File Sync Service, which is implemented by the embedded ESS.
type HTTPClientFactory ¶
func (*HTTPClientFactory) WrappedNewHTTPClient ¶
func (f *HTTPClientFactory) WrappedNewHTTPClient() func(*uint) *http.Client
WrappedHTTPClient is a function producer that wraps an HTTPClient's NewHTTPClient method in a generic function call for compatibilty with external callers.
type HorizonConfig ¶
type HorizonConfig struct { Edge Config AgreementBot AGConfig Collaborators Collaborators ArchSynonyms ArchSynonyms }
func Read ¶
func Read(file string) (*HorizonConfig, error)
func (*HorizonConfig) FSSIsUnixProtocol ¶
func (c *HorizonConfig) FSSIsUnixProtocol() bool
func (*HorizonConfig) GetAgbotAgreementBatchSize ¶
func (c *HorizonConfig) GetAgbotAgreementBatchSize() uint64
func (*HorizonConfig) GetAgbotCSSCert ¶
func (c *HorizonConfig) GetAgbotCSSCert() string
func (*HorizonConfig) GetAgbotCSSURL ¶
func (c *HorizonConfig) GetAgbotCSSURL() string
func (*HorizonConfig) GetCSSSSLCert ¶
func (c *HorizonConfig) GetCSSSSLCert() string
func (*HorizonConfig) GetCSSURL ¶
func (c *HorizonConfig) GetCSSURL() string
func (*HorizonConfig) GetESSPollingRate ¶
func (c *HorizonConfig) GetESSPollingRate() uint16
func (*HorizonConfig) GetESSSSLCertKeyPath ¶
func (c *HorizonConfig) GetESSSSLCertKeyPath() string
func (*HorizonConfig) GetESSSSLClientCertPath ¶
func (c *HorizonConfig) GetESSSSLClientCertPath() string
func (*HorizonConfig) GetFileSyncServiceAPIListen ¶
func (c *HorizonConfig) GetFileSyncServiceAPIListen() string
func (*HorizonConfig) GetFileSyncServiceAPIPort ¶
func (c *HorizonConfig) GetFileSyncServiceAPIPort() uint16
The APIProtocol field controls the Listen and Port fields. If the Protocol field is empty or unix, then the Listen field must be a unix domain socket path and the Port field will be ignored.
func (*HorizonConfig) GetFileSyncServiceAPIUnixDomainSocketPath ¶
func (c *HorizonConfig) GetFileSyncServiceAPIUnixDomainSocketPath() string
Return empty string if unix file socket is not in use.
func (*HorizonConfig) GetFileSyncServiceAuthPath ¶
func (c *HorizonConfig) GetFileSyncServiceAuthPath() string
func (*HorizonConfig) GetFileSyncServiceProtocol ¶
func (c *HorizonConfig) GetFileSyncServiceProtocol() string
func (*HorizonConfig) GetFileSyncServiceStoragePath ¶
func (c *HorizonConfig) GetFileSyncServiceStoragePath() string
func (*HorizonConfig) GetPartitionStale ¶
func (c *HorizonConfig) GetPartitionStale() uint64
func (*HorizonConfig) IsBoltDBConfigured ¶
func (c *HorizonConfig) IsBoltDBConfigured() bool
func (*HorizonConfig) IsPostgresqlConfigured ¶
func (c *HorizonConfig) IsPostgresqlConfigured() bool
func (*HorizonConfig) String ¶
func (c *HorizonConfig) String() string
func (*HorizonConfig) UserPublicKeyPath ¶
func (c *HorizonConfig) UserPublicKeyPath() string
type KeyFileNamesFetcher ¶
type KeyFileNamesFetcher struct { // get all the pem file names from the pulic key path and user key path. // if the publicKeyPath is a file name all the *.pem files within the same directory will be returned. // userkeyPath is always a directory. GetKeyFileNames func(publicKeyPath, userKeyPath string) ([]string, error) }
type PostgresqlConfig ¶
type PostgresqlConfig struct { Host string Port string User string Password string DBName string SSLMode string MaxOpenConnections int }
func (PostgresqlConfig) MakeConnectionString ¶
func (p PostgresqlConfig) MakeConnectionString() (string, string)
func (PostgresqlConfig) String ¶
func (p PostgresqlConfig) String() string