Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddrPort ¶
AddrPort is a wrapper for netip.AddrPort for which (json/yaml).(Marshaller/Unmarshaller) are implemented.
func ParseAddrPort ¶
ParseAddrPort parses an IPv4/IPv6 address and port string into an AddrPort.
func (AddrPort) MarshalJSON ¶
MarshalJSON implements json.Marshaler for the AddrPort type.
func (AddrPort) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler for the AddrPort type. Note that for yaml we just need to return a yaml marshallable type (if we return []byte as in the json implementation it is written as an int array).
func (AddrPort) String ¶
String returns the string representation of the AddrPort, or an empty string if it is empty.
func (*AddrPort) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for AddrPort.
type AddrPorts ¶
type AddrPorts []AddrPort
AddrPorts is a defined type for a slice of AddrPort. This facilitates convenience functions.
func ParseAddrPorts ¶
ParseAddrPorts parses a list of IPv4/IPv6 address and port strings into an AddrPorts.
func (AddrPorts) SelectRandom ¶
SelectRandom returns a randomly selected AddrPort from AddrPorts.
type CertificateName ¶
type CertificateName string
CertificateName represents the name of a certificate.
const ( // ClusterCertificateName represents the name of the cluster certificate used by the core API. ClusterCertificateName CertificateName = "cluster" // ServerCertificateName represents the name of the identifying certificate of a cluster member. ServerCertificateName CertificateName = "server" )
type ClusterCertificatePut ¶
type ClusterCertificatePut struct { PublicKey string `json:"public_key" yaml:"public_key"` PrivateKey string `json:"private_key" yaml:"private_key"` CA string `json:"ca" yaml:"ca"` }
ClusterCertificatePut represents the content of a new cluster keypair and CA.
type ClusterMember ¶
type ClusterMember struct { ClusterMemberLocal Role string `json:"role" yaml:"role"` SchemaInternalVersion uint64 `json:"schema_internal_version" yaml:"schema_internal_version"` SchemaExternalVersion uint64 `json:"schema_external_version" yaml:"schema_external_version"` LastHeartbeat time.Time `json:"last_heartbeat" yaml:"last_heartbeat"` Status MemberStatus `json:"status" yaml:"status"` Extensions extensions.Extensions `json:"extensions" yaml:"extensions"` Secret string `json:"secret" yaml:"secret"` }
ClusterMember represents information about a dqlite cluster member.
type ClusterMemberLocal ¶
type ClusterMemberLocal struct { Name string `json:"name" yaml:"name"` Address AddrPort `json:"address" yaml:"address"` Certificate X509Certificate `json:"certificate" yaml:"certificate"` }
ClusterMemberLocal represents local information about a new cluster member.
type DaemonConfig ¶
type DaemonConfig struct { Name string `json:"name" yaml:"name"` Address AddrPort `json:"address" yaml:"address"` Servers map[string]ServerConfig `json:"servers" yaml:"servers"` }
DaemonConfig is the in memory version of the local daemon.yaml file.
type DatabaseStatus ¶
type DatabaseStatus string
DatabaseStatus is the current status of the database.
const ( // DatabaseReady indicates the database is open for use. DatabaseReady DatabaseStatus = "Database is online" // DatabaseWaiting indicates the database is blocked on a schema or API extension upgrade. DatabaseWaiting DatabaseStatus = "Database is waiting for an upgrade" // DatabaseStarting indicates the daemon is running, but dqlite is still in the process of starting up. DatabaseStarting DatabaseStatus = "Database is still starting" // DatabaseNotReady indicates the database is not yet ready for use. DatabaseNotReady DatabaseStatus = "Database is not yet initialized" // DatabaseOffline indicates that the database is offline. DatabaseOffline DatabaseStatus = "Database is offline" )
type EndpointPrefix ¶
type EndpointPrefix string
EndpointPrefix is a type specifying the endpoint on which the resource exists.
type KeyPair ¶
type KeyPair struct { Cert string `json:"cert" yaml:"cert"` Key string `json:"key" yaml:"key"` CA string `json:"ca" yaml:"ca"` }
KeyPair holds a certificate together with its private key and optional CA.
type MemberStatus ¶
type MemberStatus string
MemberStatus represents the online status of a cluster member.
const ( // MemberOnline should be the MemberStatus when the node is online and reachable. MemberOnline MemberStatus = "ONLINE" // MemberUnreachable should be the MemberStatus when we were not able to connect to the node. MemberUnreachable MemberStatus = "UNREACHABLE" // MemberNotTrusted should be the MemberStatus when there is no local yaml entry for this node. MemberNotTrusted MemberStatus = "NOT TRUSTED" // MemberNotFound should be the MemberStatus when the node was not found in dqlite. MemberNotFound MemberStatus = "NOT FOUND" // MemberUpgrading should be the MemberStatus if the system is awaiting or performing a schema upgrade. MemberUpgrading MemberStatus = "UPGRADING" // MemberNeedsUpgrade should be the MemberStatus if the system needs to receive a schema upgrade to be compatible with other cluster members. MemberNeedsUpgrade MemberStatus = "NEEDS UPGRADE" )
type RoleStatus ¶
RoleStatus represents the previous and current role of a cluster member.
func (RoleStatus) RoleChanged ¶
func (rs RoleStatus) RoleChanged() bool
RoleChanged returns whether there has been a role change.
type ServerConfig ¶
type ServerConfig struct { // Address is the server listen address. // Example: 127.0.0.1:9000 Address AddrPort `json:"address" yaml:"address"` }
ServerConfig represents the mutable fields of an additional network listener.
type X509Certificate ¶
type X509Certificate struct {
*x509.Certificate
}
X509Certificate is a json/yaml marshallable/unmarshallable type wrapper for x509.Certificate.
func ParseX509Certificate ¶
func ParseX509Certificate(certStr string) (*X509Certificate, error)
ParseX509Certificate decodes the given PEM encoded string and parses it into an X509Certificate.
func (X509Certificate) MarshalJSON ¶
func (c X509Certificate) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for X509Certificate.
func (X509Certificate) MarshalYAML ¶
func (c X509Certificate) MarshalYAML() (any, error)
MarshalYAML implements yaml.Marshaller for X509Certificate.
func (X509Certificate) String ¶
func (c X509Certificate) String() string
String returns the x509.Certificate as a PEM encoded string.
func (*X509Certificate) UnmarshalJSON ¶
func (c *X509Certificate) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler for X509Certificate.
func (*X509Certificate) UnmarshalYAML ¶
func (c *X509Certificate) UnmarshalYAML(unmarshal func(v any) error) error
UnmarshalYAML implements yaml.Unmarshaler for X509Certificate.