config

package
v0.0.0-...-cacfd1a Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildFromRawConfig

func BuildFromRawConfig(rawConfigs map[string]RawConfig, path string) (map[string]Config, error)

func ParseFile

func ParseFile(path string) (map[string]Config, error)

Types

type Config

type Config struct {
	Listen string
	// optional failover - must exist. TODO: implement
	// Failover     *string `yaml:"failover"`
	// The hashing algorithm used for memcache keys to decide what remote server to send requests to.
	Hash string
	// The distribution algorithm used on hashes of memcache keys to decide which server to send values to.
	Distribution string
	// Timeout is the timeout in milliseconds when golemproxy assumes a connection to a server is dead.
	// TODO: implement
	Timeout uint `yaml:"timeout"`
	// Backlog is the maximum number of in-flight requests to an individual proxy server. If this is exceeded, then requests from the client will be rejected
	// TODO: implement
	Backlog uint `yaml:"backlog"`
	// Preconnect indicates if golemproxy should connect to remote servers before any incoming requests from the client arrive. (unimplemented)
	Preconnect           bool `yaml:"preconnect"`
	MaxServerConnections uint `yaml:"max_server_connections"`
	// AutoEjectHosts bool `yaml:"auto_eject_hosts"`
	Servers []TCPServer
}

Config is the validated data from the config file.

type RawConfig

type RawConfig struct {
	Listen string `yaml:"listen"`
	// Failover     *string `yaml:"failover"`
	Hash         string `yaml:"hash"`
	Distribution string `yaml:"distribution"`
	// TODO: Implement these options
	Timeout    uint `yaml:"timeout"`
	Backlog    uint `yaml:"backlog"`
	Preconnect bool `yaml:"preconnect"`
	// AutoEjectHosts bool     `yaml:"auto_eject_hosts"`
	Servers []string `yaml:"servers"`
}

RawConfig is the structure unserialized from the yaml config file.

func (*RawConfig) UnmarshalYAML

func (raw *RawConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type TCPServer

type TCPServer struct {
	// Host to connect to
	Host string
	Port uint16
	// Key for hashing memcache keys to individual servers
	Key    string
	Weight uint
}

TCPServer represents the config for a TCP Server (including the weight of requests it responds to)

Jump to

Keyboard shortcuts

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