Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminConfig ¶
type AdminConfig struct {
// BindAddr is the address to bind to listen for incoming HTTP connections.
BindAddr string `json:"bind_addr" yaml:"bind_addr"`
// AdvertiseAddr is the address to advertise to other nodes.
AdvertiseAddr string `json:"advertise_addr" yaml:"advertise_addr"`
Auth auth.Config `json:"auth" yaml:"auth"`
TLS TLSConfig `json:"tls" yaml:"tls"`
}
func (*AdminConfig) RegisterFlags ¶
func (c *AdminConfig) RegisterFlags(fs *pflag.FlagSet)
func (*AdminConfig) Validate ¶
func (c *AdminConfig) Validate() error
type ClientTLSConfig ¶
type ClientTLSConfig struct {
// Cert contains a path to the PEM encoded certificate to present to
// the server (optional).
Cert string `json:"cert" yaml:"cert"`
// Key contains a path to the PEM encoded private key (optional).
Key string `json:"key" yaml:"key"`
// RootCAs contains a path to root certificate authorities to validate
// the TLS connection between the Piko nodes.
//
// Defaults to using the host root CAs.
RootCAs string `json:"root_cas" yaml:"root_cas"`
// InsecureSkipVerify configures the client to accept any certificate
// presented by the server and any host name in that certificate.
//
// See https://pkg.go.dev/crypto/tls#Config.
InsecureSkipVerify bool `json:"insecure_skip_verify" yaml:"insecure_skip_verify"`
// ServerName is used to verify the hostname on the returned certificate.
// If given, this hostname overrides the hostname used when dialing the
// connection.
//
// See https://pkg.go.dev/crypto/tls#Config.
ServerName string `json:"server_name" yaml:"server_name"`
}
func (*ClientTLSConfig) RegisterFlags ¶
func (c *ClientTLSConfig) RegisterFlags(fs *pflag.FlagSet, prefix string)
func (*ClientTLSConfig) Validate ¶
func (c *ClientTLSConfig) Validate() error
type ClusterConfig ¶
type ClusterConfig struct {
// NodeID is a unique identifier for this node in the cluster.
NodeID string `json:"node_id" yaml:"node_id"`
// NodeIDPrefix is a node ID prefix, where Piko will generate the rest of
// the node ID to ensure uniqueness.
NodeIDPrefix string `json:"node_id_prefix" yaml:"node_id_prefix"`
// Join contains a list of addresses of members in the cluster to join.
Join []string `json:"join" yaml:"join"`
// JoinTimeout is the time to keep trying to join the cluster before
// failing.
JoinTimeout time.Duration `json:"join_timeout" yaml:"join_timeout"`
AbortIfJoinFails bool `json:"abort_if_join_fails" yaml:"abort_if_join_fails"`
Gossip gossip.Config `json:"gossip" yaml:"gossip"`
}
func (*ClusterConfig) RegisterFlags ¶
func (c *ClusterConfig) RegisterFlags(fs *pflag.FlagSet)
func (*ClusterConfig) Validate ¶
func (c *ClusterConfig) Validate() error
type Config ¶
type Config struct {
Proxy ProxyConfig `json:"proxy" yaml:"proxy"`
Upstream UpstreamConfig `json:"upstream" yaml:"upstream"`
Admin AdminConfig `json:"admin" yaml:"admin"`
Cluster ClusterConfig `json:"cluster" yaml:"cluster"`
Usage UsageConfig `json:"usage" yaml:"usage"`
Log log.Config `json:"log" yaml:"log"`
// GracePeriod is the duration to gracefully shutdown the server. During
// the grace period, listeners and idle connections are closed, then waits
// for active requests to complete and closes their connections.
GracePeriod time.Duration `json:"grace_period" yaml:"grace_period"`
}
func (*Config) RegisterFlags ¶
type HTTPConfig ¶
type HTTPConfig struct {
// ReadTimeout is the maximum duration for reading the entire
// request, including the body. A zero or negative value means
// there will be no timeout.
ReadTimeout time.Duration `json:"read_timeout" yaml:"read_timeout"`
// ReadHeaderTimeout is the amount of time allowed to read
// request headers.
ReadHeaderTimeout time.Duration `json:"read_header_timeout" yaml:"read_header_timeout"`
// WriteTimeout is the maximum duration before timing out
// writes of the response.
WriteTimeout time.Duration `json:"write_timeout" yaml:"write_timeout"`
// IdleTimeout is the maximum amount of time to wait for the
// next request when keep-alives are enabled.
IdleTimeout time.Duration `json:"idle_timeout" yaml:"idle_timeout"`
// MaxHeaderBytes controls the maximum number of bytes the
// server will read parsing the request header's keys and
// values, including the request line.
MaxHeaderBytes int `json:"max_header_bytes" yaml:"max_header_bytes"`
}
HTTPConfig contains generic configuration for the HTTP servers.
func (*HTTPConfig) RegisterFlags ¶
func (c *HTTPConfig) RegisterFlags(fs *pflag.FlagSet, prefix string)
type ProxyConfig ¶
type ProxyConfig struct {
// BindAddr is the address to bind to listen for incoming HTTP connections.
BindAddr string `json:"bind_addr" yaml:"bind_addr"`
// AdvertiseAddr is the address to advertise to other nodes.
AdvertiseAddr string `json:"advertise_addr" yaml:"advertise_addr"`
// Timeout is the timeout to forward incoming requests to the upstream.
Timeout time.Duration `json:"timeout" yaml:"timeout"`
// AccessLog allows us to control how the incoming requests to
// the proxy are logged.
AccessLog log.AccessLogConfig `json:"access_log" yaml:"access_log"`
Auth auth.Config `json:"auth" yaml:"auth"`
HTTP HTTPConfig `json:"http" yaml:"http"`
TLS TLSConfig `json:"tls" yaml:"tls"`
}
func (*ProxyConfig) RegisterFlags ¶
func (c *ProxyConfig) RegisterFlags(fs *pflag.FlagSet)
func (*ProxyConfig) Validate ¶
func (c *ProxyConfig) Validate() error
type RebalanceConfig ¶
type RebalanceConfig struct {
// Threshold is the threshold indicating when to rebalance.
//
// Each node will rebalance if its number of local connections exceeds
// the cluster average by the given threshold.
//
// Such as if the threshold is 0.2, the node will rebalance if it has
// over 20% more connections than the cluster average.
//
// Set the threshold to 0 to disable rebalancing.
Threshold float64 `json:"threshold" yaml:"threshold"`
// ShedRate is the percent of connections to drop every second when
// rebalancing (0-1).
//
// Such as if 0.005, the node will drop 0.5% of connections per second until
// it is balanced.
//
// Note the rate is taken as a percent of the average number of connections
// per node in the cluster, rather than the number of connections on the
// local node. This ensures all nodes shed at the same rate.
ShedRate float64 `json:"shed_rate" yaml:"shed_rate"`
// MinConns is the minimum number of local connections the node must have
// before considering rebalancing.
//
// This prevents excess rebalancing when the number of connections is
// too small to matter.
MinConns uint `json:"min_conns" yaml:"min_conns"`
}
func (*RebalanceConfig) RegisterFlags ¶
func (c *RebalanceConfig) RegisterFlags(fs *pflag.FlagSet, prefix string)
func (*RebalanceConfig) Validate ¶
func (c *RebalanceConfig) Validate() error
type TLSConfig ¶
type TLSConfig struct {
Cert string `json:"cert" yaml:"cert"`
Key string `json:"key" yaml:"key"`
ClientCAs string `json:"client_cas" yaml:"client_cas"`
Client ClientTLSConfig `json:"client" yaml:"client"`
}
func (*TLSConfig) RegisterFlags ¶
type TenantConfig ¶
type TenantConfig struct {
ID string `json:"id" yaml:"id"`
Auth auth.Config `json:"auth" yaml:"auth"`
}
func (*TenantConfig) Validate ¶
func (c *TenantConfig) Validate() error
type UpstreamConfig ¶
type UpstreamConfig struct {
// BindAddr is the address to bind to listen for incoming HTTP connections.
BindAddr string `json:"bind_addr" yaml:"bind_addr"`
// AdvertiseAddr is the address to advertise to other nodes.
AdvertiseAddr string `json:"advertise_addr" yaml:"advertise_addr"`
Auth auth.Config `json:"auth" yaml:"auth"`
Rebalance RebalanceConfig `json:"rebalance" yaml:"rebalance"`
TLS TLSConfig `json:"tls" yaml:"tls"`
// Tenants contains the list of supported tenants.
//
// Experimental.
Tenants []TenantConfig `json:"tenants" yaml:"tenants"`
}
func (*UpstreamConfig) RegisterFlags ¶
func (c *UpstreamConfig) RegisterFlags(fs *pflag.FlagSet)
func (*UpstreamConfig) Validate ¶
func (c *UpstreamConfig) Validate() error
type UsageConfig ¶
type UsageConfig struct {
// Disable indicates whether to disable anonymous usage collection.
Disable bool `json:"disable" yaml:"disable"`
}
func (*UsageConfig) RegisterFlags ¶
func (c *UsageConfig) RegisterFlags(fs *pflag.FlagSet)
Click to show internal directories.
Click to hide internal directories.